27#include "GPUReconstructionAvailableBackends.h"
50 if (
type != DeviceType::CPU) {
51 GPUError(
"Cannot create GPUReconstruction for a non-CPU device if DEBUG_STREAMER are enabled");
55 if (
type == DeviceType::CPU) {
59 if (loader && (
retVal = (*loader)->GetPtr(cfg))) {
66 GPUError(
"Error: Could not load GPUReconstruction for specified device: %s (%u)", gpudatatypes::DEVICE_TYPE_NAMES[
type], cfg.
deviceType);
67 }
else if (
type != DeviceType::CPU) {
68 GPUError(
"Could not load GPUReconstruction for device type %s (%u), falling back to CPU version", gpudatatypes::DEVICE_TYPE_NAMES[
type], cfg.
deviceType);
74 GPUInfo(
"Created GPUReconstruction instance for device type %s (%u)%s", gpudatatypes::DEVICE_TYPE_NAMES[
type], cfg.
deviceType, cfg.
master ?
" (slave)" :
"");
82 if (
type == DeviceType::CPU) {
86 return loader !=
nullptr && (*loader)->LoadLibrary() == 0;
92 if (
type == DeviceType::CPU) {
94 }
else if (
type == DeviceType::CUDA) {
98 }
else if (
type == DeviceType::HIP) {
102 }
else if (
type == DeviceType::OCL) {
106 }
else if (
type == DeviceType::METAL) {
111 GPUError(
"Error: Invalid device type %u", (uint32_t)
type);
115 GPUInfo(
"%s Support not compiled in for device type %u (%s)", gpudatatypes::DEVICE_TYPE_NAMES[
type], (uint32_t)
type, gpudatatypes::DEVICE_TYPE_NAMES[
type]);
123 if (t == DeviceType::INVALID_DEVICE) {
124 GPUError(
"Invalid device type: %s",
type);
139int32_t GPUReconstruction::LibraryLoader::LoadLibrary()
141 static std::mutex mut;
142 std::lock_guard<std::mutex> lock(mut);
150 if (hGPULib ==
nullptr) {
152 GPUImportant(
"The following error occured during dlopen: %s", dlerror());
154 GPUError(
"Error Opening cagpu library for GPU Tracker (%s)", mLibName);
158 if (createFunc ==
nullptr) {
159 GPUError(
"Error fetching entry function in GPU library\n");
163 mGPULib = (
void*)(
size_t)hGPULib;
164 mGPUEntry = createFunc;
165 GPUInfo(
"GPU Tracker library loaded and GPU tracker object created sucessfully");
176 if (mGPUEntry ==
nullptr) {
185 if (mGPUEntry ==
nullptr) {
#define GPUCA_COMPILER_VERSIONS
LibraryLoader(const LibraryLoader &)=delete
static std::string getBackendVersions()
static std::shared_ptr< LibraryLoader > sLibHIP
static std::shared_ptr< LibraryLoader > sLibMETAL
static std::shared_ptr< LibraryLoader > * GetLibraryInstance(DeviceType type, bool verbose)
static bool CheckInstanceAvailable(DeviceType type, bool verbose)
static std::shared_ptr< LibraryLoader > sLibOCL
static GPUReconstruction * CreateInstance(const GPUSettingsDeviceBackend &cfg)
static GPUReconstruction * GPUReconstruction_Create_CPU(const GPUSettingsDeviceBackend &cfg)
static std::shared_ptr< LibraryLoader > sLibCUDA
gpudatatypes::DeviceType DeviceType
GLint GLint GLsizei GLint GLenum GLenum type
DeviceType GetDeviceType(const char *type)
#define LIBRARY_EXTENSION
#define LIBRARY_LOAD(name)
GPUReconstruction * master