Skip to content

Commit 437ad90

Browse files
authored
Chore: docker quickstart getting started (#28)
1 parent fa27a45 commit 437ad90

File tree

2 files changed

+48
-0
lines changed

2 files changed

+48
-0
lines changed

Dockerfile

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
FROM nvidia/cuda:11.4.2-cudnn8-devel-ubuntu18.04
2+
3+
# Update default packages
4+
RUN apt-get update
5+
6+
# Get Ubuntu packages
7+
RUN apt-get install -y \
8+
build-essential \
9+
curl xz-utils pkg-config libssl-dev zlib1g-dev libtinfo-dev libxml2-dev
10+
11+
# Update new packages
12+
RUN apt-get update
13+
14+
# Get Rust
15+
RUN curl https://sh.rustup.rs -sSf | bash -s -- -y
16+
17+
18+
# get prebuilt llvm
19+
# COPY clang+llvm-7.0.1-x86_64-linux-gnu-ubuntu-18.04.tar.xz .
20+
RUN curl -O https://releases.llvm.org/7.0.1/clang+llvm-7.0.1-x86_64-linux-gnu-ubuntu-18.04.tar.xz &&\
21+
xz -d /clang+llvm-7.0.1-x86_64-linux-gnu-ubuntu-18.04.tar.xz &&\
22+
tar xf /clang+llvm-7.0.1-x86_64-linux-gnu-ubuntu-18.04.tar &&\
23+
rm /clang+llvm-7.0.1-x86_64-linux-gnu-ubuntu-18.04.tar &&\
24+
mv /clang+llvm-7.0.1-x86_64-linux-gnu-ubuntu-18.04 /root/llvm
25+
26+
# set env
27+
ENV LLVM_CONFIG="/root/llvm/bin/llvm-config"
28+
ENV CUDA_ROOT="/usr/local/cuda"
29+
ENV CUDA_PATH=$CUDA_ROOT
30+
ENV LLVM_LINK_STATIC=1
31+
ENV RUST_LOG=info
32+
ENV PATH="$CUDA_ROOT/nvvm/lib64:/root/.cargo/bin:$PATH"
33+
ENV LD_LIBRARY_PATH=$PATH

guide/src/guide/getting_started.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,3 +188,18 @@ static PTX: &str = include_str!("some/path.ptx");
188188
```
189189

190190
Then execute it using cust.
191+
192+
## Docker
193+
194+
There is also a [Dockerfile](Dockerfile) prepared as a quickstart with all the necessary libraries for base cuda development.
195+
196+
You can use it as follows (assuming your clone of Rust-CUDA is at the absolute path `RUST_CUDA`):
197+
198+
- Build `docker build -t rust-cuda $RUST_CUDA`
199+
- Run `docker run -it -v $RUST_CUDA:/root/rust-cuda --entrypoint /bin/b
200+
ash rust-cuda`
201+
202+
Running will drop you into the container
203+
s shell and you will find the project at `~/rust-cuda`
204+
205+
Note: refer to [rust-toolchain][#rust-toolchain] to ensure you are using the correct toolchain in your project.

0 commit comments

Comments
 (0)