Destra-DGPU – Alpha
Destra-DGPU is a Python package for starting and managing a GPU Worker Node in the Destra GPU Network.
This library is designed to handle all things related to Destra GPU Worker Node, including installing the NVIDIA drivers for the available GPUs, installing all the required dependency libraries, starting the GPU Worker Node, registering with the Destra GPU Registry, and stopping the GPU Worker Node.
Smart Contract
- Destra GPU Registry: 0x1de4fbb30c87e7da5e77fc4e9fbe5b8b06fe1d0b (deployed on testnet)
Prerequisites
- Ubuntu system
- Nvidia GPU
- Stable internet connection
- Sepolia RPC
- Wallet with 0.2 Sepolia ETH
Setup Instructions
1. Clone the GitHub Repository
First, clone the GitHub repository to your local machine.
git clone https://github.com/DestraNetwork/destra-dgpu.git
cd destra-dgpu
2. Run the install_drivers.sh
Script
This script will install the necessary drivers for your GPU. Ensure you have the necessary permissions to execute the script.
cd destra-dgpu
chmod +x install_drivers.sh
sudo ./install_drivers.sh
3. Install Python 3.9.6
Ensure you have Python 3.9.6 installed. You can either install from source or use pyenv
to manage your Python versions.
Install from Source (Recommended)
-
Install Required Build Tools
sudo apt-get update sudo apt-get install build-essential zlib1g-dev libncurses5-dev libgdbm-dev libnss3-dev libssl-dev libreadline-dev libffi-dev curl libbz2-dev
-
Download and Extract Python Source Code
cd /usr/src sudo wget https://www.python.org/ftp/python/3.9.6/Python-3.9.6.tgz sudo tar xzf Python-3.9.6.tgz
-
Build and Install Python
cd Python-3.9.6 sudo ./configure --enable-optimizations sudo make altinstall
Using pyenv
-
Install
pyenv
curl https://pyenv.run | bash
-
Add the following lines to your shell configuration files (e.g.,
~/.bashrc
,~/.zshrc
):export PATH="$HOME/.pyenv/bin:$PATH" eval "$(pyenv init --path)" eval "$(pyenv init -)" eval "$(pyenv virtualenv-init -)"
-
Restart your shell or source the configuration file:
source ~/.bashrc source ~/.zshrc
-
Install Python 3.9.6
pyenv install 3.9.6 pyenv global 3.9.6
4. Set Up a Virtual Environment
Create and activate a virtual environment for your project.
python3.9 -m venv dgpu-env
source dgpu-env/bin/activate
5. Install the Destra-DGPU Package
Install the destra-dgpu
package from the provided wheel file.
cd ~/destra-dgpu
pip install destra-dgpu/destra_dgpu-0.1.0-cp39-cp39-linux_x86_64.whl
6. Set Environment Variables
Set the environment variable NODE_OPERATOR_PRIVATE_KEY
with your private key. Replace YourPrivateKeyHere
with your actual private key (without the 0x
prefix). Ensure at least 0.2 Sepolia ETH.
export NODE_OPERATOR_PRIVATE_KEY=YourPrivateKeyHere
7. Start the GPU Worker Node
It is recommended to use tmux
to manage the session and keep the GPU worker node running in the background.
-
Install
tmux
:sudo apt-get install tmux
-
Start a new
tmux
session:tmux new -s destra-gpu
-
Start the GPU worker node. Replace
<destra_gpu_registry_contract_address>
and<rpc_url>
with the appropriate values.destra-gpu-start-worker <destra_gpu_registry_contract_address> <sepolia_rpc_endpoint>
Example:
destra-gpu-start-worker 0x9B1B198C5C671F8B5a67721cC4Fff5E9F020D505 https://sepolia.infura.io/v3/<YOUR_INFURA_KEY>
-
Detach from the
tmux
session by pressingCtrl + b
, thend
. This will keep the session running in the background.To reattach to the session later, use:
tmux attach -t destra-gpu
8. Stop the GPU Worker Node
To stop the GPU worker node, run the following command from anywhere:
destra-gpu-stop-worker
Troubleshooting
If you encounter any issues, ensure that:
- The environment variables are set correctly.
- The necessary dependencies are installed.
- The correct Python version is being used.
- You have a Nvidia GPU.
- The
install_drivers.sh
script was executed successfully. - If you run a node with incompatible GPU or w/o GPU, no tasks will be assigned.
- If you still face any issues, contact us on our Telegram channel.