LogoLogo
  • Overview
    • Intro
    • Fair Math Actor
      • Fair Math Controller
      • Fair Math VM
      • Setup an Actor
    • Hello (CIFAR) world!
  • FHE Computer
    • Overview
    • Architectural Layers
      • Application Layer
      • Orchestration Layer
      • Verification Layer
      • Execution Layer
      • Data Layer
    • ISA
      • fhe
      • arith
      • tensor
      • polycircuit
    • Operating System
      • Computer State
      • Application
        • Running Applications
        • External Functions
        • Interactive APPS
      • Execution Graph and Tasks
        • Atomic and Composite Instructions
        • Instruction Unrolling
        • Task Dependencies
        • Execution Graph
      • Process
        • Process lifecycle
        • Resource Allocation and Isolation
      • Order Book
        • Matching Mechanism
        • Task Complexity
        • Instruction Complexity
        • Task re-Delegation
      • Context
        • Context Structure
      • FHE Component Repository
    • Fair Math Actors
      • Task State Monitoring
      • Execution Pairs
      • Rewards and Penalties
    • Ethereum Endpoint
    • CIFAR10 App
  • Whitepapers
    • FHE Computer
    • FHERMA
  • FHERMA
  • Resources
    • Computer CLI
    • FHERMA
    • POLYCIRCUIT (CPP)
    • OpenFHE-rs
    • Talks and Podcasts
  • Social
    • Twitter
    • Linkedin
    • Website
    • Github
Powered by GitBook
LogoLogo
On this page
  1. Overview
  2. Fair Math Actor

Fair Math VM

FHE Virtual Machine

PreviousFair Math ControllerNextSetup an Actor

Last updated 5 months ago

FairMath Virtual Machine

The FairMath Virtual Machine (fairmath-vm) is running on the actor side, responsible for executing instructions received from the through .

We have implemented the virtual machine based on OpenFHE, but the specification allows actors to implement it using other libraries, providing flexibility to developers.

FMVM executes compiled FHE applications or their parts and returns the execution results. It operates solely with local files, with all necessary data prepared in advance.

Required Input Data:

  1. Instructions: A file containing the instructions to execute.

  2. Execution Context: A file with precomputed variables (possibly generated on another actor). The execution context allows splitting the application into blocks and running these blocks across multiple actors.

This approach is explained in detail in our Whitepaper.

FMVM requires no additional configuration, making it simple and efficient to use.

How To Build

  • Install CMake 3.22(or above), gcc or clang

  • Install OpenMP(this is not necessary but highly recommended)

  • Clone vcpkg repo and install binary

$ git clone https://github.com/microsoft/vcpkg.git
$ cd vcpkg && ./bootstrap-vcpkg.sh
  • Add the following env vars

$ export VCPKG_ROOT=/path/to/cloned/vcpkg/repo
$ export PATH=$VCPKG_ROOT:$PATH

You may also to add these variables to your .bashrc file for convenience.

  • Clone fairmath-vm repository

$ git clone https://github.com/fairmath/fairmath-vm
  • Configure cmake and build the project. You should specify vcpkg path, build type and directory for cmake generated file.

$ VCPKG_ROOT=/path/to/cloned/vcpkg/repo BUILD_TYPE=Release BIN_DIR=rel cmake --preset=base && cmake --build BUILD/rel

All files will be located in BUILD directory. You can omit VCPKG_ROOT variable if the one was defined previously(e.g. in the .bashrc file) Also it is possible to create user defined presets for CMake. Just create the following file in the root of the repository CMakeUserPresets.json:

{
    "version": 2,
    "configurePresets": [
      {
        "name": "dbg",
        "inherits": "base",
        "environment": {
          "VCPKG_ROOT": "/path/to/cloned/vcpkg/repo",
          "BUILD_TYPE": "Debug",
          "BIN_DIR": "dbg"
        }
      },
      {
        "name": "rel",
        "inherits": "base",
        "environment": {
          "VCPKG_ROOT": "/path/to/cloned/vcpkg/repo",
          "BUILD_TYPE": "Release",
          "BIN_DIR": "rel"
        }
      }
    ]
}

Since that you are able to run the following command to build release configuration

$ cmake --preset=rel && cmake --build BUILD/rel

Change rel to dbg to build a debug configuration.

The very first build could take a time because of vcpkg will build 3rd party libraries for this project. NExt builds will be mush faster since 3rd party libraries will be already built and cached.

  • Installation Run cmake install to gather all binary files related to the build.

$ cmake --install BUILD/rel

If you are using provided CMakeUserPresets.json then build will be installed to the BUILD/install directory.

Orchestration Layer
Order Book