Skip to content

Commit c85da84

Browse files
authored
enable nightly CUDA 12.1 builds (#1374)
* enable nightly CUDA 12.1 builds * fix version typo
1 parent 7740097 commit c85da84

File tree

3 files changed

+91
-8
lines changed

3 files changed

+91
-8
lines changed

conda/build_pytorch.sh

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,10 @@ else
265265
. ./switch_cuda_version.sh "$desired_cuda"
266266
# TODO, simplify after anaconda fixes their cudatoolkit versioning inconsistency.
267267
# see: https://github.com/conda-forge/conda-forge.github.io/issues/687#issuecomment-460086164
268-
if [[ "$desired_cuda" == "11.8" ]]; then
268+
if [[ "desired_cuda" == "12.1" ]]; then
269+
export CONDA_CUDATOOLKIT_CONSTRAINT=" - pytorch-cuda >=12.1,<12.2 # [not osx]"
270+
export MAGMA_PACKAGE=" - magma-cuda121 # [not osx and not win]"
271+
elif [[ "$desired_cuda" == "11.8" ]]; then
269272
export CONDA_CUDATOOLKIT_CONSTRAINT=" - pytorch-cuda >=11.8,<11.9 # [not osx]"
270273
export MAGMA_PACKAGE=" - magma-cuda118 # [not osx and not win]"
271274
elif [[ "$desired_cuda" == "11.7" ]]; then

conda/pytorch-nightly/build.sh

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,23 +52,29 @@ if [[ -z "$USE_CUDA" || "$USE_CUDA" == 1 ]]; then
5252
fi
5353
if [[ -n "$build_with_cuda" ]]; then
5454
export TORCH_NVCC_FLAGS="-Xfatbin -compress-all"
55-
TORCH_CUDA_ARCH_LIST="3.7+PTX;5.0"
55+
TORCH_CUDA_ARCH_LIST="5.0;6.0;6.1;7.0;7.5;8.0;8.6"
5656
export USE_STATIC_CUDNN=1 # links cudnn statically (driven by tools/setup_helpers/cudnn.py)
5757

5858
if [[ $CUDA_VERSION == 11.7* ]]; then
59-
TORCH_CUDA_ARCH_LIST="$TORCH_CUDA_ARCH_LIST;6.0;6.1;7.0;7.5;8.0;8.6"
59+
TORCH_CUDA_ARCH_LIST="$TORCH_CUDA_ARCH_LIST;3.7+PTX"
6060
#for cuda 11.7 we use cudnn 8.5
6161
#which does not have single static libcudnn_static.a deliverable to link with
6262
export USE_STATIC_CUDNN=0
6363
#for cuda 11.7 include all dynamic loading libraries
6464
DEPS_LIST=(/usr/local/cuda/lib64/libcudnn*.so.8 /usr/local/cuda-11.7/extras/CUPTI/lib64/libcupti.so.11.7)
6565
elif [[ $CUDA_VERSION == 11.8* ]]; then
66-
TORCH_CUDA_ARCH_LIST="$TORCH_CUDA_ARCH_LIST;6.0;6.1;7.0;7.5;8.0;8.6;9.0"
66+
TORCH_CUDA_ARCH_LIST="$TORCH_CUDA_ARCH_LIST;3.7+PTX;9.0"
6767
#for cuda 11.8 we use cudnn 8.7
6868
#which does not have single static libcudnn_static.a deliverable to link with
6969
export USE_STATIC_CUDNN=0
7070
#for cuda 11.8 include all dynamic loading libraries
7171
DEPS_LIST=(/usr/local/cuda/lib64/libcudnn*.so.8 /usr/local/cuda-11.8/extras/CUPTI/lib64/libcupti.so.11.8)
72+
elif [[ $CUDA_VERSION == 12.1* ]]; then
73+
# cuda 12 does not support sm_3x
74+
TORCH_CUDA_ARCH_LIST="$TORCH_CUDA_ARCH_LIST;9.0"
75+
# for cuda 12.1 we use cudnn 8.8 and include all dynamic loading libraries
76+
export USE_STATIC_CUDNN=0
77+
DEPS_LIST=(/usr/local/cuda/lib64/libcudnn*.so.8 /usr/local/cuda-12.1/extras/CUPTI/lib64/libcupti.so.12
7278
fi
7379
if [[ -n "$OVERRIDE_TORCH_CUDA_ARCH_LIST" ]]; then
7480
TORCH_CUDA_ARCH_LIST="$OVERRIDE_TORCH_CUDA_ARCH_LIST"

manywheel/build_cuda.sh

Lines changed: 78 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,14 +56,18 @@ fi
5656

5757
cuda_version_nodot=$(echo $CUDA_VERSION | tr -d '.')
5858

59-
TORCH_CUDA_ARCH_LIST="3.7;5.0;6.0;7.0"
59+
TORCH_CUDA_ARCH_LIST="5.0;6.0;7.0;7.5;8.0;8.6"
6060
case ${CUDA_VERSION} in
61+
12.1)
62+
TORCH_CUDA_ARCH_LIST="${TORCH_CUDA_ARCH_LIST};9.0"
63+
EXTRA_CAFFE2_CMAKE_FLAGS+=("-DATEN_NO_TEST=ON")
64+
;;
6165
11.8)
62-
TORCH_CUDA_ARCH_LIST="${TORCH_CUDA_ARCH_LIST};7.5;8.0;8.6;9.0"
66+
TORCH_CUDA_ARCH_LIST="${TORCH_CUDA_ARCH_LIST};3.7;9.0"
6367
EXTRA_CAFFE2_CMAKE_FLAGS+=("-DATEN_NO_TEST=ON")
6468
;;
6569
11.[67])
66-
TORCH_CUDA_ARCH_LIST="${TORCH_CUDA_ARCH_LIST};7.5;8.0;8.6"
70+
TORCH_CUDA_ARCH_LIST="${TORCH_CUDA_ARCH_LIST};3.7"
6771
EXTRA_CAFFE2_CMAKE_FLAGS+=("-DATEN_NO_TEST=ON")
6872
;;
6973
*)
@@ -108,7 +112,77 @@ elif [[ "$OS_NAME" == *"Ubuntu"* ]]; then
108112
LIBGOMP_PATH="/usr/lib/x86_64-linux-gnu/libgomp.so.1"
109113
fi
110114

