GGEMS  1.1
GPU GEant4-based Monte Carlo Simulations
GGEMSOpenCLManager.hh
Go to the documentation of this file.
1 #ifndef GUARD_GGEMS_GLOBAL_GGEMSOPENCLMANAGER_HH
2 #define GUARD_GGEMS_GLOBAL_GGEMSOPENCLMANAGER_HH
3 
4 // ************************************************************************
5 // * This file is part of GGEMS. *
6 // * *
7 // * GGEMS is free software: you can redistribute it and/or modify *
8 // * it under the terms of the GNU General Public License as published by *
9 // * the Free Software Foundation, either version 3 of the License, or *
10 // * (at your option) any later version. *
11 // * *
12 // * GGEMS is distributed in the hope that it will be useful, *
13 // * but WITHOUT ANY WARRANTY; without even the implied warranty of *
14 // * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
15 // * GNU General Public License for more details. *
16 // * *
17 // * You should have received a copy of the GNU General Public License *
18 // * along with GGEMS. If not, see <https://www.gnu.org/licenses/>. *
19 // * *
20 // ************************************************************************
21 
34 #include <unordered_map>
36 
37 #ifdef _MSC_VER
38 #pragma warning(disable: 4251) // Deleting warning exporting STL members!!!
39 #endif
40 
41 #if __GNUC__ >= 6
42 #pragma GCC diagnostic ignored "-Wignored-attributes"
43 #endif
44 
45 typedef std::unordered_map<std::string, std::string> VendorUMap;
47 #define KERNEL_NOT_COMPILED 0x100000000
53 class GGEMS_EXPORT GGEMSOpenCLManager
54 {
55  private:
59  GGEMSOpenCLManager(void);
60 
64  ~GGEMSOpenCLManager(void);
65 
66  public:
73  {
74  static GGEMSOpenCLManager instance;
75  return instance;
76  }
77 
83  GGEMSOpenCLManager(GGEMSOpenCLManager const& opencl_manager) = delete;
84 
90  GGEMSOpenCLManager& operator=(GGEMSOpenCLManager const& opencl_manager) = delete;
91 
97  GGEMSOpenCLManager(GGEMSOpenCLManager const&& opencl_manager) = delete;
98 
104  GGEMSOpenCLManager& operator=(GGEMSOpenCLManager const&& opencl_manager) = delete;
105 
113  void CheckOpenCLError(GGint const& error, std::string const& class_name, std::string const& method_name) const;
114 
119  void PrintPlatformInfos(void) const;
120 
125  void PrintDeviceInfos(void) const;
126 
131  void PrintBuildOptions(void) const;
132 
137  void PrintActivatedDevices(void) const;
138 
145  inline std::string GetDeviceName(GGsize const& device_index) const {return device_name_[device_index];}
146 
153  inline cl_device_type GetDeviceType(GGsize const& device_index) const {return device_type_[device_index];}
154 
160  inline GGsize GetNumberOfDetectedDevice(void) const {return devices_.size();}
161 
167  inline GGsize GetNumberOfActivatedDevice(void) const {return device_indices_.size();}
168 
175  inline GGsize GetIndexOfActivatedDevice(GGsize const& thread_index) const {return device_indices_[thread_index];}
176 
183  inline GGsize GetMaxBufferAllocationSize(GGsize const& device_index) const {return static_cast<GGsize>(device_max_mem_alloc_size_[device_index]);}
184 
191  inline GGsize GetRAMMemory(GGsize const& device_index) const {return static_cast<GGsize>(device_global_mem_size_[device_index]);}
192 
198  inline GGsize GetWorkGroupSize(void) const { return work_group_size_;}
199 
206  GGsize GetBestWorkItem(GGsize const& number_of_elements) const;
207 
214  inline cl::Context* GetContext(GGsize const& thread_index) const {return contexts_[thread_index];}
215 
222  inline cl::CommandQueue* GetCommandQueue(GGsize const& thread_index) const {return queues_[thread_index];}
223 
230  inline cl::Event* GetEvent(GGsize const& thread_index) const {return events_[thread_index];}
231 
237  void DeviceToActivate(GGsize const& device_id);
238 
245  void DeviceToActivate(std::string const& device_type, std::string const& device_vendor = "");
246 
247 
253  void DeviceBalancing(std::string const& device_balancing);
254 
261  inline GGfloat GetDeviceBalancing(GGsize const& thread_index) const {return device_balancing_[thread_index];}
262 
268  inline GGsize GetNumberDeviceLoads(void) const {return device_balancing_.size();}
269 
275  inline bool IsReady(void) const {return !device_indices_.empty();}
276 
281  void Clean(void);
282 
292  void CompileKernel(std::string const& kernel_filename, std::string const& kernel_name, cl::Kernel** kernel_list, char* const custom_options = nullptr, char* const additional_options = nullptr);
293 
302  template <typename T>
303  T* GetDeviceBuffer(cl::Buffer* device_ptr, GGsize const& size, GGsize const& thread_index);
304 
312  template <typename T>
313  void ReleaseDeviceBuffer(cl::Buffer* const device_ptr, T* host_ptr, GGsize const& thread_index);
314 
325  cl::Buffer* Allocate(void* host_ptr, GGsize const& size, GGsize const& thread_index, cl_mem_flags flags, std::string const& class_name = "Undefined");
326 
335  void Deallocate(cl::Buffer* buffer, GGsize size, GGsize const& thread_index, std::string const& class_name = "Undefined");
336 
344  void CleanBuffer(cl::Buffer* buffer, GGsize const& size, GGsize const& thread_index);
345 
352  bool IsDoublePrecisionAtomicAddition(GGsize const& device_index) const;
353 
354  private:
361  std::string ErrorType(GGint const& error) const;
362 
370  GGsize CheckKernel(std::string const& kernel_name, std::string const& compilation_options) const;
371 
378  bool IsDoublePrecision(GGsize const& device_index) const;
379 
380  private:
381  // OpenCL platform
382  std::vector<cl::Platform> platforms_;
384  std::vector<std::string> platform_profile_;
385  std::vector<std::string> platform_version_;
386  std::vector<std::string> platform_name_;
387  std::vector<std::string> platform_vendor_;
388  std::vector<std::string> platform_extensions_;
390  // OpenCL device
391  std::vector<cl::Device*> devices_;
392  std::vector<GGsize> device_indices_;
396  std::vector<cl_device_type> device_type_;
397  std::vector<std::string> device_name_;
398  std::vector<std::string> device_vendor_;
399  std::vector<GGuint> device_vendor_id_;
400  std::vector<std::string> device_profile_;
401  std::vector<std::string> device_version_;
402  std::vector<std::string> device_driver_version_;
403  std::vector<std::string> device_opencl_c_version_;
404  std::vector<GGuint> device_native_vector_width_char_;
405  std::vector<GGuint> device_native_vector_width_short_;
406  std::vector<GGuint> device_native_vector_width_int_;
407  std::vector<GGuint> device_native_vector_width_long_;
408  std::vector<GGuint> device_native_vector_width_half_;
409  std::vector<GGuint> device_native_vector_width_float_;
418  std::vector<GGuint> device_address_bits_;
419  std::vector<GGbool> device_available_;
420  std::vector<GGbool> device_compiler_available_;
421  std::vector<cl_device_fp_config> device_half_fp_config_;
422  std::vector<cl_device_fp_config> device_single_fp_config_;
423  std::vector<cl_device_fp_config> device_double_fp_config_;
424  std::vector<GGbool> device_endian_little_;
425  std::vector<std::string> device_extensions_;
426  std::vector<GGbool> device_error_correction_support_;
427  std::vector<cl_device_exec_capabilities> device_execution_capabilities_;
428  std::vector<GGulong> device_global_mem_cache_size_;
429  std::vector<cl_device_mem_cache_type> device_global_mem_cache_type_;
430  std::vector<GGuint> device_global_mem_cacheline_size_;
431  std::vector<GGulong> device_global_mem_size_;
432  std::vector<GGulong> device_local_mem_size_;
433  std::vector<cl_device_local_mem_type> device_local_mem_type_;
434  std::vector<GGbool> device_host_unified_memory_;
435  std::vector<GGsize> device_image_max_array_size_;
436  std::vector<GGsize> device_image_max_buffer_size_;
437  std::vector<GGbool> device_image_support_;
438  std::vector<GGsize> device_image2D_max_width_;
439  std::vector<GGsize> device_image2D_max_height_;
440  std::vector<GGsize> device_image3D_max_width_;
441  std::vector<GGsize> device_image3D_max_height_;
442  std::vector<GGsize> device_image3D_max_depth_;
443  std::vector<GGuint> device_max_read_image_args_;
444  std::vector<GGuint> device_max_write_image_args_;
445  std::vector<GGuint> device_max_clock_frequency_;
446  std::vector<GGuint> device_max_compute_units_;
447  std::vector<GGuint> device_max_constant_args_;
448  std::vector<GGulong> device_max_constant_buffer_size_;
449  std::vector<GGulong> device_max_mem_alloc_size_;
450  std::vector<GGsize> device_max_parameter_size_;
451  std::vector<GGuint> device_max_samplers_;
452  std::vector<GGsize> device_max_work_group_size_;
453  std::vector<GGuint> device_max_work_item_dimensions_;
454  std::vector<GGsize> device_max_work_item_sizes_;
455  std::vector<GGuint> device_mem_base_addr_align_;
456  std::vector<GGsize> device_printf_buffer_size_;
457  std::vector<cl_device_affinity_domain> device_partition_affinity_domain_;
458  std::vector<GGuint> device_partition_max_sub_devices_;
460  std::vector<GGfloat> device_balancing_;
462  // OpenCL compilation options
463  std::string build_options_;
465  // OpenCL context + command queue + event
466  std::vector<cl::Context*> contexts_;
467  std::vector<cl::CommandQueue*> queues_;
468  std::vector<cl::Event*> events_;
470  // OpenCL kernels
471  std::vector<cl::Kernel*> kernels_;
472  std::vector<std::string> kernel_compilation_options_;
473 };
474 
478 
479 template <typename T>
480 T* GGEMSOpenCLManager::GetDeviceBuffer(cl::Buffer* const device_ptr, GGsize const& size, GGsize const& thread_index)
481 {
482  GGcout("GGEMSOpenCLManager", "GetDeviceBuffer", 4) << "Getting mapped memory buffer on OpenCL device..." << GGendl;
483 
484  GGint err = 0;
485  T* ptr = static_cast<T*>(queues_[thread_index]->enqueueMapBuffer(*device_ptr, CL_TRUE, CL_MAP_WRITE | CL_MAP_READ, 0, size, nullptr, nullptr, &err));
486  CheckOpenCLError(err, "GGEMSOpenCLManager", "GetDeviceBuffer");
487  return ptr;
488 }
489 
493 
494 template <typename T>
495 void GGEMSOpenCLManager::ReleaseDeviceBuffer(cl::Buffer* const device_ptr, T* host_ptr, GGsize const& thread_index)
496 {
497  GGcout("GGEMSOpenCLManager", "ReleaseDeviceBuffer", 4) << "Releasing mapped memory buffer on OpenCL device..." << GGendl;
498 
499  // Unmap the memory
500  CheckOpenCLError(queues_[thread_index]->enqueueUnmapMemObject(*device_ptr, host_ptr), "GGEMSOpenCLManager", "ReleaseDeviceBuffer");
501 }
502 
508 extern "C" GGEMS_EXPORT GGEMSOpenCLManager* get_instance_ggems_opencl_manager(void);
509 
515 extern "C" GGEMS_EXPORT void print_infos_opencl_manager(GGEMSOpenCLManager* opencl_manager);
516 
523 extern "C" GGEMS_EXPORT void set_device_index_ggems_opencl_manager(GGEMSOpenCLManager* opencl_manager, GGsize const device_id);
524 
532 extern "C" GGEMS_EXPORT void set_device_to_activate_opencl_manager(GGEMSOpenCLManager* opencl_manager, char const* device_type, char const* device_vendor = "");
533 
539 extern "C" GGEMS_EXPORT void clean_opencl_manager(GGEMSOpenCLManager* opencl_manager);
540 
547 extern "C" GGEMS_EXPORT void set_device_balancing_opencl_manager(GGEMSOpenCLManager* opencl_manager, char const* device_balancing);
548 
549 #endif // GUARD_GGEMS_GLOBAL_GGEMSOpenCLManager_HH
GGEMSOpenCLManager::GetDeviceBalancing
GGfloat GetDeviceBalancing(GGsize const &thread_index) const
return the device load for a device
Definition: GGEMSOpenCLManager.hh:261
GGEMSOpenCLManager::device_preferred_vector_width_int_
std::vector< GGuint > device_preferred_vector_width_int_
Definition: GGEMSOpenCLManager.hh:413
GGEMSOpenCLManager::device_partition_affinity_domain_
std::vector< cl_device_affinity_domain > device_partition_affinity_domain_
Definition: GGEMSOpenCLManager.hh:457
GGEMSOpenCLManager::IsReady
bool IsReady(void) const
check if an OpenCL device is activated
Definition: GGEMSOpenCLManager.hh:275
GGEMSOpenCLManager::device_native_vector_width_char_
std::vector< GGuint > device_native_vector_width_char_
Definition: GGEMSOpenCLManager.hh:404
GGEMSOpenCLManager::platform_extensions_
std::vector< std::string > platform_extensions_
Definition: GGEMSOpenCLManager.hh:388
GGEMSOpenCLManager::device_host_unified_memory_
std::vector< GGbool > device_host_unified_memory_
Definition: GGEMSOpenCLManager.hh:434
GGEMSOpenCLManager::GetNumberOfActivatedDevice
GGsize GetNumberOfActivatedDevice(void) const
get the number of activated devices
Definition: GGEMSOpenCLManager.hh:167
set_device_balancing_opencl_manager
void set_device_balancing_opencl_manager(GGEMSOpenCLManager *opencl_manager, char const *device_balancing)
change the device balancing, by default device balancing is the same for each device
Definition: GGEMSOpenCLManager.cc:1484
print_infos_opencl_manager
void print_infos_opencl_manager(GGEMSOpenCLManager *opencl_manager)
Print information about OpenCL.
Definition: GGEMSOpenCLManager.cc:1445
GGEMSOpenCLManager::vendors_
VendorUMap vendors_
Definition: GGEMSOpenCLManager.hh:394
GGEMSOpenCLManager::device_max_samplers_
std::vector< GGuint > device_max_samplers_
Definition: GGEMSOpenCLManager.hh:451
GGEMSOpenCLManager::device_preferred_vector_width_half_
std::vector< GGuint > device_preferred_vector_width_half_
Definition: GGEMSOpenCLManager.hh:415
VendorUMap
std::unordered_map< std::string, std::string > VendorUMap
Definition: GGEMSOpenCLManager.hh:45
GGEMSOpenCLManager::GetRAMMemory
GGsize GetRAMMemory(GGsize const &device_index) const
Get the RAM in bytes on OpenCL device.
Definition: GGEMSOpenCLManager.hh:191
GGEMSOpenCLManager::operator=
GGEMSOpenCLManager & operator=(GGEMSOpenCLManager const &opencl_manager)=delete
Avoid assignement of the singleton by reference.
GGEMSOpenCLManager::devices_
std::vector< cl::Device * > devices_
Definition: GGEMSOpenCLManager.hh:391
GGEMSOpenCLManager::device_max_mem_alloc_size_
std::vector< GGulong > device_max_mem_alloc_size_
Definition: GGEMSOpenCLManager.hh:449
GGEMSOpenCLManager::device_preferred_vector_width_char_
std::vector< GGuint > device_preferred_vector_width_char_
Definition: GGEMSOpenCLManager.hh:411
GGEMSOpenCLManager::GetDeviceType
cl_device_type GetDeviceType(GGsize const &device_index) const
Get the type of the activated device.
Definition: GGEMSOpenCLManager.hh:153
GGEMSOpenCLManager::device_native_vector_width_float_
std::vector< GGuint > device_native_vector_width_float_
Definition: GGEMSOpenCLManager.hh:409
GGEMSOpenCLManager::GetMaxBufferAllocationSize
GGsize GetMaxBufferAllocationSize(GGsize const &device_index) const
Get the max buffer size in bytes on activated OpenCL device.
Definition: GGEMSOpenCLManager.hh:183
GGEMSOpenCLManager::device_image_max_array_size_
std::vector< GGsize > device_image_max_array_size_
Definition: GGEMSOpenCLManager.hh:435
GGEMSOpenCLManager::device_native_vector_width_long_
std::vector< GGuint > device_native_vector_width_long_
Definition: GGEMSOpenCLManager.hh:407
GGEMSOpenCLManager::CheckOpenCLError
void CheckOpenCLError(GGint const &error, std::string const &class_name, std::string const &method_name) const
check the OpenCL error
Definition: GGEMSOpenCLManager.cc:1048
GGEMSOpenCLManager::device_native_vector_width_int_
std::vector< GGuint > device_native_vector_width_int_
Definition: GGEMSOpenCLManager.hh:406
GGEMSOpenCLManager::device_preferred_vector_width_long_
std::vector< GGuint > device_preferred_vector_width_long_
Definition: GGEMSOpenCLManager.hh:414
GGEMSOpenCLManager::GetEvent
cl::Event * GetEvent(GGsize const &thread_index) const
return an event to activated context
Definition: GGEMSOpenCLManager.hh:230
GGEMSOpenCLManager::device_error_correction_support_
std::vector< GGbool > device_error_correction_support_
Definition: GGEMSOpenCLManager.hh:426
GGEMSOpenCLManager::ReleaseDeviceBuffer
void ReleaseDeviceBuffer(cl::Buffer *const device_ptr, T *host_ptr, GGsize const &thread_index)
Get the device pointer on host to write on it. Mandatory after a GetDeviceBufferWrite ou GetDeviceBuf...
Definition: GGEMSOpenCLManager.hh:495
GGEMSOpenCLManager::device_double_fp_config_
std::vector< cl_device_fp_config > device_double_fp_config_
Definition: GGEMSOpenCLManager.hh:423
GGEMSOpenCLManager::device_max_work_item_dimensions_
std::vector< GGuint > device_max_work_item_dimensions_
Definition: GGEMSOpenCLManager.hh:453
GGEMSOpenCLManager::device_profile_
std::vector< std::string > device_profile_
Definition: GGEMSOpenCLManager.hh:400
GGEMSOpenCLManager::device_address_bits_
std::vector< GGuint > device_address_bits_
Definition: GGEMSOpenCLManager.hh:418
GGEMSOpenCLManager::device_max_constant_buffer_size_
std::vector< GGulong > device_max_constant_buffer_size_
Definition: GGEMSOpenCLManager.hh:448
GGEMSOpenCLManager::device_compiler_available_
std::vector< GGbool > device_compiler_available_
Definition: GGEMSOpenCLManager.hh:420
GGEMSOpenCLManager::device_single_fp_config_
std::vector< cl_device_fp_config > device_single_fp_config_
Definition: GGEMSOpenCLManager.hh:422
GGEMSOpenCLManager::device_half_fp_config_
std::vector< cl_device_fp_config > device_half_fp_config_
Definition: GGEMSOpenCLManager.hh:421
GGEMSOpenCLManager::work_group_size_
GGsize work_group_size_
Definition: GGEMSOpenCLManager.hh:393
GGEMSOpenCLManager::device_type_
std::vector< cl_device_type > device_type_
Definition: GGEMSOpenCLManager.hh:396
GGsize
#define GGsize
Definition: GGEMSTypes.hh:252
GGEMSOpenCLManager::device_max_read_image_args_
std::vector< GGuint > device_max_read_image_args_
Definition: GGEMSOpenCLManager.hh:443
GGEMSOpenCLManager::platform_version_
std::vector< std::string > platform_version_
Definition: GGEMSOpenCLManager.hh:385
GGEMSOpenCLManager::device_global_mem_size_
std::vector< GGulong > device_global_mem_size_
Definition: GGEMSOpenCLManager.hh:431
GGEMSOpenCLManager::device_native_vector_width_short_
std::vector< GGuint > device_native_vector_width_short_
Definition: GGEMSOpenCLManager.hh:405
GGint
#define GGint
Definition: GGEMSTypes.hh:224
set_device_index_ggems_opencl_manager
void set_device_index_ggems_opencl_manager(GGEMSOpenCLManager *opencl_manager, GGsize const device_id)
Set the device index to activate.
Definition: GGEMSOpenCLManager.cc:1457
GGEMSOpenCLManager::device_vendor_id_
std::vector< GGuint > device_vendor_id_
Definition: GGEMSOpenCLManager.hh:399
GGEMSOpenCLManager::device_opencl_c_version_
std::vector< std::string > device_opencl_c_version_
Definition: GGEMSOpenCLManager.hh:403
GGEMSOpenCLManager::device_vendor_
std::vector< std::string > device_vendor_
Definition: GGEMSOpenCLManager.hh:398
GGEMSOpenCLManager::device_max_compute_units_
std::vector< GGuint > device_max_compute_units_
Definition: GGEMSOpenCLManager.hh:446
GGEMSOpenCLManager::device_preferred_vector_width_double_
std::vector< GGuint > device_preferred_vector_width_double_
Definition: GGEMSOpenCLManager.hh:417
GGEMSOpenCLManager::GGEMSOpenCLManager
GGEMSOpenCLManager(GGEMSOpenCLManager const &opencl_manager)=delete
Avoid copy of the singleton by reference.
get_instance_ggems_opencl_manager
GGEMSOpenCLManager * get_instance_ggems_opencl_manager(void)
Get the GGEMSOpenCLManager pointer for python user.
Definition: GGEMSOpenCLManager.cc:1436
GGEMSOpenCLManager::device_printf_buffer_size_
std::vector< GGsize > device_printf_buffer_size_
Definition: GGEMSOpenCLManager.hh:456
GGEMSOpenCLManager::GetWorkGroupSize
GGsize GetWorkGroupSize(void) const
Get the work group size defined in GGEMS on activated OpenCL context.
Definition: GGEMSOpenCLManager.hh:198
GGEMSOpenCLManager::device_max_constant_args_
std::vector< GGuint > device_max_constant_args_
Definition: GGEMSOpenCLManager.hh:447
GGEMSOpenCLManager::device_max_work_item_sizes_
std::vector< GGsize > device_max_work_item_sizes_
Definition: GGEMSOpenCLManager.hh:454
GGEMSOpenCLManager::device_indices_
std::vector< GGsize > device_indices_
Definition: GGEMSOpenCLManager.hh:392
GGEMSOpenCLManager::device_global_mem_cache_size_
std::vector< GGulong > device_global_mem_cache_size_
Definition: GGEMSOpenCLManager.hh:428
GGEMSOpenCLManager::device_image_support_
std::vector< GGbool > device_image_support_
Definition: GGEMSOpenCLManager.hh:437
GGEMSOpenCLManager::queues_
std::vector< cl::CommandQueue * > queues_
Definition: GGEMSOpenCLManager.hh:467
GGEMSOpenCLManager::platform_vendor_
std::vector< std::string > platform_vendor_
Definition: GGEMSOpenCLManager.hh:387
GGEMSOpenCLManager::device_preferred_vector_width_short_
std::vector< GGuint > device_preferred_vector_width_short_
Definition: GGEMSOpenCLManager.hh:412
GGEMSOpenCLManager::device_endian_little_
std::vector< GGbool > device_endian_little_
Definition: GGEMSOpenCLManager.hh:424
GGEMSOpenCLManager::device_max_parameter_size_
std::vector< GGsize > device_max_parameter_size_
Definition: GGEMSOpenCLManager.hh:450
GGEMSOpenCLManager::kernels_
std::vector< cl::Kernel * > kernels_
Definition: GGEMSOpenCLManager.hh:471
GGEMSOpenCLManager::device_native_vector_width_half_
std::vector< GGuint > device_native_vector_width_half_
Definition: GGEMSOpenCLManager.hh:408
GGEMSOpenCLManager::device_max_clock_frequency_
std::vector< GGuint > device_max_clock_frequency_
Definition: GGEMSOpenCLManager.hh:445
GGEMSOpenCLManager::device_preferred_vector_width_float_
std::vector< GGuint > device_preferred_vector_width_float_
Definition: GGEMSOpenCLManager.hh:416
GGcout
GGEMSStream GGcout
Definition: GGEMSPrint.cc:34
GGEMSOpenCLManager::device_image3D_max_width_
std::vector< GGsize > device_image3D_max_width_
Definition: GGEMSOpenCLManager.hh:440
GGEMSOpenCLManager::device_available_
std::vector< GGbool > device_available_
Definition: GGEMSOpenCLManager.hh:419
GGEMSOpenCLManager::GetContext
cl::Context * GetContext(GGsize const &thread_index) const
return the activated context
Definition: GGEMSOpenCLManager.hh:214
GGEMSOpenCLManager::device_image3D_max_depth_
std::vector< GGsize > device_image3D_max_depth_
Definition: GGEMSOpenCLManager.hh:442
GGEMSOpenCLManager::build_options_
std::string build_options_
Definition: GGEMSOpenCLManager.hh:463
GGEMSOpenCLManager::device_global_mem_cacheline_size_
std::vector< GGuint > device_global_mem_cacheline_size_
Definition: GGEMSOpenCLManager.hh:430
GGEMSOpenCLManager::device_native_vector_width_double_
std::vector< GGuint > device_native_vector_width_double_
Definition: GGEMSOpenCLManager.hh:410
GGEMSOpenCLManager::device_profiling_timer_resolution_
std::vector< GGsize > device_profiling_timer_resolution_
Definition: GGEMSOpenCLManager.hh:459
GGEMSOpenCLManager::device_partition_max_sub_devices_
std::vector< GGuint > device_partition_max_sub_devices_
Definition: GGEMSOpenCLManager.hh:458
GGEMSOpenCLManager::GetDeviceBuffer
T * GetDeviceBuffer(cl::Buffer *device_ptr, GGsize const &size, GGsize const &thread_index)
Get the device pointer on host to write on it. ReleaseDeviceBuffer must be used after this method!...
Definition: GGEMSOpenCLManager.hh:480
GGEMSOpenCLManager::GetNumberOfDetectedDevice
GGsize GetNumberOfDetectedDevice(void) const
get the number of detected devices
Definition: GGEMSOpenCLManager.hh:160
GGEMSOpenCLManager::platforms_
std::vector< cl::Platform > platforms_
Definition: GGEMSOpenCLManager.hh:382
GGEMSOpenCLManager::device_execution_capabilities_
std::vector< cl_device_exec_capabilities > device_execution_capabilities_
Definition: GGEMSOpenCLManager.hh:427
GGendl
#define GGendl
overload C++ std::endl
Definition: GGEMSPrint.hh:60
GGEMSOpenCLManager::device_image2D_max_width_
std::vector< GGsize > device_image2D_max_width_
Definition: GGEMSOpenCLManager.hh:438
GGEMSOpenCLManager::device_local_mem_size_
std::vector< GGulong > device_local_mem_size_
Definition: GGEMSOpenCLManager.hh:432
GGEMSOpenCLManager
Singleton class storing all informations about OpenCL and managing GPU/CPU devices,...
Definition: GGEMSOpenCLManager.hh:54
GGEMSOpenCLManager::platform_profile_
std::vector< std::string > platform_profile_
Definition: GGEMSOpenCLManager.hh:384
clean_opencl_manager
void clean_opencl_manager(GGEMSOpenCLManager *opencl_manager)
Clean OpenCL manager for python user.
Definition: GGEMSOpenCLManager.cc:1475
GGEMSOpenCLManager::device_version_
std::vector< std::string > device_version_
Definition: GGEMSOpenCLManager.hh:401
GGEMSPrint.hh
Print a custom std::cout end std::cerr handling verbosity.
GGEMSOpenCLManager::contexts_
std::vector< cl::Context * > contexts_
Definition: GGEMSOpenCLManager.hh:466
GGEMSOpenCLManager::device_mem_base_addr_align_
std::vector< GGuint > device_mem_base_addr_align_
Definition: GGEMSOpenCLManager.hh:455
GGEMSOpenCLManager::device_driver_version_
std::vector< std::string > device_driver_version_
Definition: GGEMSOpenCLManager.hh:402
GGEMSOpenCLManager::device_global_mem_cache_type_
std::vector< cl_device_mem_cache_type > device_global_mem_cache_type_
Definition: GGEMSOpenCLManager.hh:429
GGEMSOpenCLManager::device_name_
std::vector< std::string > device_name_
Definition: GGEMSOpenCLManager.hh:397
GGEMSOpenCLManager::device_balancing_
std::vector< GGfloat > device_balancing_
Definition: GGEMSOpenCLManager.hh:460
GGEMSOpenCLManager::GetDeviceName
std::string GetDeviceName(GGsize const &device_index) const
Get the name of the activated device.
Definition: GGEMSOpenCLManager.hh:145
GGEMSOpenCLManager::device_image3D_max_height_
std::vector< GGsize > device_image3D_max_height_
Definition: GGEMSOpenCLManager.hh:441
set_device_to_activate_opencl_manager
void set_device_to_activate_opencl_manager(GGEMSOpenCLManager *opencl_manager, char const *device_type, char const *device_vendor="")
Set the device index to activate.
Definition: GGEMSOpenCLManager.cc:1466
GGEMSOpenCLManager::GGEMSOpenCLManager
GGEMSOpenCLManager(GGEMSOpenCLManager const &&opencl_manager)=delete
Avoid copy of the singleton by rvalue reference.
GGEMSOpenCLManager::GetNumberDeviceLoads
GGsize GetNumberDeviceLoads(void) const
return the size of device load vector
Definition: GGEMSOpenCLManager.hh:268
GGEMSOpenCLManager::events_
std::vector< cl::Event * > events_
Definition: GGEMSOpenCLManager.hh:468
GGEMSOpenCLManager::device_extensions_
std::vector< std::string > device_extensions_
Definition: GGEMSOpenCLManager.hh:425
GGEMSOpenCLManager::GetIndexOfActivatedDevice
GGsize GetIndexOfActivatedDevice(GGsize const &thread_index) const
get the index of activated device
Definition: GGEMSOpenCLManager.hh:175
GGEMSOpenCLManager::platform_name_
std::vector< std::string > platform_name_
Definition: GGEMSOpenCLManager.hh:386
GGEMSOpenCLManager::device_image_max_buffer_size_
std::vector< GGsize > device_image_max_buffer_size_
Definition: GGEMSOpenCLManager.hh:436
GGEMSOpenCLManager::device_max_work_group_size_
std::vector< GGsize > device_max_work_group_size_
Definition: GGEMSOpenCLManager.hh:452
GGEMSOpenCLManager::kernel_compilation_options_
std::vector< std::string > kernel_compilation_options_
Definition: GGEMSOpenCLManager.hh:472
GGEMSOpenCLManager::GetCommandQueue
cl::CommandQueue * GetCommandQueue(GGsize const &thread_index) const
Return the command queue to activated context.
Definition: GGEMSOpenCLManager.hh:222
T
__constant GGfloat T
Definition: GGEMSSystemOfUnits.hh:150
GGEMSOpenCLManager::operator=
GGEMSOpenCLManager & operator=(GGEMSOpenCLManager const &&opencl_manager)=delete
Avoid copy of the singleton by rvalue reference.
GGEMSOpenCLManager::device_max_write_image_args_
std::vector< GGuint > device_max_write_image_args_
Definition: GGEMSOpenCLManager.hh:444
GGEMSOpenCLManager::device_image2D_max_height_
std::vector< GGsize > device_image2D_max_height_
Definition: GGEMSOpenCLManager.hh:439
GGfloat
#define GGfloat
Definition: GGEMSTypes.hh:273
GGEMSOpenCLManager::GetInstance
static GGEMSOpenCLManager & GetInstance(void)
Create at first time the Singleton.
Definition: GGEMSOpenCLManager.hh:72
GGEMSOpenCLManager::device_local_mem_type_
std::vector< cl_device_local_mem_type > device_local_mem_type_
Definition: GGEMSOpenCLManager.hh:433