Skip to content

Commit 251d019

Browse files
docker support
1 parent 290aa57 commit 251d019

File tree

3 files changed

+56
-0
lines changed

3 files changed

+56
-0
lines changed

.dockerignore

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
**/*DS_Store
2+
**/*coverage
3+
**/*idea
4+
**/*mypy_cache
5+
**/*pytest_cache
6+
**/*develop

docker/Dockerfile

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
FROM nvidia/cuda:11.0.3-cudnn8-runtime-ubuntu18.04
2+
3+
RUN apt update && DEBIAN_FRONTEND=noninteractive apt install -y \
4+
wget \
5+
cuda-command-line-tools-11-0 \
6+
git
7+
8+
RUN wget -q -P /tmp \
9+
https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh \
10+
&& bash /tmp/Miniconda3-latest-Linux-x86_64.sh -b -p /opt/conda \
11+
&& rm /tmp/Miniconda3-latest-Linux-x86_64.sh
12+
13+
ENV PATH="/opt/conda/bin:$PATH"
14+
RUN conda install -y \
15+
cudatoolkit=11.0 \
16+
pip \
17+
python=3.8
18+
19+
COPY . /app
20+
21+
RUN pip install -r /app/requirements-docker.txt
22+
23+
RUN pip install jaxlib==0.1.75+cuda11.cudnn805 -f https://storage.googleapis.com/jax-releases/jax_releases.html
24+
25+
RUN pip install -U git+https://github.com/jcmgray/cotengra.git
26+
27+
RUN ln -s /usr/local/cuda-11.0/targets/x86_64-linux/lib/libcusolver.so.10 /usr/local/cuda-11.0/targets/x86_64-linux/lib/libcusolver.so.11
28+
29+
RUN export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/cuda-11.0/targets/x86_64-linux/lib
30+
31+
WORKDIR /app
32+
33+
CMD ["/bin/bash"]

docker/README.md

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
Run the following command to build the docker for tensorcircuit at parent path:
2+
3+
```bash
4+
sudo docker build . -f docker/Dockerfile -t tc-dev-jupyter
5+
```
6+
7+
Run the docker container by the following command:
8+
9+
```bash
10+
sudo docker run -it --network host --gpus all tc-dev-jupyter
11+
```
12+
13+
To utilize tensorflow + cuda, we need to further run the following command within runtime docker:
14+
15+
```bash
16+
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/cuda-11.0/targets/x86_64-linux/lib
17+
```

0 commit comments

Comments
 (0)