Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
CMake
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
André Pedro
CMake
Commits
c1f3086d
Commit
c1f3086d
authored
8 years ago
by
Bjoern Thiel
Committed by
Brad King
8 years ago
Browse files
Options
Downloads
Patches
Plain Diff
FindCUDA: Enable CUDA_SELECT_NVCC_ARCH_FLAGS Auto for MSVC
Fixes:
#16525
parent
a007f153
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Modules/FindCUDA/select_compute_arch.cmake
+11
-9
11 additions, 9 deletions
Modules/FindCUDA/select_compute_arch.cmake
with
11 additions
and
9 deletions
Modules/FindCUDA/select_compute_arch.cmake
+
11
−
9
View file @
c1f3086d
...
...
@@ -44,9 +44,10 @@ endif ()
#
function
(
CUDA_DETECT_INSTALLED_GPUS OUT_VARIABLE
)
if
(
NOT CUDA_GPU_DETECT_OUTPUT
)
set
(
cu
file
${
PROJECT_BINARY_DIR
}
/detect_cuda_
arch
s.c
u
)
set
(
file
${
PROJECT_BINARY_DIR
}
/detect_cuda_
compute_capabilitie
s.c
pp
)
file
(
WRITE
${
cufile
}
""
file
(
WRITE
${
file
}
""
"#include <cuda_runtime.h>
\n
"
"#include <cstdio>
\n
"
"int main()
\n
"
"{
\n
"
...
...
@@ -62,14 +63,15 @@ function(CUDA_DETECT_INSTALLED_GPUS OUT_VARIABLE)
" return 0;
\n
"
"}
\n
"
)
execute_process
(
COMMAND
"
${
CUDA_NVCC_EXECUTABLE
}
"
"--run"
"
${
cu
file
}
"
WORKING_DIRECTORY
"
${
PROJECT_BINARY_DIR
}
/CMakeFiles/
"
RESULT_VARIABLE nvcc_res OUTPUT_VARIABLE nvcc_out
ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE
)
try_run
(
run_result compile_result
${
PROJECT_BINARY_DIR
}
${
file
}
CMAKE_FLAGS
"-DINCLUDE_DIRECTORIES=
${
CUDA_INCLUDE_DIRS
}
"
LINK_LIBRARIES
${
CUDA_LIBRARIES
}
RUN_OUTPUT_VARIABLE compute_capabilities
)
if
(
nvcc_res EQUAL 0
)
string
(
REPLACE
"2.1"
"2.1(2.0)"
nvcc_out
"
${
nvcc_out
}
"
)
set
(
CUDA_GPU_DETECT_OUTPUT
${
nvcc_out
}
CACHE INTERNAL
"Returned GPU architetures from detect_gpus tool"
FORCE
)
if
(
run_result EQUAL 0
)
string
(
REPLACE
"2.1"
"2.1(2.0)"
compute_capabilities
"
${
compute_capabilities
}
"
)
set
(
CUDA_GPU_DETECT_OUTPUT
${
compute_capabilities
}
CACHE INTERNAL
"Returned GPU architetures from detect_gpus tool"
FORCE
)
endif
()
endif
()
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment