diff --git a/cmake/Modules/Packages/GPU.cmake b/cmake/Modules/Packages/GPU.cmake index 243b5111de..48f858f4c6 100644 --- a/cmake/Modules/Packages/GPU.cmake +++ b/cmake/Modules/Packages/GPU.cmake @@ -82,6 +82,7 @@ if(GPU_API STREQUAL "CUDA") # apply the following to build "fat" CUDA binaries only for known CUDA toolkits since version 8.0 # only the Kepler achitecture and beyond is supported + # comparison chart according to: https://en.wikipedia.org/wiki/CUDA#GPUs_supported if(CUDA_VERSION VERSION_LESS 8.0) message(FATAL_ERROR "CUDA Toolkit version 8.0 or later is required") elseif(CUDA_VERSION VERSION_GREATER_EQUAL "12.0") @@ -120,14 +121,14 @@ if(GPU_API STREQUAL "CUDA") if(CUDA_VERSION VERSION_GREATER_EQUAL "11.1") string(APPEND GPU_CUDA_GENCODE " -gencode arch=compute_86,code=[sm_86,compute_86]") endif() - # Hopper (GPU Arch 9.0) is supported by CUDA 12.0? and later + # Lovelace (GPU Arch 8.9) is supported by CUDA 11.8 and later + if(CUDA_VERSION VERSION_GREATER_EQUAL "11.8") + string(APPEND GPU_CUDA_GENCODE " -gencode arch=compute_90,code=[sm_90,compute_90]") + endif() + # Hopper (GPU Arch 9.0) is supported by CUDA 12.0 and later if(CUDA_VERSION VERSION_GREATER_EQUAL "12.0") string(APPEND GPU_CUDA_GENCODE " -gencode arch=compute_90,code=[sm_90,compute_90]") endif() - # # Lovelace (GPU Arch 9.x) is supported by CUDA 12.0? and later - #if(CUDA_VERSION VERSION_GREATER_EQUAL "12.0") - # string(APPEND GPU_CUDA_GENCODE " -gencode arch=compute_9x,code=[sm_9x,compute_9x]") - #endif() endif() cuda_compile_fatbin(GPU_GEN_OBJS ${GPU_LIB_CU} OPTIONS ${CUDA_REQUEST_PIC} @@ -276,6 +277,7 @@ elseif(GPU_API STREQUAL "HIP") else() # build arch/gencode commands for nvcc based on CUDA toolkit version and use choice # --arch translates directly instead of JIT, so this should be for the preferred or most common architecture + # comparison chart according to: https://en.wikipedia.org/wiki/CUDA#GPUs_supported set(HIP_CUDA_GENCODE "-arch=${HIP_ARCH}") # Kepler (GPU Arch 3.0) is supported by CUDA 5 to CUDA 10.2 if((CUDA_VERSION VERSION_GREATER_EQUAL "5.0") AND (CUDA_VERSION VERSION_LESS "11.0")) @@ -305,9 +307,17 @@ elseif(GPU_API STREQUAL "HIP") if(CUDA_VERSION VERSION_GREATER_EQUAL "11.0") string(APPEND HIP_CUDA_GENCODE " -gencode arch=compute_80,code=[sm_80,compute_80]") endif() - # Hopper (GPU Arch 9.0) is supported by CUDA 12.0? and later + # Ampere (GPU Arch 8.6) is supported by CUDA 11.1 and later + if(CUDA_VERSION VERSION_GREATER_EQUAL "11.1") + string(APPEND HIP_CUDA_GENCODE " -gencode arch=compute_86,code=[sm_86,compute_86]") + endif() + # Lovelace (GPU Arch 8.9) is supported by CUDA 11.8 and later + if(CUDA_VERSION VERSION_GREATER_EQUAL "11.8") + string(APPEND HIP_CUDA_GENCODE " -gencode arch=compute_90,code=[sm_90,compute_90]") + endif() + # Hopper (GPU Arch 9.0) is supported by CUDA 12.0 and later if(CUDA_VERSION VERSION_GREATER_EQUAL "12.0") - string(APPEND GPU_CUDA_GENCODE " -gencode arch=compute_90,code=[sm_90,compute_90]") + string(APPEND HIP_CUDA_GENCODE " -gencode arch=compute_90,code=[sm_90,compute_90]") endif() endif() endif() diff --git a/doc/src/Build_extras.rst b/doc/src/Build_extras.rst index 201bbc7235..71ac000e0b 100644 --- a/doc/src/Build_extras.rst +++ b/doc/src/Build_extras.rst @@ -151,7 +151,9 @@ CMake build * sm_60 or sm_61 for Pascal (supported since CUDA 8) * sm_70 for Volta (supported since CUDA 9) * sm_75 for Turing (supported since CUDA 10) -* sm_80 for Ampere (supported since CUDA 11) +* sm_80 or sm_86 for Ampere (supported since CUDA 11, sm_86 since CUDA 11.1) +* sm_89 for Lovelace (supported since CUDA 11.8) +* sm_90 for Hopper (supported since CUDA 12.0) A more detailed list can be found, for example, at `Wikipedia's CUDA article `_ diff --git a/lib/gpu/Makefile.linux b/lib/gpu/Makefile.linux index bed6848980..3c37672e01 100644 --- a/lib/gpu/Makefile.linux +++ b/lib/gpu/Makefile.linux @@ -45,6 +45,12 @@ CUDA_ARCH = -arch=sm_60 #CUDA_ARCH = -arch=sm_80 #CUDA_ARCH = -arch=sm_86 +# Lovelace hardware +#CUDA_ARCH = -arch=sm_89 + +# Hopper hardware +#CUDA_ARCH = -arch=sm_90 + # this setting should match LAMMPS Makefile # one of LAMMPS_SMALLBIG (default), LAMMPS_BIGBIG and LAMMPS_SMALLSMALL diff --git a/lib/gpu/Makefile.linux_multi b/lib/gpu/Makefile.linux_multi index fda640221f..3299bbec3a 100644 --- a/lib/gpu/Makefile.linux_multi +++ b/lib/gpu/Makefile.linux_multi @@ -37,13 +37,17 @@ CUDA_ARCH = -arch=sm_50 #CUDA_ARCH = -arch=sm_80 #CUDA_ARCH = -arch=sm_86 +# Lovelace hardware +#CUDA_ARCH = -arch=sm_89 + # Hopper hardware #CUDA_ARCH = -arch=sm_90 CUDA_CODE = -gencode arch=compute_50,code=[sm_50,compute_50] -gencode arch=compute_52,code=[sm_52,compute_52] \ -gencode arch=compute_60,code=[sm_60,compute_60] -gencode arch=compute_61,code=[sm_61,compute_61] \ -gencode arch=compute_70,code=[sm_70,compute_70] -gencode arch=compute_75,code=[sm_75,compute_75] \ - -gencode arch=compute_80,code=[sm_80,compute_80] -gencode arch=compute_86,code=[sm_86,compute_86] + -gencode arch=compute_80,code=[sm_80,compute_80] -gencode arch=compute_86,code=[sm_86,compute_86] \ + # -gencode arch=compute_89,code=[sm_89,compute_89] -gencode arch=compute_90,code=[sm_90,compute_90] CUDA_ARCH += $(CUDA_CODE)