Skip to content

Commit

Permalink
Add a Dockerfile with CUDA support.
Browse files Browse the repository at this point in the history
- Multistage build, runtime still larger than it could be.
  • Loading branch information
canardleteer committed Dec 19, 2022
1 parent c072eb5 commit 48cac79
Show file tree
Hide file tree
Showing 2 changed files with 66 additions and 0 deletions.
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++"]

0 comments on commit 48cac79

Please sign in to comment.