20#include "owl/common.h"
21#include "owl/DeviceMemory.h"
22#include "owl/helper/optix.h"
31 int alloc(
size_t size);
32 void release(
size_t begin,
size_t size);
33 size_t maxAllocedID = 0;
39 std::vector<FreedRange> freedRanges;
45 size_t rayGenRecordCount = 0;
46 size_t rayGenRecordSize = 0;
49 size_t hitGroupRecordSize = 0;
50 size_t hitGroupRecordCount = 0;
53 size_t missProgRecordSize = 0;
54 size_t missProgRecordCount = 0;
64 struct DeviceContext :
public std::enable_shared_from_this<DeviceContext> {
65 typedef std::shared_ptr<DeviceContext> SP;
92 void buildRayGenPrograms();
93 void buildHitGroupPrograms();
95 void destroyPrograms();
96 void destroyMissPrograms();
97 void destroyRayGenPrograms();
98 void destroyHitGroupPrograms();
100 void destroyPipeline();
101 void buildPipeline();
103 void buildCurvesModules();
104 void buildSphereModule();
111 OptixDeviceContext optixContext =
nullptr;
112 CUcontext cudaContext =
nullptr;
113 CUstream stream =
nullptr;
115 OptixPipelineCompileOptions pipelineCompileOptions = {};
116 OptixPipelineLinkOptions pipelineLinkOptions = {};
117 OptixModuleCompileOptions moduleCompileOptions = {};
118 OptixPipeline pipeline =
nullptr;
125 {
nullptr,
nullptr,
nullptr },
126 {
nullptr,
nullptr,
nullptr }
141 const int cudaDeviceID;
148 std::vector<DeviceContext::SP> createDeviceContexts(
Context *parent,
149 int32_t *requestedDeviceIDs,
150 int numRequestedDevices);
159 OWL_CUDA_CHECK(cudaGetDevice(&savedActiveDeviceID));
160 OWL_CUDA_CHECK(cudaSetDevice(device->cudaDeviceID));
164 OWL_CUDA_CHECK(cudaGetDevice(&savedActiveDeviceID));
165 OWL_CUDA_CHECK(cudaSetDevice(device->cudaDeviceID));
169 OWL_CUDA_CHECK_NOTHROW(cudaSetDevice(savedActiveDeviceID));
172 int savedActiveDeviceID = -1;
Definition: DeviceContext.h:64
int getCudaDeviceID() const
Definition: DeviceContext.cpp:241
void configurePipelineOptions(bool debug=false)
Definition: DeviceContext.cpp:257
OptixModule spheresModule
Definition: DeviceContext.h:130
const int ID
Definition: DeviceContext.h:138
std::vector< OptixProgramGroup > allActivePrograms
Definition: DeviceContext.h:109
void buildMissPrograms()
Definition: DeviceContext.cpp:477
OptixModule curvesModule[2][3]
Definition: DeviceContext.h:124
std::string getDeviceName() const
Definition: DeviceContext.cpp:233
CUstream getStream() const
Definition: DeviceContext.h:83
Context *const parent
Definition: DeviceContext.h:133
Definition: DeviceMemory.h:23
Definition: DeviceContext.h:30
int alloc(size_t size)
Definition: DeviceContext.cpp:53
void release(size_t begin, size_t size)
Definition: DeviceContext.cpp:76
Definition: DeviceContext.h:44
Definition: DeviceContext.h:156