Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/intern
diff options
context:
space:
mode:
authorBrecht Van Lommel <brechtvanlommel@pandora.be>2013-02-15 18:54:11 +0400
committerBrecht Van Lommel <brechtvanlommel@pandora.be>2013-02-15 18:54:11 +0400
commit313dfbe35daaba41d6410042b12d1a1b63cb31a1 (patch)
tree91653b7f8b067c00a144970b102a187460105367 /intern
parentec04f98a75d9a03fd2e817f7ed4980b82930a8a1 (diff)
Add some more detailed CUDA error prints to try to debug #34166.
Diffstat (limited to 'intern')
-rw-r--r--intern/cycles/device/device_cuda.cpp28
1 files changed, 15 insertions, 13 deletions
diff --git a/intern/cycles/device/device_cuda.cpp b/intern/cycles/device/device_cuda.cpp
index 399414d5966..77082006169 100644
--- a/intern/cycles/device/device_cuda.cpp
+++ b/intern/cycles/device/device_cuda.cpp
@@ -128,19 +128,21 @@ public:
} \
}
- 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 @@ public:
}
}
- if(cuda_error(result))
+ if(cuda_error_(result, "cuCtxCreate"))
return;
cuda_pop_context();
@@ -208,7 +210,7 @@ public:
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 @@ public:
#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 @@ public:
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 @@ public:
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 @@ public:
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 @@ public:
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;