@@ -237,7 +237,7 @@ set (HOST ${hostValue} CACHE BOOL "Build Executables for GPU Platform (OFF) or C
237
237
238
238
239
239
#[[
240
- !!/ **-DGPU_LANG (gpu_lang) = OPENACC** (experimental, in progress)
240
+ !!/ **-DGPU_LANG (gpu_lang) = OPENACC**
241
241
!!/
242
242
!!/ If set to *CUDA*, the GPU code will only use the cuda source files.
243
243
!!/ 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
255
255
256
256
257
257
#[[
258
- !!/ **-DCOMPUTE_CAPABILITY (compute_capability) = 60,70 **
258
+ !!/ **-DCOMPUTE_CAPABILITY (compute_capability) = AUTO **
259
259
!!/
260
260
!!/ GPU code only.
261
261
!!/
262
262
!!/ 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
264
264
!!/ comma-separated, e.g. 35,60.
265
265
!!/ 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.
266
269
!!/
267
270
!!/ If new cards are released but the newer compute capabilities
268
271
!!/ are not supported, please inform us.
@@ -274,11 +277,20 @@ set (GPU_LANG ${gpuLangValue} CACHE STRING
274
277
if (DEFINED ENV{compute_capability})
275
278
set (compCapValue $ENV{compute_capability} )
276
279
else ()
277
- set (compCapValue 60,70 )
280
+ set (compCapValue AUTO )
278
281
endif ()
279
282
set (COMPUTE_CAPABILITY ${compCapValue} CACHE STRING
280
283
"[GPU ONLY] CUDA Compute Capability Multiplied by 10 (Comma-Separated)"
281
284
)
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 ()
282
294
## Compute Capability 60,70 -> 60;70
283
295
string (REPLACE "," ";" T9_CUCCLIST ${COMPUTE_CAPABILITY} ) # 60;70
284
296
0 commit comments