From b96d8af08ac84ef530f173a66d1edf2045e88e13 Mon Sep 17 00:00:00 2001 From: David G Yu Date: Fri, 30 Jun 2023 09:07:00 -0700 Subject: [PATCH] Improved documentation for OSD_CUDA_NVCC_FLAGS Also fixed the build so that obsolete CUDA gpu architectures are specified as fallback values only when using older obsolete versions of CUDA. We'll likely remove these fallbacks from future releases of OpenSubdiv. Fixes #1299 --- CMakeLists.txt | 5 ++++- README.md | 2 ++ documentation/cmake_build.rst | 2 ++ 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 9caacfb3..955c85db 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -595,10 +595,13 @@ if(CUDA_FOUND) if (UNIX) list( APPEND CUDA_NVCC_FLAGS -Xcompiler -fPIC ) + # Use OSD_CUDA_NVCC_FLAGS to specify --gpu-architecture or other CUDA + # compilation options. The overrides here are only for compatibility + # with older OpenSubdiv releases and obsolete CUDA versions. if (NOT DEFINED OSD_CUDA_NVCC_FLAGS) if (CUDA_VERSION_MAJOR LESS 6) set( OSD_CUDA_NVCC_FLAGS --gpu-architecture compute_11 ) - else() + elseif (CUDA_VERSION_MAJOR LESS 8) set( OSD_CUDA_NVCC_FLAGS --gpu-architecture compute_20 ) endif() endif() diff --git a/README.md b/README.md index fc38998f..e82e1f0a 100644 --- a/README.md +++ b/README.md @@ -135,6 +135,8 @@ SDKROOT=$(xcrun --sdk iphoneos --show-sdk-path) cmake -D NO_PTEX=1 -D NO_DOC=1 \ -DCMAKE_TOOLCHAIN_FILE=[toolchain file for crossplatform builds] -DCUDA_TOOLKIT_ROOT_DIR=[path to CUDA Toolkit] +-DOSD_CUDA_NVCC_FLAGS=[CUDA options, e.g. --gpu-architecture] + -DPTEX_LOCATION=[path to Ptex] -DGLFW_LOCATION=[path to GLFW] -DSTRINGIFY_LOCATION=[path to stringify utility] diff --git a/documentation/cmake_build.rst b/documentation/cmake_build.rst index d565713f..eadcd50f 100644 --- a/documentation/cmake_build.rst +++ b/documentation/cmake_build.rst @@ -105,6 +105,8 @@ The following configuration arguments can be passed to the CMake command line. -DCMAKE_LIBDIR_BASE=[library directory basename (default: lib)] -DCUDA_TOOLKIT_ROOT_DIR=[path to CUDA] + -DOSD_CUDA_NVCC_FLAGS=[CUDA options, e.g. --gpu-architecture] + -DPTEX_LOCATION=[path to Ptex] -DGLFW_LOCATION=[path to GLFW] -DTBB_LOCATION=[path to Intel's TBB]