Remove usage WITH_CYCLES_CUDA_BINARIES in code, use check for

precompiled cubins instead,

Logic here is following now:
- If there're precompiled cubins, assume CUDA compute is available,
  otherwise
- If cuda toolkit found, assume CUDA compute is available
- In all other cases CUDA compute is not available

For windows there're still check for only precompiled binaries,
no runtime compilation is allowed.

Ended up with such decision after discussion with Brecht. The thing
is, if we'll support runtime compilation on windows we'll end up
having lots of reports about different aspects of something doesn't
work (you need particular toolkit version, msvc installed, environment
variables set properly and so) and giving feedback on such reports
will waste time.
This commit is contained in:
Sergey Sharybin 2013-01-14 17:30:33 +00:00
parent 36f44c6e02
commit e5179bfefc
6 changed files with 24 additions and 25 deletions

@ -47,10 +47,6 @@ if(WITH_CYCLES_OSL)
include_directories(${OSL_INCLUDES}) include_directories(${OSL_INCLUDES})
endif() endif()
if(WITH_CYCLES_CUDA_BINARIES)
add_definitions(-DWITH_CUDA_BINARIES)
endif()
add_definitions(-DWITH_OPENCL) add_definitions(-DWITH_OPENCL)
add_definitions(-DWITH_CUDA) add_definitions(-DWITH_CUDA)
add_definitions(-DWITH_MULTI) add_definitions(-DWITH_MULTI)

@ -53,9 +53,6 @@ if env['WITH_BF_CYCLES_OSL']:
defs.append('WITH_OSL') defs.append('WITH_OSL')
incs.append(cycles['BF_OSL_INC']) incs.append(cycles['BF_OSL_INC'])
if env['WITH_BF_CYCLES_CUDA_BINARIES']:
defs.append('WITH_CUDA_BINARIES')
incs.extend('. bvh render device kernel kernel/osl kernel/svm util subd'.split()) incs.extend('. bvh render device kernel kernel/osl kernel/svm util subd'.split())
incs.extend('#intern/guardedalloc #source/blender/makesrna #source/blender/makesdna'.split()) incs.extend('#intern/guardedalloc #source/blender/makesrna #source/blender/makesdna'.split())
incs.extend('#source/blender/blenloader ../../source/blender/makesrna/intern'.split()) incs.extend('#source/blender/blenloader ../../source/blender/makesrna/intern'.split())

@ -40,7 +40,6 @@ class CyclesRender(bpy.types.RenderEngine):
bl_use_shading_nodes = True bl_use_shading_nodes = True
def __init__(self): def __init__(self):
engine.init()
self.session = None self.session = None
def __del__(self): def __del__(self):
@ -88,6 +87,8 @@ def register():
from . import properties from . import properties
from . import presets from . import presets
engine.init()
properties.register() properties.register()
ui.register() ui.register()
presets.register() presets.register()

@ -238,13 +238,16 @@ public:
if(path_exists(cubin)) if(path_exists(cubin))
return cubin; return cubin;
#if defined(WITH_CUDA_BINARIES) && defined(_WIN32) #ifdef _WIN32
if(major <= 1 && minor <= 2) if(cuHavePrecompiledKernels()) {
cuda_error(string_printf("CUDA device supported only compute capability 1.3 or up, found %d.%d.", major, minor)); if(major <= 1 && minor <= 2)
else cuda_error(string_printf("CUDA device supported only compute capability 1.3 or up, found %d.%d.", major, minor));
cuda_error(string_printf("CUDA binary kernel for this graphics card compute capability (%d.%d) not found.", major, minor)); else
return ""; cuda_error(string_printf("CUDA binary kernel for this graphics card compute capability (%d.%d) not found.", major, minor));
#else return "";
}
#endif
/* if not, find CUDA compiler */ /* if not, find CUDA compiler */
string nvcc = cuCompilerPath(); string nvcc = cuCompilerPath();
@ -282,7 +285,6 @@ public:
printf("Kernel compilation finished in %.2lfs.\n", time_dt() - starttime); printf("Kernel compilation finished in %.2lfs.\n", time_dt() - starttime);
return cubin; return cubin;
#endif
} }
bool load_kernels(bool experimental) bool load_kernels(bool experimental)

@ -376,21 +376,23 @@ bool cuLibraryInit()
/* cuda 4.0 */ /* cuda 4.0 */
CUDA_LIBRARY_FIND(cuCtxSetCurrent); CUDA_LIBRARY_FIND(cuCtxSetCurrent);
#ifndef WITH_CUDA_BINARIES if(cuHavePrecompiledKernels())
result = true;
#ifdef _WIN32 #ifdef _WIN32
return false; /* runtime build doesn't work at the moment */ else if(cuCompilerPath() != "")
#else result = true;
if(cuCompilerPath() == "")
return false;
#endif #endif
#endif
/* success */
result = true;
return result; return result;
} }
bool cuHavePrecompiledKernels()
{
string cubins_path = path_get("lib");
return path_exists(cubins_path);
}
string cuCompilerPath() string cuCompilerPath()
{ {
#ifdef _WIN32 #ifdef _WIN32

@ -30,6 +30,7 @@ CCL_NAMESPACE_BEGIN
* matrixMulDynlinkJIT in the CUDA SDK. */ * matrixMulDynlinkJIT in the CUDA SDK. */
bool cuLibraryInit(); bool cuLibraryInit();
bool cuHavePrecompiledKernels();
string cuCompilerPath(); string cuCompilerPath();
CCL_NAMESPACE_END CCL_NAMESPACE_END