Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a Dockerfile with CUDA support #37

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,31 @@ Privkey: 5JcX7HgrPxEbYKcWhtBT83L3BHcdJ8K8p8X1sNHmcJLsSyMNycZ
## How Split-key Works
See the explanation in another similar [project](https://github.com/JeanLucPons/VanitySearch#how-it-works).

# CUDA Docker Image

## Build Image
```shell
$ docker build -f docker/Dockerfile.cuda -t vanitygen-plusplus:latest .
```

The CUDA version from the base image must work with the driver available
through the `container-toolkit`, so YMMV with the `Dockerfile.cuda` default
versions of the images. so you can specify different versions with Docker's
`--build-arg` on:

- `BASE_CUDA_DEV_CONTAINER`
- `BASE_CUDA_RUN_CONTAINER`

## Running with [NVIDIA Container Toolkit](https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/overview.html)
```shell
$ docker run -it --network none --gpus all vanitygen-plusplus:latest 1Love
Difficulty: 4476342
Compiling kernel, can take minutes...done!
Pattern: 1Love
Address: 1LovebbyvEuCnJoKZBXDA6kqts6Q2KG1WJ
Privkey: 5K3J3aA8XkvfdjhJcZ8BJhTUKAjYATCey9AdgahRvoxGB9gLUoD
```

# Credit
Many thanks to following projects:
1. https://github.com/samr7/vanitygen
Expand Down
41 changes: 41 additions & 0 deletions docker/Dockerfile.cuda
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# The CUDA version matters to some degree, and must at least work with the
# driver used in the container host.
ARG BASE_CUDA_DEV_CONTAINER=nvidia/cuda:11.6.2-devel-ubuntu20.04
ARG BASE_CUDA_RUN_CONTAINER=nvidia/cuda:11.6.2-runtime-ubuntu20.04

FROM $BASE_CUDA_DEV_CONTAINER as build

# Bring in source
WORKDIR /vanitygen-plusplus
COPY . /vanitygen-plusplus

# Build Requirements
#
# NOTE(canardleteer): I didn't have any luck getting `make test` to work, so
# have omitted `check`.
ENV DEBIAN_FRONTEND=noninteractive
RUN apt update && \
apt install -y make gcc libssl-dev libpcre3-dev libcurl4-openssl-dev nvidia-opencl-dev && \
rm -rf /var/lib/apt/lists/*

# NOTE(canardleteer): `make install` target wanted.
RUN make all

# The runtime image is approximately half the size of the `build` image.
FROM $BASE_CUDA_RUN_CONTAINER

# NOTE(canardleteer): `libcurl4` is needed by oclvanityminer. I'd like to use
# something smaller than `nvidia-opencl-dev` if anyone has
# any suggestions.
RUN apt update && apt install -y libcurl4 nvidia-opencl-dev && rm -rf /var/lib/apt/lists/*

COPY --from=build /vanitygen-plusplus/oclvanitygen++ /usr/bin
COPY --from=build /vanitygen-plusplus/oclvanityminer /usr/bin
COPY --from=build /vanitygen-plusplus/vanitygen++ /usr/bin
COPY --from=build /vanitygen-plusplus/keyconv /usr/bin
COPY --from=build /vanitygen-plusplus/calc_addrs.cl .
COPY --from=build /vanitygen-plusplus/base58prefix.txt .

# The other binaries are available by setting `--entrypoint` upon a `docker run`.
ENTRYPOINT ["/usr/bin/oclvanitygen++"]