Qrack
9.13
General classical-emulating-quantum development framework
|
"Qrack::OCLEngine" manages the single OpenCL context. More...
#include <oclengine.hpp>
Public Member Functions | |
DeviceContextPtr | GetDeviceContextPtr (const int64_t &dev=-1) |
Get a pointer one of the available OpenCL contexts, by its index in the list of all contexts. More... | |
std::vector< DeviceContextPtr > | GetDeviceContextPtrVector () |
Get the list of all available devices (and their supporting objects). More... | |
void | SetDeviceContextPtrVector (std::vector< DeviceContextPtr > vec, DeviceContextPtr dcp=nullptr) |
Set the list of DeviceContextPtr object available for use. More... | |
int | GetDeviceCount () |
Get the count of devices in the current list. More... | |
size_t | GetDefaultDeviceID () |
Get default device ID. More... | |
void | SetDefaultDeviceContext (DeviceContextPtr dcp) |
Pick a default device, for QEngineOCL instances that don't specify a preferred device. More... | |
size_t | GetActiveAllocSize (const int64_t &dev) |
size_t | AddToActiveAllocSize (const int64_t &dev, size_t size) |
size_t | SubtractFromActiveAllocSize (const int64_t &dev, size_t size) |
void | ResetActiveAllocSize (const int64_t &dev) |
OCLEngine (OCLEngine const &)=delete | |
void | operator= (OCLEngine const &)=delete |
Static Public Member Functions | |
static OCLEngine & | Instance () |
Get a pointer to the Instance of the singleton. (The instance will be instantiated, if it does not exist yet.) More... | |
static std::string | GetDefaultBinaryPath () |
Get default location for precompiled binaries: More... | |
static InitOClResult | InitOCL (bool buildFromSource=false, bool saveBinaries=false, std::string home="*", std::vector< int64_t > maxAllocVec={ -1 }) |
Initialize the OCL environment, with the option to save the generated binaries. More... | |
Private Member Functions | |
OCLEngine () | |
Static Private Member Functions | |
static cl::Program | MakeProgram (bool buildFromSource, std::string path, std::shared_ptr< OCLDeviceContext > devCntxt) |
Make the program, from either source or binary. More... | |
static void | SaveBinary (cl::Program program, std::string path, std::string fileName) |
Save the program binary: More... | |
Private Attributes | |
std::vector< size_t > | activeAllocSizes |
std::vector< int64_t > | maxActiveAllocSizes |
std::mutex | allocMutex |
std::vector< DeviceContextPtr > | all_device_contexts |
DeviceContextPtr | default_device_context |
Static Private Attributes | |
static const std::vector< OCLKernelHandle > | kernelHandles |
static const std::string | binary_file_prefix |
static const std::string | binary_file_ext |
"Qrack::OCLEngine" manages the single OpenCL context.
|
delete |
|
private |
|
inline |
|
inline |
|
inlinestatic |
Get default location for precompiled binaries:
|
inline |
Get default device ID.
DeviceContextPtr Qrack::OCLEngine::GetDeviceContextPtr | ( | const int64_t & | dev = -1 | ) |
Get a pointer one of the available OpenCL contexts, by its index in the list of all contexts.
"Qrack::OCLEngine" manages the single OpenCL context
std::vector< DeviceContextPtr > Qrack::OCLEngine::GetDeviceContextPtrVector | ( | ) |
Get the list of all available devices (and their supporting objects).
|
inline |
Get the count of devices in the current list.
|
static |
Initialize the OCL environment, with the option to save the generated binaries.
Binaries will be saved/loaded from the folder path "home". This returns a Qrack::OCLInitResult object which should be passed to SetDeviceContextPtrVector().
|
inlinestatic |
Get a pointer to the Instance of the singleton. (The instance will be instantiated, if it does not exist yet.)
|
staticprivate |
Make the program, from either source or binary.
|
delete |
|
inline |
|
staticprivate |
Save the program binary:
void Qrack::OCLEngine::SetDefaultDeviceContext | ( | DeviceContextPtr | dcp | ) |
Pick a default device, for QEngineOCL instances that don't specify a preferred device.
void Qrack::OCLEngine::SetDeviceContextPtrVector | ( | std::vector< DeviceContextPtr > | vec, |
DeviceContextPtr | dcp = nullptr |
||
) |
Set the list of DeviceContextPtr object available for use.
If one takes the result of GetDeviceContextPtrVector(), trims items from it, and sets it with this method, (at initialization, before any QEngine objects depend on them,) all resources associated with the removed items are freed.
|
inline |
|
private |
|
private |
|
private |
|
staticprivate |
|
staticprivate |
|
private |
|
staticprivate |
|
private |