On Mon, Feb 10, 2014 at 11:47 PM, Sen Haerens <[email protected]> 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.
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());
 
_______________________________________________
Bf-committers mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-committers

Reply via email to