From 48b4de31521501203c39fc7efa9aca7d018b6a1c Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Wed, 24 Aug 2011 10:44:04 +0000 Subject: Cycles: * 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 --- intern/cycles/app/cycles_test.cpp | 1 + intern/cycles/blender/addon/ui.py | 28 +++++++++++++++++----------- intern/cycles/blender/addon/xml.py | 2 +- intern/cycles/blender/blender_sync.cpp | 1 + intern/cycles/cmake/external_libs.cmake | 4 +--- intern/cycles/device/device.cpp | 4 ++-- intern/cycles/device/device.h | 2 +- intern/cycles/device/device_cpu.cpp | 12 ++++++++---- intern/cycles/device/device_intern.h | 2 +- intern/cycles/render/session.cpp | 2 +- intern/cycles/render/session.h | 3 +++ 11 files changed, 37 insertions(+), 24 deletions(-) diff --git a/intern/cycles/app/cycles_test.cpp b/intern/cycles/app/cycles_test.cpp index 698974b6277..f617e5db44b 100644 --- a/intern/cycles/app/cycles_test.cpp +++ b/intern/cycles/app/cycles_test.cpp @@ -222,6 +222,7 @@ static void options_parse(int argc, const char **argv) "--quiet", &options.quiet, "In background mode, don't print progress messages", "--passes %d", &options.session_params.passes, "Number of passes to render", "--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", NULL); diff --git a/intern/cycles/blender/addon/ui.py b/intern/cycles/blender/addon/ui.py index b4aeaa8e7ab..ca839691111 100644 --- a/intern/cycles/blender/addon/ui.py +++ b/intern/cycles/blender/addon/ui.py @@ -54,7 +54,7 @@ class CyclesRender_PT_integrator(CyclesButtonsPanel, bpy.types.Panel): #row = col.row() #row.prop(cycles, "blur_caustics") #row.active = not cycles.no_caustics - + class CyclesRender_PT_film(CyclesButtonsPanel, bpy.types.Panel): bl_label = "Film" @@ -69,32 +69,38 @@ class CyclesRender_PT_film(CyclesButtonsPanel, bpy.types.Panel): split.prop(cycles, "exposure") split.prop(cycles, "response_curve", text="") -class CyclesRender_PT_debug(CyclesButtonsPanel, bpy.types.Panel): - bl_label = "Debug" +class CyclesRender_PT_performance(CyclesButtonsPanel, bpy.types.Panel): + bl_label = "Performance" bl_options = {'DEFAULT_CLOSED'} def draw(self, context): layout = self.layout scene = context.scene + rd = scene.render cycles = scene.cycles split = layout.split() - col = split.column() + col = split.column(align=True) - sub = col.column(align=True) - sub.prop(cycles, "debug_bvh_type", text="") - sub.prop(cycles, "debug_use_spatial_splits") + col.label(text="Threads:") + col.row().prop(rd, "threads_mode", expand=True) + sub = col.column() + sub.enabled = rd.threads_mode == 'FIXED' + sub.prop(rd, "threads") sub = col.column(align=True) + sub.label(text="Tiles:") sub.prop(cycles, "debug_tile_size") sub.prop(cycles, "debug_min_size") - col = split.column(align=True) - col.prop(cycles, "debug_cancel_timeout") - col.prop(cycles, "debug_reset_timeout") - col.prop(cycles, "debug_text_timeout") + col = split.column() + + sub = col.column(align=True) + 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): bl_label = "Post Processing" diff --git a/intern/cycles/blender/addon/xml.py b/intern/cycles/blender/addon/xml.py index 3500d3f0aa5..f489f099e8b 100644 --- a/intern/cycles/blender/addon/xml.py +++ b/intern/cycles/blender/addon/xml.py @@ -61,7 +61,7 @@ class ExportCyclesXML(bpy.types.Operator, ExportHelper): if not object: raise Exception("No active object") - mesh = object.create_mesh(scene, True, 'PREVIEW') + mesh = object.to_mesh(scene, True, 'PREVIEW') if not mesh: raise Exception("No mesh data in active object") diff --git a/intern/cycles/blender/blender_sync.cpp b/intern/cycles/blender/blender_sync.cpp index c00fd8e7689..a6eeb5ec1ae 100644 --- a/intern/cycles/blender/blender_sync.cpp +++ b/intern/cycles/blender/blender_sync.cpp @@ -192,6 +192,7 @@ SessionParams BlenderSync::get_session_params(BL::Scene b_scene, bool background params.device_type = dtype; /* other parameters */ + params.threads = b_scene.render().threads(); params.background = background; params.passes = (background)? get_int(cscene, "passes"): INT_MAX; params.tile_size = get_int(cscene, "debug_tile_size"); diff --git a/intern/cycles/cmake/external_libs.cmake b/intern/cycles/cmake/external_libs.cmake index 01f3cc1af0d..b23e3b292c5 100644 --- a/intern/cycles/cmake/external_libs.cmake +++ b/intern/cycles/cmake/external_libs.cmake @@ -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_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_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 library = ${CUDA_LIBRARIES}") message(STATUS "CUDA nvcc = ${CUDA_NVCC}") else() message(STATUS "CUDA not found") diff --git a/intern/cycles/device/device.cpp b/intern/cycles/device/device.cpp index 4fae9310a7f..cd0d64f37dd 100644 --- a/intern/cycles/device/device.cpp +++ b/intern/cycles/device/device.cpp @@ -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); } -Device *Device::create(DeviceType type, bool background) +Device *Device::create(DeviceType type, bool background, int threads) { Device *device; switch(type) { case DEVICE_CPU: - device = device_cpu_create(); + device = device_cpu_create(threads); break; #ifdef WITH_CUDA case DEVICE_CUDA: diff --git a/intern/cycles/device/device.h b/intern/cycles/device/device.h index aba077fc2f3..8006eea1a5f 100644 --- a/intern/cycles/device/device.h +++ b/intern/cycles/device/device.h @@ -123,7 +123,7 @@ public: #endif /* 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 string string_from_type(DeviceType type); diff --git a/intern/cycles/device/device_cpu.cpp b/intern/cycles/device/device_cpu.cpp index bb47a127f20..7066efee547 100644 --- a/intern/cycles/device/device_cpu.cpp +++ b/intern/cycles/device/device_cpu.cpp @@ -44,10 +44,14 @@ public: ThreadQueue tasks; KernelGlobals *kg; - CPUDevice() + CPUDevice(int threads_num) { 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++) 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 diff --git a/intern/cycles/device/device_intern.h b/intern/cycles/device/device_intern.h index b2875b168b4..e098ac1f0e3 100644 --- a/intern/cycles/device/device_intern.h +++ b/intern/cycles/device/device_intern.h @@ -23,7 +23,7 @@ CCL_NAMESPACE_BEGIN class Device; -Device *device_cpu_create(); +Device *device_cpu_create(int threads); Device *device_opencl_create(bool background); Device *device_cuda_create(bool background); Device *device_network_create(const char *address); diff --git a/intern/cycles/render/session.cpp b/intern/cycles/render/session.cpp index 9fa0e548cab..56fbadcee08 100644 --- a/intern/cycles/render/session.cpp +++ b/intern/cycles/render/session.cpp @@ -37,7 +37,7 @@ Session::Session(const SessionParams& params_) { 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); display = new DisplayBuffer(device); diff --git a/intern/cycles/render/session.h b/intern/cycles/render/session.h index 7b23a89afc2..3411dcd23c6 100644 --- a/intern/cycles/render/session.h +++ b/intern/cycles/render/session.h @@ -46,6 +46,7 @@ public: int passes; int tile_size; int min_size; + int threads; double cancel_timeout; double reset_timeout; @@ -61,6 +62,7 @@ public: passes = INT_MAX; tile_size = 64; min_size = 64; + threads = 0; cancel_timeout = 0.1; reset_timeout = 0.1; @@ -75,6 +77,7 @@ public: && progressive == params.progressive && tile_size == params.tile_size && min_size == params.min_size + && threads == params.threads && cancel_timeout == params.cancel_timeout && reset_timeout == params.reset_timeout && text_timeout == params.text_timeout); } -- cgit v1.2.3