Last active
March 25, 2021 00:09
-
-
Save ryantanaka/9d479de06dd593cd46e540e9a4bf0597 to your computer and use it in GitHub Desktop.
Ubuntu18.04, Cuda10.1, Cudnn7.0, Tensorflow2.3 singularity example on donut cluster. When building your own Docker image, you can inherit from `ryantanaka/cuda10.1:latest`
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Ubuntu 18.04 | |
from nvidia/cuda:10.1-base | |
# set locale | |
ENV LANG C.UTF-8 | |
# install linux packages | |
RUN apt update && apt install -y \ | |
software-properties-common \ | |
wget \ | |
curl \ | |
sudo \ | |
vim3 | |
# install python, pip, and tf2.3 | |
RUN add-apt-repository -y ppa:deadsnakes/ppa | |
RUN apt update && apt install -y python3.7 python3-pip | |
RUN pip3 install -U pip. | |
RUN pip3 install tensorflow==2.3.0 | |
# install additional cuda packages | |
WORKDIR /tmp | |
# must have cudnn7 package locally | |
ADD ./libcudnn7_7.6.5.32-1+cuda10.1_amd64.deb /tmp | |
RUN dpkg -i libcudnn7_7.6.5.32-1+cuda10.1_amd64.deb | |
RUN wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/libcublas10_10.1.0.105-1_amd64.deb | |
RUN dpkg -i libcublas10_10.1.0.105-1_amd64.deb | |
RUN wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/cuda-cufft-10-1_10.1.105-1_amd64.deb | |
RUN dpkg -i cuda-cufft-10-1_10.1.105-1_amd64.deb | |
RUN wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/cuda-curand-10-1_10.1.243-1_amd64.deb | |
RUN dpkg -i cuda-curand-10-1_10.1.243-1_amd64.deb | |
RUN wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/cuda-cusolver-10-1_10.1.243-1_amd64.deb | |
RUN dpkg -i cuda-cusolver-10-1_10.1.243-1_amd64.deb | |
RUN wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/cuda-cusparse-10-1_10.1.243-1_amd64.deb | |
RUN dpkg -i cuda-cusparse-10-1_10.1.243-1_amd64.deb | |
# test script | |
RUN echo '#!/usr/bin/env python3\n\ | |
import sys\n\ | |
try:\n\ | |
import tensorflow as tf\n\ | |
except ModuleNotFoundError:\n\ | |
print("test requires tensorflow 2.3")\n\ | |
sys.exit(1)\n\ | |
\n\ | |
tf.debugging.set_log_device_placement(True)\n\ | |
# Create some tensors\n\ | |
a = tf.constant([[1.0, 2.0, 3.0], [4.0, 5.0, 6.0]])\n\ | |
b = tf.constant([[1.0, 2.0], [3.0, 4.0], [5.0, 6.0]])\n\ | |
c = tf.matmul(a, b)\n\ | |
\n\ | |
print(c)\n'\ | |
>> /usr/bin/matmul.py | |
# test | |
RUN echo "Testing /usr/bin/matmul.py" | |
RUN python3 /usr/bin/matmul.py |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
#SBATCH --partition=donut-default | |
#SBATCH --nodes=1 | |
#SBATCH --cpus-per-task=4 | |
#SBATCH --gpus=1 | |
#SBATCH --mem=4096 | |
singularity exec --nv docker://ryantanaka/cuda10.1 python3 /usr/bin/matmul.py |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment