cuda-samples icon indicating copy to clipboard operation
cuda-samples copied to clipboard

Update Makefiles for HPC SDK

Open pauleonix opened this issue 2 years ago • 0 comments

When using CUDA from the HPC SDK (NVHPC), compiling the examples using make doesn't only require setting CUDA_PATH (e.g. /opt/nvidia/hpc_sdk/Linux_x86_64/22.3/cuda), but also (at least for samples in 4_CUDA_Libraries) to set the library path (nvcc doesn't know it?) by e.g. adding

-L/opt/nvidia/hpc_sdk/Linux_x86_64/22.3/math_libs/11.6/lib64

to LDFLAGS. It would be helpful for beginners if the Makefiles would as a first step detect from the CUDA_PATH that one is using the HPC SDK and modify LDFLAGS on its own. As a second step one might want to at least try out a few default CUDA_PATHs instead of specifying just one (this causes problems also with users of the normal CUDA SDK, see e.g. #127). Even better would be code to generally construct the CUDA_PATH as long as e.g. nvcc is on the PATH.

If one already reworks these Makefiles, one might want to outsource all the repeated elements of the Makefiles into the Common folder (DRY principle).

pauleonix avatar Jun 16 '22 11:06 pauleonix