* auto/fixed threads option is used now, patch by Thomas.
* remove unused CUDA_LIBRARIES, library is dynamically loaded
* fix mesh XML export operator for API update
This commit is contained in:
Brecht Van Lommel
2011-08-24 10:44:04 +00:00
parent 29bdf37f9d
commit 48b4de3152
11 changed files with 38 additions and 25 deletions

View File

@@ -222,6 +222,7 @@ static void options_parse(int argc, const char **argv)
"--quiet", &options.quiet, "In background mode, don't print progress messages", "--quiet", &options.quiet, "In background mode, don't print progress messages",
"--passes %d", &options.session_params.passes, "Number of passes to render", "--passes %d", &options.session_params.passes, "Number of passes to render",
"--output %s", &options.session_params.output_path, "File path to write output image", "--output %s", &options.session_params.output_path, "File path to write output image",
"--threads %d", &options.session_params.threads, "CPU Rendering Threads",
"--help", &help, "Print help message", "--help", &help, "Print help message",
NULL); NULL);

View File

@@ -69,32 +69,38 @@ class CyclesRender_PT_film(CyclesButtonsPanel, bpy.types.Panel):
split.prop(cycles, "exposure") split.prop(cycles, "exposure")
split.prop(cycles, "response_curve", text="") split.prop(cycles, "response_curve", text="")
class CyclesRender_PT_debug(CyclesButtonsPanel, bpy.types.Panel): class CyclesRender_PT_performance(CyclesButtonsPanel, bpy.types.Panel):
bl_label = "Debug" bl_label = "Performance"
bl_options = {'DEFAULT_CLOSED'} bl_options = {'DEFAULT_CLOSED'}
def draw(self, context): def draw(self, context):
layout = self.layout layout = self.layout
scene = context.scene scene = context.scene
rd = scene.render
cycles = scene.cycles cycles = scene.cycles
split = layout.split() split = layout.split()
col = split.column() col = split.column(align=True)
sub = col.column(align=True) col.label(text="Threads:")
sub.prop(cycles, "debug_bvh_type", text="") col.row().prop(rd, "threads_mode", expand=True)
sub.prop(cycles, "debug_use_spatial_splits") sub = col.column()
sub.enabled = rd.threads_mode == 'FIXED'
sub.prop(rd, "threads")
sub = col.column(align=True) sub = col.column(align=True)
sub.label(text="Tiles:")
sub.prop(cycles, "debug_tile_size") sub.prop(cycles, "debug_tile_size")
sub.prop(cycles, "debug_min_size") sub.prop(cycles, "debug_min_size")
col = split.column(align=True) col = split.column()
col.prop(cycles, "debug_cancel_timeout")
col.prop(cycles, "debug_reset_timeout") sub = col.column(align=True)
col.prop(cycles, "debug_text_timeout") sub.label(text="Acceleration structure:")
sub.prop(cycles, "debug_bvh_type", text="")
sub.prop(cycles, "debug_use_spatial_splits")
class Cycles_PT_post_processing(CyclesButtonsPanel, bpy.types.Panel): class Cycles_PT_post_processing(CyclesButtonsPanel, bpy.types.Panel):
bl_label = "Post Processing" bl_label = "Post Processing"

View File

@@ -61,7 +61,7 @@ class ExportCyclesXML(bpy.types.Operator, ExportHelper):
if not object: if not object:
raise Exception("No active object") raise Exception("No active object")
mesh = object.create_mesh(scene, True, 'PREVIEW') mesh = object.to_mesh(scene, True, 'PREVIEW')
if not mesh: if not mesh:
raise Exception("No mesh data in active object") raise Exception("No mesh data in active object")

View File

