Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 48cac79

Browse files
committedDec 19, 2022
Add a Dockerfile with CUDA support.
- Multistage build, runtime still larger than it could be.
1 parent c072eb5 commit 48cac79

File tree

2 files changed

+66
-0
lines changed

2 files changed

+66
-0
lines changed
 

‎README.md

+25
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,31 @@ Privkey: 5JcX7HgrPxEbYKcWhtBT83L3BHcdJ8K8p8X1sNHmcJLsSyMNycZ
143143
## How Split-key Works
144144
See the explanation in another similar [project](https://github.com/JeanLucPons/VanitySearch#how-it-works).
145145

146+
# CUDA Docker Image
147+
148+
## Build Image
149+
```shell
150+
$ docker build -f docker/Dockerfile.cuda -t vanitygen-plusplus:latest .
151+
```
152+
153+
The CUDA version from the base image must work with the driver available
154+
through the `container-toolkit`, so YMMV with the `Dockerfile.cuda` default
155+
versions of the images. so you can specify different versions with Docker's
156+
`--build-arg` on:
157+
158+
- `BASE_CUDA_DEV_CONTAINER`
159+
- `BASE_CUDA_RUN_CONTAINER`
160+
161+
## Running with [NVIDIA Container Toolkit](https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/overview.html)
162+
```shell
163+
$ docker run -it --network none --gpus all vanitygen-plusplus:latest 1Love
164+
Difficulty: 4476342
165+
Compiling kernel, can take minutes...done!
166+
Pattern: 1Love
167+
Address: 1LovebbyvEuCnJoKZBXDA6kqts6Q2KG1WJ
168+
Privkey: 5K3J3aA8XkvfdjhJcZ8BJhTUKAjYATCey9AdgahRvoxGB9gLUoD
169+
```
170+
146171
# Credit
147172
Many thanks to following projects:
148173
1. https://github.com/samr7/vanitygen

‎docker/Dockerfile.cuda

+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# The CUDA version matters to some degree, and must at least work with the
2+
# driver used in the container host.
3+
ARG BASE_CUDA_DEV_CONTAINER=nvidia/cuda:11.6.2-devel-ubuntu20.04
4+
ARG BASE_CUDA_RUN_CONTAINER=nvidia/cuda:11.6.2-runtime-ubuntu20.04
5+
6+
FROM $BASE_CUDA_DEV_CONTAINER as build
7+
8+
# Bring in source
9+
WORKDIR /vanitygen-plusplus
10+
COPY . /vanitygen-plusplus
11+
12+
# Build Requirements
13+
#
14+
# NOTE(canardleteer): I didn't have any luck getting `make test` to work, so
15+
# have omitted `check`.
16+
ENV DEBIAN_FRONTEND=noninteractive
17+
RUN apt update && \
18+
apt install -y make gcc libssl-dev libpcre3-dev libcurl4-openssl-dev nvidia-opencl-dev && \
19+
rm -rf /var/lib/apt/lists/*
20+
21+
# NOTE(canardleteer): `make install` target wanted.
22+
RUN make all
23+
24+
# The runtime image is approximately half the size of the `build` image.
25+
FROM $BASE_CUDA_RUN_CONTAINER
26+
27+
# NOTE(canardleteer): `libcurl4` is needed by oclvanityminer. I'd like to use
28+
# something smaller than `nvidia-opencl-dev` if anyone has
29+
# any suggestions.
30+
RUN apt update && apt install -y libcurl4 nvidia-opencl-dev && rm -rf /var/lib/apt/lists/*
31+
32+
COPY --from=build /vanitygen-plusplus/oclvanitygen++ /usr/bin
33+
COPY --from=build /vanitygen-plusplus/oclvanityminer /usr/bin
34+
COPY --from=build /vanitygen-plusplus/vanitygen++ /usr/bin
35+
COPY --from=build /vanitygen-plusplus/keyconv /usr/bin
36+
COPY --from=build /vanitygen-plusplus/calc_addrs.cl .
37+
COPY --from=build /vanitygen-plusplus/base58prefix.txt .
38+
39+
# The other binaries are available by setting `--entrypoint` upon a `docker run`.
40+
ENTRYPOINT ["/usr/bin/oclvanitygen++"]
41+

0 commit comments

Comments
 (0)
Please sign in to comment.