Skip to content

Commit 8d8dbb5

Browse files
authored
Add 12.1 workflow for docker image build (#1367)
* add 12.1 workflow for docker image build * add github workflow * update cuDNN to 8.8.1 and location for archive
1 parent 669cbd4 commit 8d8dbb5

File tree

4 files changed

+71
-2
lines changed

4 files changed

+71
-2
lines changed

.github/workflows/build-conda-images.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ jobs:
2626
runs-on: ubuntu-22.04
2727
strategy:
2828
matrix:
29-
cuda_version: ["11.6", "11.7", "11.8", "cpu"]
29+
cuda_version: ["11.7", "11.8", "12.1", "cpu"]
3030
env:
3131
CUDA_VERSION: ${{ matrix.cuda_version }}
3232
steps:

common/install_cuda.sh

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,37 @@ function install_118 {
8585
ldconfig
8686
}
8787

88+
function install_121 {
89+
echo "Installing CUDA 12.1 and cuDNN 8.8 and NCCL 2.17.1"
90+
rm -rf /usr/local/cuda-12.1 /usr/local/cuda
91+
# install CUDA 12.1.0 in the same container
92+
wget -q https://developer.download.nvidia.com/compute/cuda/12.1.0/local_installers/cuda_12.1.0_530.30.02_linux.run
93+
chmod +x cuda_12.1.0_530.30.02_linux.run
94+
./cuda_12.1.0_530.30.02_linux.run --toolkit --silent
95+
rm -f cuda_12.1.0_530.30.02_linux.run
96+
rm -f /usr/local/cuda && ln -s /usr/local/cuda-12.1 /usr/local/cuda
97+
98+
# cuDNN license: https://developer.nvidia.com/cudnn/license_agreement
99+
mkdir tmp_cudnn && cd tmp_cudnn
100+
wget -q https://developer.download.nvidia.com/compute/cudnn/redist/cudnn/linux-x86_64/cudnn-linux-x86_64-8.8.1.3_cuda12-archive.tar.xz -O cudnn-linux-x86_64-8.8.1.3_cuda12-archive.tar.xz
101+
tar xf cudnn-linux-x86_64-8.8.1.3_cuda12-archive.tar.xz
102+
cp -a cudnn-linux-x86_64-8.8.1.3_cuda12-archive/include/* /usr/local/cuda/include/
103+
cp -a cudnn-linux-x86_64-8.8.1.3_cuda12-archive/lib/* /usr/local/cuda/lib64/
104+
cd ..
105+
rm -rf tmp_cudnn
106+
ldconfig
107+
108+
# NCCL license: https://docs.nvidia.com/deeplearning/nccl/#licenses
109+
mkdir tmp_nccl && cd tmp_nccl
110+
wget -q https://developer.download.nvidia.com/compute/redist/nccl/v2.17.1/nccl_2.17.1-1+cuda12.1_x86_64.txz
111+
tar xf nccl_2.17.1-1+cuda12.1_x86_64.txz
112+
cp -a nccl_2.17.1-1+cuda12.1_x86_64/include/* /usr/local/cuda/include/
113+
cp -a nccl_2.17.1-1+cuda12.1_x86_64/lib/* /usr/local/cuda/lib64/
114+
cd ..
115+
rm -rf tmp_nccl
116+
ldconfig
117+
}
118+
88119
function prune_116 {
89120
echo "Pruning CUDA 11.6 and CuDNN"
90121
#####################################################################################
@@ -178,6 +209,37 @@ function prune_118 {
178209
rm -rf $CUDA_BASE/libnvvp $CUDA_BASE/nsightee_plugins $CUDA_BASE/nsight-compute-2022.3.0 $CUDA_BASE/nsight-systems-2022.4.2/
179210
}
180211

212+
function prune_121 {
213+
echo "Pruning CUDA 12.1"
214+
#####################################################################################
215+
# CUDA 12.1 prune static libs
216+
#####################################################################################
217+
export NVPRUNE="/usr/local/cuda-12.1/bin/nvprune"
218+
export CUDA_LIB_DIR="/usr/local/cuda-12.1/lib64"
219+
220+
export GENCODE="-gencode arch=compute_50,code=sm_50 -gencode arch=compute_60,code=sm_60 -gencode arch=compute_70,code=sm_70 -gencode arch=compute_75,code=sm_75 -gencode arch=compute_80,code=sm_80 -gencode arch=compute_86,code=sm_86 -gencode arch=compute_90,code=sm_90"
221+
export GENCODE_CUDNN="-gencode arch=compute_50,code=sm_50 -gencode arch=compute_60,code=sm_60 -gencode arch=compute_61,code=sm_61 -gencode arch=compute_70,code=sm_70 -gencode arch=compute_75,code=sm_75 -gencode arch=compute_80,code=sm_80 -gencode arch=compute_86,code=sm_86 -gencode arch=compute_90,code=sm_90"
222+
223+
if [[ -n "$OVERRIDE_GENCODE" ]]; then
224+
export GENCODE=$OVERRIDE_GENCODE
225+
fi
226+
227+
# all CUDA libs except CuDNN and CuBLAS
228+
ls $CUDA_LIB_DIR/ | grep "\.a" | grep -v "culibos" | grep -v "cudart" | grep -v "cudnn" | grep -v "cublas" | grep -v "metis" \
229+
| xargs -I {} bash -c \
230+
"echo {} && $NVPRUNE $GENCODE $CUDA_LIB_DIR/{} -o $CUDA_LIB_DIR/{}"
231+
232+
# prune CuDNN and CuBLAS
233+
$NVPRUNE $GENCODE_CUDNN $CUDA_LIB_DIR/libcublas_static.a -o $CUDA_LIB_DIR/libcublas_static.a
234+
$NVPRUNE $GENCODE_CUDNN $CUDA_LIB_DIR/libcublasLt_static.a -o $CUDA_LIB_DIR/libcublasLt_static.a
235+
236+
#####################################################################################
237+
# CUDA 12.1 prune visual tools
238+
#####################################################################################
239+
export CUDA_BASE="/usr/local/cuda-12.1/"
240+
rm -rf $CUDA_BASE/libnvvp $CUDA_BASE/nsightee_plugins $CUDA_BASE/nsight-compute-2023.1.0 $CUDA_BASE/nsight-systems-2023.1.2/
241+
}
242+
181243
# idiomatic parameter and option handling in sh
182244
while test $# -gt 0
183245
do
@@ -188,6 +250,8 @@ do
188250
;;
189251
11.8) install_118; prune_118
190252
;;
253+
12.1) install_121; prune_121
254+
;;
191255
*) echo "bad argument $1"; exit 1
192256
;;
193257
esac

conda/Dockerfile

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,10 @@ FROM cuda as cuda11.8
6060
RUN bash ./install_cuda.sh 11.8
6161
ENV DESIRED_CUDA=11.8
6262

63+
FROM cuda as cuda12.1
64+
RUN bash ./install_cuda.sh 12.1
65+
ENV DESIRE_CUDA=12.1
66+
6367
# Install MNIST test data
6468
FROM base as mnist
6569
ADD ./common/install_mnist.sh install_mnist.sh
@@ -69,6 +73,7 @@ FROM base as all_cuda
6973
COPY --from=cuda11.6 /usr/local/cuda-11.6 /usr/local/cuda-11.6
7074
COPY --from=cuda11.7 /usr/local/cuda-11.7 /usr/local/cuda-11.7
7175
COPY --from=cuda11.8 /usr/local/cuda-11.8 /usr/local/cuda-11.8
76+
COPY --from=cuda12.1 /usr/local/cuda-12.1 /usr/local/cuda-12.1
7277

7378
FROM ${BASE_TARGET} as final
7479
# Install LLVM

conda/build_all_docker.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@ set -eou pipefail
44

55
TOPDIR=$(git rev-parse --show-toplevel)
66

7-
for CUDA_VERSION in 11.8 11.7 11.6 cpu; do
7+
for CUDA_VERSION in 12.1 11.8 11.7 cpu; do
88
CUDA_VERSION="${CUDA_VERSION}" conda/build_docker.sh
99
done

0 commit comments

Comments
 (0)