Golem Network integration with Ray
Project description
Ray on Golem
What is Golem, Ray and Ray on Golem
Golem is a decentralized marketplace for computing power, where providers let requestors use their machines for a small fee.
Ray on Golem makes it super easy to set up and use Golem Network to run your Ray applications.
Ray on the other hand is an open-source framework dedicated to scaling Python workloads. It specializes in tooling for AI/ML applications, but at the same time, it is based on Ray Core which understands every piece of generic Python code.
Ray uses concepts of tasks, actors, and objects to enable building and scaling distributed software. It can be used to parallelize your Python code to use all cores on your own computer, but more importantly, it also offers a cluster interface to run your payload on several, remote machines.
You can learn about Ray Core mechanisms on Ray docs website or check out Ray on Golem docs to dive right into development.
Looking for Beta Testers
We are looking for Beta Testers - sign up to create Ray on Golem with us!
Quickstart
This quickstart shows you how to set Ray and Ray on Golem up, start your cluster, test it, and then stop it. It limits the explanation to the bare minimum - if you are looking for more details jump to setup tutorial
Install software
Note: We recommend creating a new directory and a clean Python virtual environment before you proceed. This avoids cluttering your system installation with unnecessary packages.
The first step is installing Ray on Golem. It will install Ray as a dependency.
# install ray-on-golem and ray (recommended within a clean virtual environment)
pip3 install -U ray-on-golem
Note: As an added convenience, the installation of ray-on-golem
ensures that both ray
and yagna
are set up for you. With these components in place, you're well-prepared to harness the full potential of Ray on the Golem Network.
Set the cluster up
With the packages in place, you can download our sample golem cluster configuration yaml, and use it with ray up
to start up the cluster.
It will give you a cluster of one node (which will expand when you feed it with work) on the Golem test network (free, but not very powerful)
# Download the golem-cluster.yaml
wget https://ray.golem.network/golem-cluster.yaml
# In this command:
# * yagna starts in the background (if not running)
# * ray-on-golem cluster manager starts in the background
# * ray head node is started on a golem provider
ray up golem-cluster.yaml --yes
Consult the troubleshooting guide if anything goes wrong.
Execute a Ray application
Download our example Ray app and execute it locally (a Ray instance will be created on your machine)
# Download the example Ray app
wget https://github.com/golemfactory/ray-on-golem/raw/main/examples/simple-task.py
# Execute the app locally by starting a local ray instance on your computer
python3 simple-task.py
This particular script shows information about the cluster it is being run on and also visualizes the number of tasks run on different nodes (by default it executes 100 tasks).
Once you ensure the app works, you can feed it to your Ray on Golem cluster:
# Submit the app to be executed on your cluster
ray submit golem-cluster.yaml simple-task.py
You can see the information about the cluster both before and after running the computations.
Submit the code again, requesting more tasks to see how the autoscaler expands the cluster, as the work progresses (give it up to 5 mins).
# Submit the app with 400 tasks
ray submit golem-cluster.yaml simple-task.py -- --count 400
The above shows the usual workflow with Ray apps.
- You develop them, while at the same time testing them, on your local machine.
- When you are ready to get more power - you send them to a Ray cluster without changing a single line of your application's code.
Stop the cluster
Finally, stop your cluster to free the Golem network providers and to avoid spending more than needed (the testnet is free, but good practice is a good practice).
# Tear down the cluster.
ray down golem-cluster.yaml --yes
When you no longer plan to start new clusters feel free to stop the background Ray on Golem components.
# Terminate background Ray on Golem components
ray-on-golem stop
Summary
By completing the above quickstart you have successfully:
- Installed ray and ray-on-golem packages
- Downloaded the example golem cluster yaml and the example ray application
- Started up the Ray on Golem cluster
- Run the app on your local computer and then on the cluster
- Stopped the cluster
- Terminated the background Ray on Golem components
Congratulations!
Limitations
The current version of Ray on Golem is an MVP. We believe it to be sufficiently easy to use and free of errors to allow people interested in running simple Ray applications to be able to use it without too much hassle.
We are continually working on enhancing it to ultimately support all features of Ray and to enable all of its use cases.
If you find any bugs or issues or would like to discuss missing features
that are critical to what you're working on, please let us know
(on #Ray on Golem
discord channel) -
we will be happy to assist you.
Ray on Golem works on both the Golem test network (free but not very powerful) and the mainnet.
We have tested Ray on Golem on Ubuntu (22.04+) and WSL, but it should work on other Linux distributions. For now, we don't support MacOS or bare Windows.
The basic Ray on Golem image contains ray 2.9.3
and python 3.10.13
.
It should work with any combination of local ray and python versions. Please let us know if you have any troubles because of that (on #Ray on Golem
discord channel)
The images include only basic libraries, if you need any dependencies,
you can use pip
via cluster yaml initialization_commands
There is also an image supporting Golem GPU Providers - learn more about image configuration.
Next steps
Explore Ray on Golem docs to learn more about various aspects and usages of our platform.
Sign up for Beta Tests to create Ray on Golem with us!
If you have any questions, comments, insights, praises, or doubts about these docs and Ray on Golem in general please don't hesitate to reach out to us either on
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file ray_on_golem-0.12.1.tar.gz
.
File metadata
- Download URL: ray_on_golem-0.12.1.tar.gz
- Upload date:
- Size: 64.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.3 CPython/3.10.14 Linux/6.5.0-1025-azure
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 82f3207b5a529514049d4da297d5a2d0a0d6f2c22a1cdfc9b0fd8013cd9215fb |
|
MD5 | fdf58dc04ac5cab80578a529e81acbf8 |
|
BLAKE2b-256 | 9cfceba010e78400df371bb801682ea905371e8d31ad52669ebb798992c5c8f2 |
File details
Details for the file ray_on_golem-0.12.1-py3-none-any.whl
.
File metadata
- Download URL: ray_on_golem-0.12.1-py3-none-any.whl
- Upload date:
- Size: 81.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.3 CPython/3.10.14 Linux/6.5.0-1025-azure
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 620c9be280ecbe1bb2cf66906132a5fa2c94eaf183096cd17f1e70873cfd95d2 |
|
MD5 | b786207800c7bb9df678c8ac5801fcb4 |
|
BLAKE2b-256 | 319323582b0a97457451f96f693a0b497c9c0329b28110885a41832681d09477 |