13 #include "device/cpu/kernel.h"
35 bool Device::need_types_update =
true;
36 bool Device::need_devices_update =
true;
44 uint Device::devices_initialized_mask = 0;
56 BVH2 *
const bvh2 =
static_cast<BVH2 *
>(bvh);
58 bvh2->
refit(progress);
117 if (device ==
NULL) {
126 if (strcmp(name,
"CPU") == 0)
128 else if (strcmp(name,
"CUDA") == 0)
130 else if (strcmp(name,
"OPTIX") == 0)
132 else if (strcmp(name,
"MULTI") == 0)
134 else if (strcmp(name,
"HIP") == 0)
136 else if (strcmp(name,
"METAL") == 0)
138 else if (strcmp(name,
"ONEAPI") == 0)
194 #if defined(WITH_CUDA) || defined(WITH_OPTIX)
290 string capabilities =
"";
293 capabilities +=
"\nCPU device capabilities: ";
300 capabilities +=
"\nCUDA device capabilities:\n";
309 capabilities +=
"\nHIP device capabilities:\n";
318 capabilities +=
"\noneAPI device capabilities:\n";
327 capabilities +=
"\nMetal device capabilities:\n";
340 assert(subdevices.size() > 0);
342 if (subdevices.size() == 1) {
344 return subdevices.front();
360 foreach (
const DeviceInfo &device, subdevices) {
365 int cpu_threads =
max(orig_cpu_threads - (subdevices.size() - 1),
size_t(0));
367 VLOG_INFO <<
"CPU render threads reduced from " << orig_cpu_threads <<
" to "
368 << cpu_threads <<
", to dedicate to GPU.";
370 if (cpu_threads >= 1) {
380 VLOG_INFO <<
"CPU render threads disabled for interactive render.";
418 devices_initialized_mask = 0;
429 LOG(FATAL) <<
"Device does not support queues.";
443 LOG(FATAL) <<
"Device does not support CPU kernels.";
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum type
void refit(btStridingMeshInterface *triangles, const btVector3 &aabbMin, const btVector3 &aabbMax)
void refit(Progress &progress)
void build(Progress &progress, Stats *stats)
vector< DeviceInfo > multi_devices
DenoiserTypeMask denoisers
static void free_memory()
static DeviceInfo dummy_device(const string &error_msg="")
static vector< DeviceInfo > available_devices(uint device_type_mask=DEVICE_MASK_ALL)
static const CPUKernels & get_cpu_kernels()
virtual void get_cpu_kernel_thread_globals(vector< CPUKernelThreadGlobals > &)
static Device * create(const DeviceInfo &info, Stats &stats, Profiler &profiler)
virtual ~Device() noexcept(false)
virtual unique_ptr< DeviceQueue > gpu_queue_create()
virtual void build_bvh(BVH *bvh, Progress &progress, bool refit)
static DeviceType type_from_string(const char *name)
virtual void * get_cpu_osl_memory()
static string device_capabilities(uint device_type_mask=DEVICE_MASK_ALL)
static vector< DeviceType > available_types()
static string string_from_type(DeviceType type)
static DeviceInfo get_multi_device(const vector< DeviceInfo > &subdevices, int threads, bool background)
static int max_concurrency()
#define CCL_NAMESPACE_END
void device_cpu_info(vector< DeviceInfo > &devices)
CCL_NAMESPACE_BEGIN Device * device_cpu_create(const DeviceInfo &info, Stats &stats, Profiler &profiler)
string device_cpu_capabilities()
void device_cuda_info(vector< DeviceInfo > &devices)
string device_cuda_capabilities()
Device * device_cuda_create(const DeviceInfo &info, Stats &stats, Profiler &profiler)
CCL_NAMESPACE_BEGIN bool device_cuda_init()
Device * device_dummy_create(const DeviceInfo &info, Stats &stats, Profiler &profiler)
void device_hip_info(vector< DeviceInfo > &devices)
Device * device_hip_create(const DeviceInfo &info, Stats &stats, Profiler &profiler)
string device_hip_capabilities()
CCL_NAMESPACE_BEGIN bool device_hip_init()
Device * device_multi_create(const DeviceInfo &info, Stats &stats, Profiler &profiler)
Device * device_oneapi_create(const DeviceInfo &info, Stats &stats, Profiler &profiler)
void device_oneapi_info(vector< DeviceInfo > &devices)
CCL_NAMESPACE_BEGIN bool device_oneapi_init()
string device_oneapi_capabilities()
Device * device_optix_create(const DeviceInfo &info, Stats &stats, Profiler &profiler)
CCL_NAMESPACE_BEGIN bool device_optix_init()
void device_optix_info(const vector< DeviceInfo > &cuda_devices, vector< DeviceInfo > &devices)
ccl_device_inline float4 mask(const int4 &mask, const float4 &a)
Vector< CPUDevice > devices
list of all CPUDevices. for every hardware thread an instance of CPUDevice is created
ListBase threads
list of all thread for every CPUDevice in cpudevices a thread exists.
std::unique_lock< std::mutex > thread_scoped_lock
CCL_NAMESPACE_BEGIN typedef std::mutex thread_mutex