2020-03-10 21:36:32 +00:00
# Folding@Home Dockerfile for Nvidia GPUs
2020-03-05 10:46:24 +00:00
2020-03-10 21:36:32 +00:00
Folding@home is a project focused on disease research.
Right now, to the best of my knowledge, they are the
only GPU-based distributed computing project who
are running calculations against Coronavirus.
Here is a combination of [Nikolay Yurin's Folding@home Dockerfile ](https://github.com/yurinnick/folding-at-home-docker )
and the [BOINC Nvidia Dockerfile ](https://github.com/BOINC/boinc-client-docker ),
so that you have an additional layer of sandboxing around
GPU computations of Folding@home. In case you are allowed
to use other people's computers, or your employer's,
using Docker containers might even be a requirement.
2020-03-05 10:46:24 +00:00
## Usage
2020-03-10 21:36:32 +00:00
### Build the image locally
I did not set up anything pre-built on the Docker hub.
Please inspect the Dockerfile and build the image yourself:
```
cd < git-checkout >
docker build -t my-fah-nvidia-image .
```
### and run it:
GPU access by containers went through several stages:
first direct export of /dev/dri and other devices; then
solutions with Docker "runtimes" (nvidia-docker v1
and v2); the current variant is the Nvidia Container
Toolkit. The latter is the only one I tested this with.
As for the BOINC Nvidia container, please:
1. Install Docker (19.03 or later);
2. Install the Nvidia drivers (so that "nvidia-smi" gives you output on the host);
3. Install the [Nvidia Container Toolkit ](https://github.com/NVIDIA/nvidia-docker ) (see "Usage" on the linked page to test nvidia-smi in a container).
Finally you can run this container:
2020-03-05 10:46:24 +00:00
```
2020-03-10 21:36:32 +00:00
docker run -d \
2020-03-05 10:46:24 +00:00
--name folding-at-home \
2020-03-10 21:36:32 +00:00
--gpus all \
-h node \
2020-03-05 10:46:24 +00:00
-e USER=Anonymous \
-e TEAM=0 \
2020-03-10 21:36:32 +00:00
-e ENABLE_GPU=true \
2020-03-05 10:46:24 +00:00
-e ENABLE_SMP=true \
--restart unless-stopped \
2020-03-10 21:36:32 +00:00
my-fah-nvidia-image \
--allow 0/0 --web-allow 0/0
2020-03-05 10:46:24 +00:00
```
2020-03-10 21:36:32 +00:00
``-h node`` sets an anonymous hostname instead of copying yours.
2020-03-05 10:46:24 +00:00
2020-03-10 21:36:32 +00:00
The last line means that Folding@home's web access will let everybody in,
but as the port is not exported, you can use it only from the Docker host,
pointing your browser at the container:
2020-03-05 10:46:24 +00:00
```
2020-03-10 21:36:32 +00:00
echo http://$(docker inspect --format "{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}" folding-at-home):7396
2020-03-05 10:46:24 +00:00
```
## Parameters
- USER - Folding@home username (default: Anonymous)
- TEAM - Foldinghome team number (default: 0)
- PASSKEY - [optional] Folding@home [passkey ](https://apps.foldingathome.org/getpasskey )
2020-03-10 21:36:32 +00:00
- ENABLE_GPU - Enable GPU compute (default: true)
2020-03-05 10:46:24 +00:00
- ENABLE_SMP - Enable auto-configuration of SMP slots (default: true)
2020-03-10 21:36:32 +00:00
- POWER - by default "full"; but you might want to switch to "medium" and see how hot your hardware gets (especially laptops). "light" did not use the GPU at all for me. You can always switch this in the web interface.
2020-03-05 10:46:24 +00:00
Additional configuration parameters can be passed as command line arguments. To get the full list of parameters run:
```
2020-03-10 21:36:32 +00:00
docker run my-fah-nvidia-image --help
2020-03-05 10:46:24 +00:00
```