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})
endif()
if(WITH_CYCLES_CUDA_BINARIES)
add_definitions(-DWITH_CUDA_BINARIES)
endif()
add_definitions(-DWITH_OPENCL)
add_definitions(-DWITH_CUDA)
add_definitions(-DWITH_MULTI)

@ -53,9 +53,6 @@ if env['WITH_BF_CYCLES_OSL']:
defs.append('WITH_OSL')
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('#intern/guardedalloc #source/blender/makesrna #source/blender/makesdna'.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
def __init__(self):
engine.init()
self.session = None
def __del__(self):
@ -88,6 +87,8 @@ def register():
from . import properties
from . import presets
engine.init()
properties.register()
ui.register()
presets.register()

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

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

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