Skip to content

Commit 8dde4c2

Browse files
author
Caspar van Leeuwen
committed
Don't assume that a CUDA CC only contains two numbers, we want to also support CC100, CC120, etc
1 parent 85ead5d commit 8dde4c2

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

EESSI-extend-easybuild.eb

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,9 +96,12 @@ sysroot = os.getenv("EESSI_EPREFIX")
9696
-- Check if we have GPU capabilities and configure CUDA compute capabilities
9797
eessi_accelerator_target = os.getenv("EESSI_ACCELERATOR_TARGET")
9898
if (eessi_accelerator_target ~= nil) then
99-
cuda_compute_capability = string.match(eessi_accelerator_target, "^accel/nvidia/cc([0-9][0-9])$")
99+
cuda_compute_capability = string.match(eessi_accelerator_target, "^accel/nvidia/cc([0-9]+)$")
100100
if (cuda_compute_capability ~= nil) then
101-
easybuild_cuda_compute_capabilities = cuda_compute_capability:sub(1, 1) .. "." .. cuda_compute_capability:sub(2, 2)
101+
-- The last digit should be the minor version, insert a dot in the one-but-last position
102+
major_version = cuda_compute_capability:sub(1, #cuda_compute_capability - 1)
103+
minor_version = cuda_compute_capability:sub(#cuda_compute_capability)
104+
easybuild_cuda_compute_capabilities = string.format("%s.%s", major_version, minor_version)
102105
else
103106
LmodError("Incorrect value for $EESSI_ACCELERATOR_TARGET: " .. eessi_accelerator_target)
104107
end

init/eessi_archdetect.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -165,11 +165,11 @@ accelpath() {
165165
# If EESSI_ACCELERATOR_TARGET_OVERRIDE is set, use it
166166
log "DEBUG" "accelpath: Override variable set as '$EESSI_ACCELERATOR_TARGET_OVERRIDE' "
167167
if [ ! -z $EESSI_ACCELERATOR_TARGET_OVERRIDE ]; then
168-
if [[ "$EESSI_ACCELERATOR_TARGET_OVERRIDE" =~ ^accel/nvidia/cc[0-9][0-9]$ ]]; then
168+
if [[ "$EESSI_ACCELERATOR_TARGET_OVERRIDE" =~ ^accel/nvidia/cc[0-9]+$ ]]; then
169169
echo ${EESSI_ACCELERATOR_TARGET_OVERRIDE}
170170
return 0
171171
else
172-
log "ERROR" "Value of \$EESSI_ACCELERATOR_TARGET_OVERRIDE should match 'accel/nvidia/cc[0-9[0-9]', but it does not: '$EESSI_ACCELERATOR_TARGET_OVERRIDE'"
172+
log "ERROR" "Value of \$EESSI_ACCELERATOR_TARGET_OVERRIDE should match 'accel/nvidia/cc[0-9]+', but it does not: '$EESSI_ACCELERATOR_TARGET_OVERRIDE'"
173173
fi
174174
return 0
175175
fi

0 commit comments

Comments
 (0)