Skip to content

Commit e60460a

Browse files
authored
Merge pull request #128 from casparvl/support_cc_100_and_above
Don't assume that a CUDA CC only contains two numbers, we want to also support CC100, CC120, etc
2 parents ac72cd3 + aae5169 commit e60460a

File tree

2 files changed

+16
-4
lines changed

2 files changed

+16
-4
lines changed

EESSI-extend-easybuild.eb

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,12 +96,24 @@ 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
108+
109+
-- If architectures are 9.0, 10.0 or 12.0, enable architecture or family-specific optimizations
110+
if easybuild_cuda_compute_capabilities == '9.0' then
111+
easybuild_cuda_compute_capabilities = '9.0a'
112+
elseif easybuild_cuda_compute_capabilities == '10.0' then
113+
easybuild_cuda_compute_capabilities = '10.0f'
114+
elseif easybuild_cuda_compute_capabilities == '12.0' then
115+
easybuild_cuda_compute_capabilities = '12.0f'
116+
end
105117
end
106118
107119
-- Some environment variables affect behaviour, let's gather them once

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)