If you have multiple GPUs in a single computer, you can optimize performance by starting multiple nodes on the computer and assigning each GPU to a different node.
To enable GPU assignment, use the Docker version of Crynux Node. For a guide on the basics of starting a Crynux Node as a Docker container, please refer to the tutorial below:
Find the ID of the specific GPU
If you want to assign a specific GPU to a node, you must find the ID of the GPU first. This can be done using the nvidia-smi toolkit. Start a terminal and run the following command:
$ nvidia-smi
And you will get the output similar to the following:
Find the ID as highlighted in the image above. In this case, we have a single GPU installed in the computer, the ID of the GPU is 0.
GPU assignment using Docker Compose
In the docker-compose.yml file, find the following section:
The GPU id could also be given to the container in the starting command. If you are starting the container using the following command before:
docker run -p 7412:7412 --name crynux_node --gpus all ghcr.io/crynux-ai/crynux-node:latest
You could change it to:
docker run -p 7412:7412 --name crynux_node --gpus '"device=0"' ghcr.io/crynux-ai/crynux-node:latest
The change is on the --gpus argument, from all, which provides all the GPUs to the container, to '"device=0"', which provides only the GPU with id 0.
Start multiple containers for each of the GPUs on the same computer
For each of the GPUs, follow the tutorial to clone the docker compose project:
For example, if you have 3 GPUs on the same computer, just clone the docker compose project 3 times, after renaming the folders, you have 3 working folders locally:
$ ls
crynux_node_docker_compose_1 crynux_node_docker_compose_2 crynux_node_docker_compose_3
In each of the working folders, find the docker-compose.yml file, and edit the content:
1. Change the name, service name and the container name, so that every container is using a different one:
Finally, in each of the folders, run the docker compose up command to start the container:
$ cd crynux_node_docker_compose_1
$ docker compose up -d
$ cd ../crynux_node_docker_compose_2
$ docker compose up -d
$ cd ../crynux_node_docker_compose_3
$ docker compose up -d