A cadCAD workload dispatcher to the Golem network
Project description
cadCAD Golem
Work in progress - due date 5 January 2021 - (https://gitcoin.co/issue/golemfactory/hackathons/3/100024408)
This package is a wrapper for cadCAD to dispatch the simulation workload to multiple Golem nodes.
cadCAD is a Python package that assists in the processes of designing, testing and validating complex systems through simulation, with support for Monte Carlo methods, A/B testing and parameter sweeping.
Golem is a global, open source, decentralized supercomputer that anyone can access. It is made up of the combined power of users' machines, from PC's to entire data centers.
Note
-
Jupyter Notebook support added.
-
The Golem network is still under development, and not all nodes behave perfectly. If your simulatino fails, try again a few times.
Getting Started
Initialise/Create environment and working directory
If you are already using cadCAD, activate the virtual environment that you use for cadCAD. This might look something like:
source ~/.venv/cadcad
If you do not yet have a working directory or virtual environment, creat both and activate. Something like so:
mkdir -p ~/projects/cadcad-exp
cd ~/projects/cadcad-exp
python3 -m venv .venv
source .venv/bin/activate
Now you have an isolated environment where you can install your python packages without fear of bloating the rest of your system.
Install cadcadgolem
Requires >= Python 3.8
Install Using pip
$ pip3 install cadcadgolem
Install yagna daemon
The Yagna daemon is what you will use to interface with the Golem network. It runs in the background, waiting for API calls from your applications, in our case, from cadcadgolem.
To install yagna, you can use their helper script:
curl -sSf https://join.golem.network/as-requestor | bash -
For manual installation instructions, see: (https://handbook.golem.network/requestor-tutorials/flash-tutorial-of-requestor-development)
To check it is installed corretly, run:
yagna --version
Prepare yagna daemon
To run the yagna daemon, follow the following sequence. This sequence will need to be followed everytime you restart yagna.
Start the daemon
This will initialise the daemon
yagna service run
Generate the app key (This only has to done once after initial install of yagna
)
yagna app-key create requestor
This should produce a 32-character-long hexadecimal app key that you need to note down as it will be needed in your code to run the requestor agent.
Get some coinage
Golem currently has a faucet where you can get free tokens to pay for the processing that you will perform on the network.
yagna payment init -r
Check that the fund transfer was successfull.
yagna payment status
Add your app-key to your code
When using cadcadgolem, a dictionary is passed that contains the parameters for your interaction with the network. One of them is yor app-key, which allows you to speak to the yagna daemon that you started earlier. Place your app-key into your dictionary (see dictionary below).
Using cadcad Golem
To use cadcad Golem, you need to do three things:
- Import the cadcad Golem Ambassador:
from cadcadgolem.golem_embassy import Ambassador
-
Define the golem_conf dictionary:
golem_conf = { 'NODES': 3, # Number of nodes to utilise from the Golem Network. If you've got a big simulation to run, try pushing this up to 30. Remember you need at least twice as many simulation runs as you have nodes. 'BUDGET': 10.0, # Maximum amount of crypto you are prepared to spend 'SUBNET': "community.3", # choose your subnet, currently this is the test network 'YAGNA_APPKEY': '<YOUR-YAGNA_APPKEY-GOES HERE>', # get this from `yagna app-key list` 'TIMEOUT': 120 # In seconds - you will need to figure this out for your workload. Max currently is 25min, so 25 * 60 seconds }
-
Wrap your cadcad
Executor
in the cadcad GolemAmbassador
:Executor = Ambassador(Executor, golem_conf)
For a simple Jupyter Notebook example, see param_sweep.ipynb For a simple python script implementation, see simple_cadcad.py
System initialisation after first install
yagna service run
yagna payment init -r
- Run your cadCAD code!
cadCAD Examples/Demos
You can find more cadCAD demos to play with here: https://github.com/cadCAD-org/demos
To modify them them to work with cadcadGolem, just add the golem_conf dictionary declaration as above, and then wrap the cadCAD Executor
with the cadCADGolem Ambassador
and you're done.
Security Notice
The communication on the Golem network is currently not encrypted, so do not use this for any sensitive data.
Caveats
You need at least twice as many simulation runs as you have nodes, else it the simulation will fail.
Project details
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 cadcadgolem-0.2.2.tar.gz
.
File metadata
- Download URL: cadcadgolem-0.2.2.tar.gz
- Upload date:
- Size: 1.8 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.3.0 pkginfo/1.6.1 requests/2.22.0 setuptools/51.1.1 requests-toolbelt/0.9.1 tqdm/4.55.0 CPython/3.8.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d2e293f3b960afd7dcbb80640d08685cad793fba81f003388df5cfd7fd308261 |
|
MD5 | e5a93cb39878c640d01242609176ae64 |
|
BLAKE2b-256 | ddfbe2261d346351eaaa863907efbf91f8679ebb0a625bfad4193b690ee92efe |
File details
Details for the file cadcadgolem-0.2.2-py3-none-any.whl
.
File metadata
- Download URL: cadcadgolem-0.2.2-py3-none-any.whl
- Upload date:
- Size: 10.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.3.0 pkginfo/1.6.1 requests/2.22.0 setuptools/51.1.1 requests-toolbelt/0.9.1 tqdm/4.55.0 CPython/3.8.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b6b4eae5c6bff26ea64a4ac29fa3a76184d03dd341d687820fbdba4dad94ab55 |
|
MD5 | a788ef92ed9f674996b99c352b49c37e |
|
BLAKE2b-256 | 76016998da6a485219c8d5ef751da7a6f4fe1a7a10922d5c68dcd30a978f4cb8 |