Skip to content

Commit 6c436c9

Browse files
authored
Pass -gpu= at link time for the Thrust extension (#17)
The device-link step is where the final SASS is generated, so an arch passed only at compile time is discarded and the extension silently gets nvc++'s own default target instead of what was requested. Measured on NVHPC 26.1 (aarch64), compile with -gpu=cc90: .so linked without -gpu= -> sm_100 (the host default, not cc90) .so linked with -gpu= -> sm_90 _core_gpu_omp_offload already passes -gpu= at link, which is why only the Thrust backend was affected.
1 parent 9283f40 commit 6c436c9

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

setup.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -397,7 +397,12 @@ def find_nvidia_hpc_sdk():
397397
# target missing), causing the link to fail with "cannot find
398398
# -lcublasmp" etc. SBD's GPU path only needs the CUDA runtime, so
399399
# explicitly link -lcudart instead.
400-
extra_link_args=extra_link_args + ['-mp', '-cuda', '-lcudart'],
400+
#
401+
# -gpu= is repeated at link because the device-link step generates the
402+
# final SASS: without it nvc++ silently targets its own default instead
403+
# of the requested arch(es).
404+
extra_link_args=extra_link_args + ['-mp', '-cuda', f'-gpu={gpu_arch}',
405+
'-lcudart'],
401406
)
402407
ext_modules.append(gpu_thrust_ext)
403408

0 commit comments

Comments
 (0)