[Bf-committers] Clang errors when compiling the Cycles CUDA kernel in Blender
Sen Haerens
sen at senhaerens.be
Tue Feb 11 00:38:28 CET 2014
On Mon, Feb 10, 2014 at 11:47 PM, Sen Haerens <sen at senhaerens.be> wrote:
>
> Compiling the kernel in Blender GUI is still broken because the nvcc
> arguments are hardcoded in /intern/cycles/device/device_cuda.cpp:324. It
> would be nice if it could apply the flags also.
>
Attached patch adds setting of extra nvcc flags via an environment
variable and fixed all my issues.
-------------- next part --------------
diff --git a/intern/cycles/device/device_cuda.cpp b/intern/cycles/device/device_cuda.cpp
index 3073f07..a1fa757 100644
--- a/intern/cycles/device/device_cuda.cpp
+++ b/intern/cycles/device/device_cuda.cpp
@@ -316,14 +316,17 @@ public:
arch_flags = "--maxrregcount=32 --use_fast_math";
}
+ /* Set extra CUDA nvcc flags via environment variable */
+ const char *nvcc_flags = getenv("CUDA_NVCC_FLAGS");
+
double starttime = time_dt();
printf("Compiling CUDA kernel ...\n");
path_create_directories(cubin);
string command = string_printf("\"%s\" -arch=sm_%d%d -m%d --cubin \"%s\" "
- "-o \"%s\" --ptxas-options=\"-v\" %s -I\"%s\" -DNVCC -D__KERNEL_CUDA_VERSION__=%d",
- nvcc.c_str(), major, minor, machine, kernel.c_str(), cubin.c_str(), arch_flags.c_str(), include.c_str(), cuda_version);
+ "-o \"%s\" --ptxas-options=\"-v\" %s -I\"%s\" -DNVCC -D__KERNEL_CUDA_VERSION__=%d %s",
+ nvcc.c_str(), major, minor, machine, kernel.c_str(), cubin.c_str(), arch_flags.c_str(), include.c_str(), cuda_version, nvcc_flags);
printf("%s\n", command.c_str());
More information about the Bf-committers
mailing list