Skip to content

mercury-protocol/vulkan

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

94 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Vulkan

The Mercury Compute Network is a distributed compute rental protocol for training artificial intelligence models. Vulkan is the node in the Mercury Compute Network.

Contents:

Introduction

Training complex AI models is a compute-intensive task. Cost is a serious barrier to entry since GPUs are expensive and cloud providers charge insane margins. Paradoxically, at the same time we face a GPU shortage a lot of the world's available computing power is underutilized. Mercury will connect the world's GPUs and CPUs into an AI training supercluster. A significant building block towards this vision is Vulkan, the node that the compute providers run to supply compute to our peer-to-peer network.

Architecture

AI developers send their work requests to the blockchain. Nodes pick up incoming requests and execute the requested computation on the supplied data. They get paid for their work once the successful completion of a compute job has been proven and verified on the blockchain by our smart contract.

The nodes in the network communicate using libp2p. A node can be in one of the three following roles: watcher, leader, and worker.

1. Watcher:

Watchers monitor the blockchain and pick up incoming work requests. Once they pick up a work request, they estimate the computing power needed to complete the request, given the size of the dataset, the number of layers in the neural network, the number of batches, epochs, etc.

Then they map the network to arrive at the optimal selection of nodes for the given work request. They consider the available GPU power of each node, their geographical location, etc. Finally, they distribute the work request to the selected nodes. If a node fails, the other nodes report it to the watcher, and it is the task of the watcher to select a new node.

The workers and the leader send attestations to the watcher, which the watcher verifies, and uploads to the blockchain. The only node that is allowed to upload attestations to the blockchain, and give out work requests to the other nodes, is the watcher. That is why watcher nodes are permissioned.

2. Leader:

The leader is responsible for gathering the computed gradients from the workers, aggregating them, and then broadcasting the updates to all the workers. The leader listens for worker failures and reports them to the watcher. The leader is also a worker.

3. Worker:

The worker runs the supplied AI training algorithm on a given portion of the supplied dataset. It sends the computed gradients to the leader after the configured interval (i.e. after each batch, after every 50 batch, every epoch, etc.).

Usage

The production version will require an Intel SGX-compatible CPU and an NVIDIA GPU. The demo and development versions can be run on any CPU and GPU.

Requirements:

  • Linux or macOS operating system
  • Go 1.21.2
  • Python 3.8
  • Docker
  • Pytorch

Run:

With Docker and Make:

  1. start the watcher node:
make run DOCKER=1 WATCHER=1
  1. start a worker node:
    Copy the "host address" from the logs of the watcher node.
make run DOCKER=1 BOOTSTRAP=/ip4/0.0.0.0/tcp/1939/p2p/QmegYxTUvU7A1iaHHdCmoqbw4q4Tf95EUieCPqCktRBCeh

With Docker without Make:

docker build -t vulkan .
# start the watcher node:
docker run --network host vulkan start --watcher
# start a worker node:
docker run --network host vulkan start --bootstrap /ip4/0.0.0.0/tcp/1939/p2p/QmegYxTUvU7A1iaHHdCmoqbw4q4Tf95EUieCPqCktRBCeh

With Make:

# start the watcher:
make run WATCHER=1
#start a worker:
make run BOOTSTRAP=/ip4/0.0.0.0/tcp/1939/p2p/QmegYxTUvU7A1iaHHdCmoqbw4q4Tf95EUieCPqCktRBCeh

With Go:

go build -o vulkan
# start the watcher:
./vulkan start --watcher
# start a worker:
./vulkan start --bootstrap /ip4/0.0.0.0/tcp/1939/p2p/QmegYxTUvU7A1iaHHdCmoqbw4q4Tf95EUieCPqCktRBCeh

About

Vulkan is the node in the Mercury Compute Network

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •  

Languages