[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [54583] trunk/blender/intern/cycles/device /device_cuda.cpp: Add some more detailed CUDA error prints to try to debug #34166.
Brecht Van Lommel
brechtvanlommel at pandora.be
Fri Feb 15 15:54:11 CET 2013
Revision: 54583
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=54583
Author: blendix
Date: 2013-02-15 14:54:11 +0000 (Fri, 15 Feb 2013)
Log Message:
-----------
Add some more detailed CUDA error prints to try to debug #34166.
Modified Paths:
--------------
trunk/blender/intern/cycles/device/device_cuda.cpp
Modified: trunk/blender/intern/cycles/device/device_cuda.cpp
===================================================================
--- trunk/blender/intern/cycles/device/device_cuda.cpp 2013-02-15 14:30:36 UTC (rev 54582)
+++ trunk/blender/intern/cycles/device/device_cuda.cpp 2013-02-15 14:54:11 UTC (rev 54583)
@@ -128,19 +128,21 @@
} \
}
- bool cuda_error(CUresult result)
+ bool cuda_error_(CUresult result, const string& stmt)
{
if(result == CUDA_SUCCESS)
return false;
- string message = string_printf("CUDA error: %s", cuda_error_string(result));
+ string message = string_printf("CUDA error at %s: %s", stmt.c_str(), cuda_error_string(result));
if(error_msg == "")
error_msg = message;
fprintf(stderr, "%s\n", message.c_str());
return true;
}
- void cuda_error(const string& message)
+#define cuda_error(stmt) cuda_error_(stmt, #stmt)
+
+ void cuda_error_message(const string& message)
{
if(error_msg == "")
error_msg = message;
@@ -187,7 +189,7 @@
}
}
- if(cuda_error(result))
+ if(cuda_error_(result, "cuCtxCreate"))
return;
cuda_pop_context();
@@ -208,7 +210,7 @@
cuDeviceComputeCapability(&major, &minor, cuDevId);
if(major <= 1 && minor <= 2) {
- cuda_error(string_printf("CUDA device supported only with compute capability 1.3 or up, found %d.%d.", major, minor));
+ cuda_error_message(string_printf("CUDA device supported only with compute capability 1.3 or up, found %d.%d.", major, minor));
return false;
}
}
@@ -241,9 +243,9 @@
#ifdef _WIN32
if(cuHavePrecompiledKernels()) {
if(major <= 1 && minor <= 2)
- cuda_error(string_printf("CUDA device requires compute capability 1.3 or up, found %d.%d. Your GPU is not supported.", major, minor));
+ cuda_error_message(string_printf("CUDA device requires compute capability 1.3 or up, found %d.%d. Your GPU is not supported.", major, minor));
else
- cuda_error(string_printf("CUDA binary kernel for this graphics card compute capability (%d.%d) not found.", major, minor));
+ cuda_error_message(string_printf("CUDA binary kernel for this graphics card compute capability (%d.%d) not found.", major, minor));
return "";
}
#endif
@@ -252,7 +254,7 @@
string nvcc = cuCompilerPath();
if(nvcc == "") {
- cuda_error("CUDA nvcc compiler not found. Install CUDA toolkit in default location.");
+ cuda_error_message("CUDA nvcc compiler not found. Install CUDA toolkit in default location.");
return "";
}
@@ -272,13 +274,13 @@
nvcc.c_str(), major, minor, machine, kernel.c_str(), cubin.c_str(), maxreg, include.c_str());
if(system(command.c_str()) == -1) {
- cuda_error("Failed to execute compilation command, see console for details.");
+ cuda_error_message("Failed to execute compilation command, see console for details.");
return "";
}
/* verify if compilation succeeded */
if(!path_exists(cubin)) {
- cuda_error("CUDA kernel compilation failed, see console for details.");
+ cuda_error_message("CUDA kernel compilation failed, see console for details.");
return "";
}
@@ -306,8 +308,8 @@
cuda_push_context();
CUresult result = cuModuleLoad(&cuModule, cubin.c_str());
- if(cuda_error(result))
- cuda_error(string_printf("Failed loading CUDA kernel %s.", cubin.c_str()));
+ if(cuda_error_(result, "cuModuleLoad"))
+ cuda_error_message(string_printf("Failed loading CUDA kernel %s.", cubin.c_str()));
cuda_pop_context();
@@ -737,7 +739,7 @@
CUresult result = cuGraphicsGLRegisterBuffer(&pmem.cuPBOresource, pmem.cuPBO, CU_GRAPHICS_MAP_RESOURCE_FLAGS_NONE);
- if(!cuda_error(result)) {
+ if(result == CUDA_SUCCESS) {
cuda_pop_context();
mem.device_pointer = pmem.cuTexId;
More information about the Bf-blender-cvs
mailing list