diff options
author | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2012-01-09 20:58:01 +0400 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2012-01-09 20:58:01 +0400 |
commit | d7932ceea82a3c2277a179c00ca72ecb3cfb97cb (patch) | |
tree | 933570102e52c7562b87534e87c0c38bb5eb47ec /intern/cycles/device/device_cuda.cpp | |
parent | 47d9c6689be0448b898d18a1e810d2150867938b (diff) |
Cycles: multi GPU rendering support.
The rendering device is now set in User Preferences > System, where you can
choose between OpenCL/CUDA and devices. Per scene you can then still choose
to use CPU or GPU rendering.
Load balancing still needs to be improved, now it just splits the entire
render in two, that will be done in a separate commit.
Diffstat (limited to 'intern/cycles/device/device_cuda.cpp')
-rw-r--r-- | intern/cycles/device/device_cuda.cpp | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/intern/cycles/device/device_cuda.cpp b/intern/cycles/device/device_cuda.cpp index 73d87ae4a2e..55b467fc856 100644 --- a/intern/cycles/device/device_cuda.cpp +++ b/intern/cycles/device/device_cuda.cpp @@ -341,9 +341,11 @@ public: cuda_pop_context(); } - void mem_copy_from(device_memory& mem, size_t offset, size_t size) + void mem_copy_from(device_memory& mem, int y, int w, int h, int elem) { - /* todo: offset is ignored */ + size_t offset = elem*y*w; + size_t size = elem*w*h; + cuda_push_context(); cuda_assert(cuMemcpyDtoH((uchar*)mem.data_pointer + offset, (CUdeviceptr)((uchar*)mem.device_pointer + offset), size)) @@ -863,6 +865,8 @@ void device_cuda_info(vector<DeviceInfo>& devices) if(cuDeviceGetCount(&count) != CUDA_SUCCESS) return; + vector<DeviceInfo> display_devices; + for(int num = 0; num < count; num++) { char name[256]; int attr; @@ -878,11 +882,16 @@ void device_cuda_info(vector<DeviceInfo>& devices) info.num = num; /* if device has a kernel timeout, assume it is used for display */ - if(cuDeviceGetAttribute(&attr, CU_DEVICE_ATTRIBUTE_KERNEL_EXEC_TIMEOUT, num) == CUDA_SUCCESS && attr == 1) + if(cuDeviceGetAttribute(&attr, CU_DEVICE_ATTRIBUTE_KERNEL_EXEC_TIMEOUT, num) == CUDA_SUCCESS && attr == 1) { info.display_device = true; - - devices.push_back(info); + display_devices.push_back(info); + } + else + devices.push_back(info); } + + if(!display_devices.empty()) + devices.insert(devices.end(), display_devices.begin(), display_devices.end()); } CCL_NAMESPACE_END |