MCPcopy Create free account
hub / github.com/LuxCoreRender/LuxCore / main

Function main

tests/benchsimple/benchsimple.cpp:38–330  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

36}
37
38int main(int argc, char** argv) {
39 try {
40 std::cerr << "LuxRays Simple IntersectionDevice Benchmark v" << LUXRAYS_VERSION_MAJOR << "." << LUXRAYS_VERSION_MINOR << std::endl;
41 std::cerr << "Usage: " << argv[0] << std::endl;
42
43 //--------------------------------------------------------------------------
44 // Create the context
45 //--------------------------------------------------------------------------
46
47 luxrays::Context *ctx = new luxrays::Context(DebugHandler);
48
49 // Get the list of all devices available
50 std::vector<luxrays::DeviceDescription *> deviceDescs = std::vector<luxrays::DeviceDescription *>(ctx->GetAvailableDeviceDescriptions());
51
52 // Use the first device available
53 //luxrays::DeviceDescription::FilterOne(deviceDescs);
54
55 // Use the first native C++ device available
56 luxrays::DeviceDescription::Filter(luxrays::DEVICE_TYPE_NATIVE_THREAD, deviceDescs);
57
58 // Use the first OpenCL device available
59 //luxrays::DeviceDescription::Filter(luxrays::DEVICE_TYPE_OPENCL_ALL, deviceDescs);
60 //luxrays::DeviceDescription::FilterOne(deviceDescs);
61
62 // Use the first OpenCL CPU device available
63 //luxrays::DeviceDescription::Filter(luxrays::DEVICE_TYPE_OPENCL_ALL, deviceDescs);
64 //luxrays::OpenCLDeviceDescription::Filter(luxrays::DEVICE_TYPE_OPENCL_CPU, deviceDescs);
65
66 // Use the first OpenCL GPU device available
67 //luxrays::DeviceDescription::Filter(luxrays::DEVICE_TYPE_OPENCL_ALL, deviceDescs);
68 //luxrays::OpenCLDeviceDescription::Filter(luxrays::DEVICE_TYPE_OPENCL_GPU, deviceDescs);
69
70 // Use all GPU devices available (for virtual device)
71 //luxrays::DeviceDescription::Filter(luxrays::DEVICE_TYPE_OPENCL_ALL, deviceDescs);
72 //luxrays::OpenCLDeviceDescription::Filter(luxrays::DEVICE_TYPE_OPENCL_GPU, deviceDescs);
73
74 if (deviceDescs.size() < 1) {
75 std::cerr << "Unable to find an usable intersection device" << std::endl;
76 return (EXIT_FAILURE);
77 }
78
79 // Single device
80 deviceDescs.resize(1);
81 std::cerr << "Selected intersection device: " << deviceDescs[0]->GetName();
82 luxrays::IntersectionDevice *device = ctx->AddIntersectionDevices(deviceDescs)[0];
83
84 // Multiple devices
85 //ctx->AddVirtualIntersectionDevices(deviceDescs);
86 //luxrays::IntersectionDevice *device = ctx->GetIntersectionDevice()[0];
87
88
89 // If it is a NativeThreadIntersectionDevice, you can set the number of threads
90 // to use. The default is to use one for each core available.
91 //((luxrays::NativeThreadIntersectionDevice *)device)->SetThreadCount(1);
92
93 //--------------------------------------------------------------------------
94 // Build the data set
95 //--------------------------------------------------------------------------

Callers

nothing calls this directly

Calls 15

AllocVerticesBufferFunction · 0.85
AllocTrianglesBufferFunction · 0.85
SgnFunction · 0.85
CoordinateSystemFunction · 0.85
WallClockTimeFunction · 0.85
AddRayMethod · 0.80
frontMethod · 0.80
GetRayCountMethod · 0.80
whatMethod · 0.80
FilterClass · 0.50
PointClass · 0.50

Tested by

no test coverage detected