Skip to content

Commit af8e18d

Browse files
authored
manywheel: Don't attempt to transform DESIRED_CUDA (#625)
If DESIRED_CUDA is already in the format that we want then don't try to transform it Signed-off-by: Eli Uriegas <[email protected]>
1 parent 6a44376 commit af8e18d

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

manywheel/build.sh

+10-5
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,16 @@ fi
2929
# because in some cases a single Docker image can have multiple CUDA versions
3030
# on it, and `nvcc --version` might not show the CUDA version we want.
3131
if [[ -n "$DESIRED_CUDA" ]]; then
32-
# cu90, cu92, cu100, cu101
33-
if [[ ${#DESIRED_CUDA} -eq 4 ]]; then
34-
CUDA_VERSION="${DESIRED_CUDA:2:1}.${DESIRED_CUDA:3:1}"
35-
elif [[ ${#DESIRED_CUDA} -eq 5 ]]; then
36-
CUDA_VERSION="${DESIRED_CUDA:2:2}.${DESIRED_CUDA:4:1}"
32+
# If the DESIRED_CUDA already matches the format that we expect
33+
if [[ ${DESIRED_CUDA} =~ ^[0-9]+\.[0-9]+$ ]]; then
34+
CUDA_VERSION=${DESIRED_CUDA}
35+
else
36+
# cu90, cu92, cu100, cu101
37+
if [[ ${#DESIRED_CUDA} -eq 4 ]]; then
38+
CUDA_VERSION="${DESIRED_CUDA:2:1}.${DESIRED_CUDA:3:1}"
39+
elif [[ ${#DESIRED_CUDA} -eq 5 ]]; then
40+
CUDA_VERSION="${DESIRED_CUDA:2:2}.${DESIRED_CUDA:4:1}"
41+
fi
3742
fi
3843
echo "Using CUDA $CUDA_VERSION as determined by DESIRED_CUDA"
3944

0 commit comments

Comments
 (0)