111-
if [[ $CUDA_VERSION == "11.7" || $CUDA_VERSION == "11.8" ]]; then
115+
if [[ $CUDA_VERSION == "12.1" ]]; then
116+
export USE_STATIC_CUDNN=0
117+
# Try parallelizing nvcc as well
118+
export TORCH_NVCC_FLAGS="-Xfatbin -compress-all --threads 2"
119+
DEPS_LIST=(
120+
"$LIBGOMP_PATH"
121+
)
122+
DEPS_SONAME=(
123+
"libgomp.so.1"
124+
)
125+
126+
if [[ -z "$PYTORCH_EXTRA_INSTALL_REQUIREMENTS" ]]; then
127+
echo "Bundling with cudnn and cublas."
128+
DEPS_LIST+=(
129+
"/usr/local/cuda/lib64/libcudnn_adv_infer.so.8"
130+
"/usr/local/cuda/lib64/libcudnn_adv_train.so.8"
131+
"/usr/local/cuda/lib64/libcudnn_cnn_infer.so.8"
132+
"/usr/local/cuda/lib64/libcudnn_cnn_train.so.8"
133+
"/usr/local/cuda/lib64/libcudnn_ops_infer.so.8"
134+
"/usr/local/cuda/lib64/libcudnn_ops_train.so.8"
135+
"/usr/local/cuda/lib64/libcudnn.so.8"
136+
"/usr/local/cuda/lib64/libcublas.so.12"
137+
"/usr/local/cuda/lib64/libcublasLt.so.12"
138+
"/usr/local/cuda/lib64/libcudart.so.12"
139+
"/usr/local/cuda/lib64/libnvToolsExt.so.1"
140+
"/usr/local/cuda/lib64/libnvrtc.so.12"
141+
"/usr/local/cuda/lib64/libnvrtc-builtins.so.12.1"
142+
)
143+
DEPS_SONAME+=(
144+
"libcudnn_adv_infer.so.8"
145+
"libcudnn_adv_train.so.8"
146+
"libcudnn_cnn_infer.so.8"
147+
"libcudnn_cnn_train.so.8"
148+
"libcudnn_ops_infer.so.8"
149+
"libcudnn_ops_train.so.8"
150+
"libcudnn.so.8"
151+
"libcublas.so.12"
152+
"libcublasLt.so.12"
153+
"libcudart.so.12"
154+
"libnvToolsExt.so.1"
155+
"libnvrtc.so.12"
156+
"libnvrtc-builtins.so.12.1"
157+
)
158+
else
159+
echo "Using nvidia libs from pypi."
160+
CUDA_RPATHS=(
161+
'$ORIGIN/../../nvidia/cublas/lib'
162+
'$ORIGIN/../../nvidia/cuda_cupti/lib'
163+
'$ORIGIN/../../nvidia/cuda_nvrtc/lib'
164+
'$ORIGIN/../../nvidia/cuda_runtime/lib'
165+
'$ORIGIN/../../nvidia/cudnn/lib'
166+
'$ORIGIN/../../nvidia/cufft/lib'
167+
'$ORIGIN/../../nvidia/curand/lib'
168+
'$ORIGIN/../../nvidia/cusolver/lib'
169+
'$ORIGIN/../../nvidia/cusparse/lib'
170+
'$ORIGIN/../../nvidia/nccl/lib'
171+
'$ORIGIN/../../nvidia/nvtx/lib'
172+
)
173+
CUDA_RPATHS=$(IFS=: ; echo "${CUDA_RPATHS[*]}")
174+
export C_SO_RPATH=$CUDA_RPATHS':$ORIGIN:$ORIGIN/lib'
175+
export LIB_SO_RPATH=$CUDA_RPATHS':$ORIGIN'
176+
export FORCE_RPATH="--force-rpath"
177+
export USE_STATIC_NCCL=0
178+
export USE_SYSTEM_NCCL=1
179+
export ATEN_STATIC_CUDA=0
180+
export USE_CUDA_STATIC_LINK=0
181+
export USE_CUPTI_SO=1
182+
export NCCL_INCLUDE_DIR="/usr/local/cuda/include/"
183+
export NCCL_LIB_DIR="/usr/local/cuda/lib64/"
184+
fi
185+
elif [[ $CUDA_VERSION == "11.7" || $CUDA_VERSION == "11.8" ]]; then
112186
export USE_STATIC_CUDNN=0
113187
# Try parallelizing nvcc as well
114188
export TORCH_NVCC_FLAGS="-Xfatbin -compress-all --threads 2"

0 commit comments

Comments
 (0)