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
This commit is contained in:
Soumith Chintala 2018-09-18 19:50:23 -07:00 committed by Brad King
parent 7162630bee
commit bfd93b73a0

View File

@ -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}