[Bf-blender-cvs] [f63da3dcf59] master: Buildbot: enable support for NVIDIA Turing cards in Cycles (like GTX 20xx).

Brecht Van Lommel noreply at git.blender.org
Tue Dec 4 16:04:08 CET 2018


Commit: f63da3dcf59f87b34aa916b2c65ce5a40a48fd92
Author: Brecht Van Lommel
Date:   Tue Dec 4 11:49:57 2018 +0100
Branches: master
https://developer.blender.org/rBf63da3dcf59f87b34aa916b2c65ce5a40a48fd92

Buildbot: enable support for NVIDIA Turing cards in Cycles (like GTX 20xx).

We currently only build the sm_7x kernels with CUDA 10.0, older cards still
use 9.1 until rendering errors are solved for them.

===================================================================

M	build_files/buildbot/slave_compile.py
M	intern/cycles/kernel/CMakeLists.txt

===================================================================

diff --git a/build_files/buildbot/slave_compile.py b/build_files/buildbot/slave_compile.py
index 375357670d7..c282e3624c2 100644
--- a/build_files/buildbot/slave_compile.py
+++ b/build_files/buildbot/slave_compile.py
@@ -73,9 +73,6 @@ if 'cmake' in builder:
         if builder.endswith('x86_64_10_9_cmake'):
             cmake_extra_options.append('-DCMAKE_OSX_ARCHITECTURES:STRING=x86_64')
         cmake_extra_options.append('-DCMAKE_OSX_DEPLOYMENT_TARGET=10.9')
-        # Used to trick CUDFA to see CLang as an older version.
-        # cmake_extra_options.append('-DCUDA_HOST_COMPILER=/usr/local/cuda-hack/clang')
-        # cmake_extra_options.append('-DCUDA_NVCC_EXECUTABLE=/usr/local/cuda-hack/nvcc')
 
     elif builder.startswith('win'):
         if builder.endswith('_vs2017'):
@@ -121,6 +118,23 @@ if 'cmake' in builder:
             cmake_extra_options.extend(["-DCMAKE_C_COMPILER=/usr/bin/gcc-7",
                                         "-DCMAKE_CXX_COMPILER=/usr/bin/g++-7"])
 
+    # Workaround to build only sm_7x kernels with CUDA 10, until
+    # older kernels work well with this version.
+    if builder.startswith('win'):
+        cmake_extra_options.append('-DCUDA_VERSION=9.1')
+        cmake_extra_options.append('-DCUDA_TOOLKIT_INCLUDE:PATH=C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v9.1/include')
+        cmake_extra_options.append('-DCUDA_TOOLKIT_ROOT_DIR:PATH=C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v9.1')
+        cmake_extra_options.append('-DCUDA_NVCC_EXECUTABLE:FILEPATH=C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v9.1/bin/nvcc.exe')
+        cmake_extra_options.append('-DCUDA10_NVCC_EXECUTABLE:FILEPATH=C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v10.0/bin/nvcc.exe')
+        cmake_extra_options.append('-DCUDA10_TOOLKIT_ROOT_DIR:PATH=C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v10.0')
+    elif builder.startswith('linux'):
+        cmake_extra_options.append('-DCUDA_VERSION=9.1')
+        cmake_extra_options.append('-DCUDA_TOOLKIT_INCLDUE:PATH=/usr/local/cuda-9.1/include')
+        cmake_extra_options.append('-DCUDA_TOOLKIT_ROOT_DIR:PATH=/usr/local/cuda-9.1')
+        cmake_extra_options.append('-DCUDA_NVCC_EXECUTABLE:FILEPATH=/usr/local/cuda-9.1/bin/nvcc')
+        cmake_extra_options.append('-DCUDA10_NVCC_EXECUTABLE:FILEPATH=/usr/local/cuda-10.0/bin/nvcc')
+        cmake_extra_options.append('-DCUDA10_TOOLKIT_ROOT_DIR:PATH=/usr/local/cuda-10.0')
+
     cmake_options.append("-C" + os.path.join(blender_dir, cmake_config_file))
 
     # Prepare CMake options needed to configure cuda binaries compilation, 64bit only.
diff --git a/intern/cycles/kernel/CMakeLists.txt b/intern/cycles/kernel/CMakeLists.txt
index 3ba43a9e0bd..73ff7aeda15 100644
--- a/intern/cycles/kernel/CMakeLists.txt
+++ b/intern/cycles/kernel/CMakeLists.txt
@@ -397,17 +397,29 @@ if(WITH_CYCLES_CUDA_BINARIES)
 			set(cuda_flags ${cuda_flags} -D __KERNEL_DEBUG__)
 		endif()
 
-		if(WITH_CYCLES_CUBIN_COMPILER)
+		# Workaround to build only sm_7x kernels with CUDA 10, until
+		# older kernels work well with this version.
+		if(DEFINED CUDA10_NVCC_EXECUTABLE  AND (${arch} MATCHES "sm_7."))
+			set(with_cubin_compiler OFF)
+			set(cuda_nvcc_executable "${CUDA10_NVCC_EXECUTABLE}")
+			set(cuda_toolkit_root_dir "${CUDA10_TOOLKIT_ROOT_DIR}")
+		else()
+			set(with_cubin_compiler ${WITH_CYCLES_CUBIN_COMPILER})
+			set(cuda_nvcc_executable "${CUDA_NVCC_EXECUTABLE}")
+			set(cuda_toolkit_root_dir "${CUDA_TOOLKIT_ROOT_DIR}")
+		endif()
+
+		if(with_cubin_compiler)
 			string(SUBSTRING ${arch} 3 -1 CUDA_ARCH)
 
 			# Needed to find libnvrtc-builtins.so. Can't do it from inside
 			# cycles_cubin_cc since the env variable is read before main()
 			if(APPLE)
 				set(CUBIN_CC_ENV ${CMAKE_COMMAND}
-					-E env DYLD_LIBRARY_PATH="${CUDA_TOOLKIT_ROOT_DIR}/lib")
+					-E env DYLD_LIBRARY_PATH="${cuda_toolkit_root_dir}/lib")
 			elseif(UNIX)
 				set(CUBIN_CC_ENV ${CMAKE_COMMAND}
-					-E env LD_LIBRARY_PATH="${CUDA_TOOLKIT_ROOT_DIR}/lib64")
+					-E env LD_LIBRARY_PATH="${cuda_toolkit_root_dir}/lib64")
 			endif()
 
 			add_custom_command(
@@ -418,12 +430,12 @@ if(WITH_CYCLES_CUDA_BINARIES)
 						-i ${CMAKE_CURRENT_SOURCE_DIR}${cuda_kernel_src}
 						${cuda_flags}
 						-v
-						-cuda-toolkit-dir "${CUDA_TOOLKIT_ROOT_DIR}"
+						-cuda-toolkit-dir "${cuda_toolkit_root_dir}"
 				DEPENDS ${kernel_sources} cycles_cubin_cc)
 		else()
 			add_custom_command(
 				OUTPUT ${cuda_cubin}
-				COMMAND ${CUDA_NVCC_EXECUTABLE}
+				COMMAND ${cuda_nvcc_executable}
 						-arch=${arch}
 						${CUDA_NVCC_FLAGS}
 						--cubin



More information about the Bf-blender-cvs mailing list