@@ -237,7 +237,7 @@ set (HOST ${hostValue} CACHE BOOL "Build Executables for GPU Platform (OFF) or C
237237
238238
239239#[[
240- !!/ **-DGPU_LANG (gpu_lang) = OPENACC** (experimental, in progress)
240+ !!/ **-DGPU_LANG (gpu_lang) = OPENACC**
241241!!/
242242!!/ If set to *CUDA*, the GPU code will only use the cuda source files.
243243!!/ And the program will crash at runtime if it falls into an OpenACC code path.
@@ -255,14 +255,17 @@ set (GPU_LANG ${gpuLangValue} CACHE STRING
255255
256256
257257#[[
258- !!/ **-DCOMPUTE_CAPABILITY (compute_capability) = 60,70 **
258+ !!/ **-DCOMPUTE_CAPABILITY (compute_capability) = AUTO **
259259!!/
260260!!/ GPU code only.
261261!!/
262262!!/ CUDA compute capability (multiplied by 10) of GPU.
263- !!/ Valid values (noninclusive) are 35, 50, 60, 70, 75 etc., and can be
263+ !!/ Valid values (noninclusive) are 35, 50, 60, 70, 75, etc., and can be
264264!!/ comma-separated, e.g. 35,60.
265265!!/ Multiple compute capabilites will increase the size of executables.
266+ !!/ If left unspecified, the script will attempt to detect the GPU,
267+ !!/ although the detection may fail due to different reasons, which would
268+ !!/ then require this option to be specified explicitly.
266269!!/
267270!!/ If new cards are released but the newer compute capabilities
268271!!/ are not supported, please inform us.
@@ -274,11 +277,20 @@ set (GPU_LANG ${gpuLangValue} CACHE STRING
274277if (DEFINED ENV{compute_capability})
275278 set (compCapValue $ENV{compute_capability} )
276279else ()
277- set (compCapValue 60,70 )
280+ set (compCapValue AUTO )
278281endif ()
279282set (COMPUTE_CAPABILITY ${compCapValue} CACHE STRING
280283 "[GPU ONLY] CUDA Compute Capability Multiplied by 10 (Comma-Separated)"
281284)
285+ if ("${COMPUTE_CAPABILITY} " STREQUAL AUTO)
286+ find_package (Python3 COMPONENTS Interpreter)
287+ if (Python3_FOUND)
288+ execute_process (
289+ COMMAND ${Python3_EXECUTABLE} "${CMAKE_CURRENT_SOURCE_DIR} /cmake/nvidiacc.py"
290+ OUTPUT_VARIABLE COMPUTE_CAPABILITY
291+ )
292+ endif ()
293+ endif ()
282294## Compute Capability 60,70 -> 60;70
283295string (REPLACE "," ";" T9_CUCCLIST ${COMPUTE_CAPABILITY} ) # 60;70
284296
0 commit comments