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 Jul 8, 2022
1 parent 1b86968 commit f64afbb
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 0 deletions.
17 changes: 17 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,23 @@ 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 .
```

## Running with [NVIDIA Container Toolkit](https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/overview.html)
```shell
$ docker run -it --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
34 changes: 34 additions & 0 deletions docker/Dockerfile.cuda
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
FROM nvidia/cuda:11.7.0-devel-ubuntu20.04 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 nvidia/cuda:11.7.0-runtime-ubuntu20.04

# 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 .

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

0 comments on commit f64afbb

Please sign in to comment.