summaryrefslogtreecommitdiff
path: root/Modules/FindCUDA
diff options
context:
space:
mode:
authorSoumith Chintala <soumith@gmail.com>2018-09-18 19:50:23 -0700
committerBrad King <brad.king@kitware.com>2018-09-19 10:55:02 -0400
commitbfd93b73a03a6b2c1e8bb298f7085f90c30337c1 (patch)
tree7bf0a68656a6a7727afba422eb24688b2a743651 /Modules/FindCUDA
parent7162630beebeac105c1cd90270d26f29aa8c118f (diff)
downloadcmake-bfd93b73a03a6b2c1e8bb298f7085f90c30337c1.tar.gz
FindCUDA: Filter unrelated content in compute capabilities output
Working around CUDA-level nvrm_gpu log statements to stdout on some embedded platforms (ex. Drive PX2). See-also: https://github.com/pytorch/pytorch/issues/11518#issue-359113249
Diffstat (limited to 'Modules/FindCUDA')
-rw-r--r--Modules/FindCUDA/select_compute_arch.cmake3
1 files changed, 3 insertions, 0 deletions
diff --git a/Modules/FindCUDA/select_compute_arch.cmake b/Modules/FindCUDA/select_compute_arch.cmake
index cf4fc39dfd..1baf0515ac 100644
--- a/Modules/FindCUDA/select_compute_arch.cmake
+++ b/Modules/FindCUDA/select_compute_arch.cmake
@@ -109,6 +109,9 @@ function(CUDA_DETECT_INSTALLED_GPUS OUT_VARIABLE)
RUN_OUTPUT_VARIABLE compute_capabilities)
endif()
+ # Filter unrelated content out of the output.
+ string(REGEX MATCHALL "[0-9]+\\.[0-9]+" compute_capabilities "${compute_capabilities}")
+
if(run_result EQUAL 0)
string(REPLACE "2.1" "2.1(2.0)" compute_capabilities "${compute_capabilities}")
set(CUDA_GPU_DETECT_OUTPUT ${compute_capabilities}