summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2022-03-11 13:53:14 (GMT)
committerKitware Robot <kwrobot@kitware.com>2022-03-11 13:53:25 (GMT)
commitedee7c18e8881557366b34ee7d4edecef0181478 (patch)
tree9d913ba180467fe15130271ecd64a31b48700818 /Source
parent34c25f64513772215c0b2cd3e6c145226a5024dc (diff)
parentd1b48bfabd6157309b3056967e6e30cc0ce07983 (diff)
downloadCMake-edee7c18e8881557366b34ee7d4edecef0181478.zip
CMake-edee7c18e8881557366b34ee7d4edecef0181478.tar.gz
CMake-edee7c18e8881557366b34ee7d4edecef0181478.tar.bz2
Merge topic 'cuda-arch-native'
d1b48bfabd CUDA: Add support for CUDA_ARCHITECTURES=native 632752d62e CUDA: Add FIXME comments about deferring architecture testing 45e9ab0372 Tests: Rename CudaOnly.{All => ArchSpecial} Acked-by: Kitware Robot <kwrobot@kitware.com> Acked-by: buildbot <buildbot@kitware.com> Merge-request: !7050
Diffstat (limited to 'Source')
-rw-r--r--Source/cmGeneratorTarget.cxx17
-rw-r--r--Source/cmVisualStudioGeneratorOptions.cxx3
2 files changed, 19 insertions, 1 deletions
diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx
index 8a6cc1c..ab3ed12 100644
--- a/Source/cmGeneratorTarget.cxx
+++ b/Source/cmGeneratorTarget.cxx
@@ -3467,6 +3467,23 @@ void cmGeneratorTarget::AddCUDAArchitectureFlags(std::string& flags) const
property =
*this->Makefile->GetDefinition("CMAKE_CUDA_ARCHITECTURES_ALL_MAJOR");
}
+ } else if (property == "native") {
+ cmValue native =
+ this->Makefile->GetDefinition("CMAKE_CUDA_ARCHITECTURES_NATIVE");
+ if (native.IsEmpty()) {
+ this->Makefile->IssueMessage(
+ MessageType::FATAL_ERROR,
+ "CUDA_ARCHITECTURES is set to \"native\", but no GPU was detected.");
+ }
+ if (compiler == "NVIDIA" &&
+ cmSystemTools::VersionCompare(
+ cmSystemTools::OP_GREATER_EQUAL,
+ this->Makefile->GetDefinition("CMAKE_CUDA_COMPILER_VERSION"),
+ "11.6")) {
+ flags = cmStrCat(flags, " -arch=", property);
+ return;
+ }
+ property = *native;
}
struct CudaArchitecture
diff --git a/Source/cmVisualStudioGeneratorOptions.cxx b/Source/cmVisualStudioGeneratorOptions.cxx
index 9045a4d..d5d08b8 100644
--- a/Source/cmVisualStudioGeneratorOptions.cxx
+++ b/Source/cmVisualStudioGeneratorOptions.cxx
@@ -182,7 +182,8 @@ void cmVisualStudioGeneratorOptions::FixCudaCodeGeneration()
// First entries for the -arch=<arch> [-code=<code>,...] pair.
if (!arch.empty()) {
std::string arch_name = arch[0];
- if (arch_name == "all" || arch_name == "all-major") {
+ if (arch_name == "all" || arch_name == "all-major" ||
+ arch_name == "native") {
AppendFlagString("AdditionalOptions", "-arch=" + arch_name);
return;
}