@@ -192,6 +192,7 @@ SessionParams BlenderSync::get_session_params(BL::Scene b_scene, bool background
params.device_type = dtype; params.device_type = dtype;
/* other parameters */ /* other parameters */
params.threads = b_scene.render().threads();
params.background = background; params.background = background;
params.passes = (background)? get_int(cscene, "passes"): INT_MAX; params.passes = (background)? get_int(cscene, "passes"): INT_MAX;
params.tile_size = get_int(cscene, "debug_tile_size"); params.tile_size = get_int(cscene, "debug_tile_size");

View File

@@ -94,13 +94,11 @@ if(WITH_CYCLES_CUDA)
set(CYCLES_CUDA_ARCH sm_10 sm_11 sm_12 sm_13 sm_20 sm_21 CACHE STRING "CUDA architectures to build for") set(CYCLES_CUDA_ARCH sm_10 sm_11 sm_12 sm_13 sm_20 sm_21 CACHE STRING "CUDA architectures to build for")
set(CYCLES_CUDA_MAXREG 24 CACHE STRING "CUDA maximum number of register to use") set(CYCLES_CUDA_MAXREG 24 CACHE STRING "CUDA maximum number of register to use")
find_library(CUDA_LIBRARIES NAMES cuda PATHS ${CYCLES_CUDA}/lib ${CYCLES_CUDA}/lib/Win32 NO_DEFAULT_PATH)
find_path(CUDA_INCLUDES cuda.h ${CYCLES_CUDA}/include NO_DEFAULT_PATH) find_path(CUDA_INCLUDES cuda.h ${CYCLES_CUDA}/include NO_DEFAULT_PATH)
find_program(CUDA_NVCC NAMES nvcc PATHS ${CYCLES_CUDA}/bin NO_DEFAULT_PATH) find_program(CUDA_NVCC NAMES nvcc PATHS ${CYCLES_CUDA}/bin NO_DEFAULT_PATH)
if(CUDA_INCLUDES AND CUDA_LIBRARIES AND CUDA_NVCC) if(CUDA_INCLUDES AND CUDA_NVCC)
message(STATUS "CUDA includes = ${CUDA_INCLUDES}") message(STATUS "CUDA includes = ${CUDA_INCLUDES}")
message(STATUS "CUDA library = ${CUDA_LIBRARIES}")
message(STATUS "CUDA nvcc = ${CUDA_NVCC}") message(STATUS "CUDA nvcc = ${CUDA_NVCC}")
else() else()
message(STATUS "CUDA not found") message(STATUS "CUDA not found")

View File

@@ -99,13 +99,13 @@ void Device::draw_pixels(device_memory& rgba, int y, int w, int h, int width, in
glPixelZoom(1.0f, 1.0f); glPixelZoom(1.0f, 1.0f);
} }
Device *Device::create(DeviceType type, bool background) Device *Device::create(DeviceType type, bool background, int threads)
{ {
Device *device; Device *device;
switch(type) { switch(type) {
case DEVICE_CPU: case DEVICE_CPU:
device = device_cpu_create(); device = device_cpu_create(threads);
break; break;
#ifdef WITH_CUDA #ifdef WITH_CUDA
case DEVICE_CUDA: case DEVICE_CUDA:

View File

@@ -123,7 +123,7 @@ public:
#endif #endif
/* static */ /* static */
static Device *create(DeviceType type, bool background = true); static Device *create(DeviceType type, bool background = true, int threads = 0);
static DeviceType type_from_string(const char *name); static DeviceType type_from_string(const char *name);
static string string_from_type(DeviceType type); static string string_from_type(DeviceType type);

View File

@@ -44,10 +44,14 @@ public:
ThreadQueue<DeviceTask> tasks; ThreadQueue<DeviceTask> tasks;
KernelGlobals *kg; KernelGlobals *kg;
CPUDevice() CPUDevice(int threads_num)
{ {
kg = kernel_globals_create(); kg = kernel_globals_create();
threads.resize(system_cpu_thread_count());
if(threads_num == 0)
threads_num = system_cpu_thread_count();
threads.resize(threads_num);
for(size_t i = 0; i < threads.size(); i++) for(size_t i = 0; i < threads.size(); i++)
threads[i] = new thread(function_bind(&CPUDevice::thread_run, this, i)); threads[i] = new thread(function_bind(&CPUDevice::thread_run, this, i));
@@ -207,9 +211,9 @@ public:
} }
}; };
Device *device_cpu_create() Device *device_cpu_create(int threads)
{ {
return new CPUDevice(); return new CPUDevice(threads);
} }
CCL_NAMESPACE_END CCL_NAMESPACE_END

View File

@@ -23,7 +23,7 @@ CCL_NAMESPACE_BEGIN
class Device; class Device;
Device *device_cpu_create(); Device *device_cpu_create(int threads);
Device *device_opencl_create(bool background); Device *device_opencl_create(bool background);
Device *device_cuda_create(bool background); Device *device_cuda_create(bool background);
Device *device_network_create(const char *address); Device *device_network_create(const char *address);

View File

@@ -37,7 +37,7 @@ Session::Session(const SessionParams& params_)
{ {
device_use_gl = (params.device_type == DEVICE_CUDA && !params.background); device_use_gl = (params.device_type == DEVICE_CUDA && !params.background);
device = Device::create(params.device_type, params.background); device = Device::create(params.device_type, params.background, params.threads);
buffers = new RenderBuffers(device); buffers = new RenderBuffers(device);
display = new DisplayBuffer(device); display = new DisplayBuffer(device);

View File

@@ -46,6 +46,7 @@ public:
int passes; int passes;
int tile_size; int tile_size;
int min_size; int min_size;
int threads;
double cancel_timeout; double cancel_timeout;
double reset_timeout; double reset_timeout;
@@ -61,6 +62,7 @@ public:
passes = INT_MAX; passes = INT_MAX;
tile_size = 64; tile_size = 64;
min_size = 64; min_size = 64;
threads = 0;
cancel_timeout = 0.1; cancel_timeout = 0.1;
reset_timeout = 0.1; reset_timeout = 0.1;
@@ -75,6 +77,7 @@ public:
&& progressive == params.progressive && progressive == params.progressive
&& tile_size == params.tile_size && tile_size == params.tile_size
&& min_size == params.min_size && min_size == params.min_size
&& threads == params.threads
&& cancel_timeout == params.cancel_timeout && cancel_timeout == params.cancel_timeout
&& reset_timeout == params.reset_timeout && reset_timeout == params.reset_timeout
&& text_timeout == params.text_timeout); } && text_timeout == params.text_timeout); }