Analysis Software
Documentation for sPHENIX simulation software
|
#include <JETSCAPE/blob/main/external_packages/clvisc_wrapper/include/opencl_backend.h>
Public Member Functions | |
OpenclBackend (std::string device_type, int device_id) | |
cl::Program | BuildProgram (std::string fname, const std::string &option) |
cl::Kernel | CreateKernel (const cl::Program &prg, std::string func_name) |
cl::Context | Context () |
cl::CommandQueue | Queue () |
void | DeviceInfo () |
cl_int | DeviceType () |
float | ExcutionTime (cl::Event &event) |
cl::Buffer | CreateBuffer (size_t bytes_of_buffer) |
cl::Image2D | CreateImage2DByCopyVector (std::vector< cl_float4 > &source_vector, size_t width, size_t height, bool read_only) |
template<typename ValueType > | |
cl::Buffer | CreateBufferByCopyVector (std::vector< ValueType > &source_vector, bool read_only) |
void | enqueue_run (const cl::Kernel &kernel_, const cl::NDRange &global_size, const cl::NDRange &local_size) |
template<typename ValueType > | |
void | enqueue_copy (const std::vector< ValueType > &src_vector, cl::Buffer &dst_buffer) |
template<typename ValueType > | |
void | enqueue_copy (const cl::Buffer &src_buffer, std::vector< ValueType > &dst_vector) |
void | enqueue_copy (const cl::Buffer &src_buffer, cl::Buffer &dst_buffer, size_t size) |
Public Attributes | |
cl::Context | context_ |
cl::CommandQueue | queue_ |
std::map< std::string, cl::Program > | programs |
std::map< std::string, cl::Kernel > | kernel_funcs |
std::map< std::string, cl::Buffer > | buffers |
Private Member Functions | |
cl::Context | CreateContext_ (const cl_int &device_type) |
Private Attributes | |
cl_int | device_type_ |
std::vector< cl::Device > | devices_ |
cl_int | device_id_ |
cl::Device | device_ |
Definition at line 66 of file opencl_backend.h.
View newest version in sPHENIX GitHub at line 66 of file opencl_backend.h
clvisc::OpenclBackend::OpenclBackend | ( | std::string | device_type, |
int | device_id | ||
) |
Definition at line 67 of file opencl_backend.cc.
View newest version in sPHENIX GitHub at line 67 of file opencl_backend.cc
References context_, CreateContext_(), device_, device_id_, device_type_, DeviceInfo(), devices_, cl::Context::getInfo(), and queue_.
cl::Program clvisc::OpenclBackend::BuildProgram | ( | std::string | fname, |
const std::string & | option | ||
) |
helper functions: Build each program in programs vector with given options
Definition at line 131 of file opencl_backend.cc.
View newest version in sPHENIX GitHub at line 131 of file opencl_backend.cc
References context_, device_, devices_, check_license::err(), and tgeo-response2json::prog.
Referenced by clvisc::BulkInfo::BulkInfo(), clvisc::CLIdeal::CLIdeal(), and clvisc::CLVisc::CLVisc().
|
inline |
return gpu context
Definition at line 89 of file opencl_backend.h.
View newest version in sPHENIX GitHub at line 89 of file opencl_backend.h
References context_.
cl::Buffer clvisc::OpenclBackend::CreateBuffer | ( | size_t | bytes_of_buffer | ) |
create a buffer on GPU, e.g., for one cl_real array of N elements, the bytes_of_buffer = N * sizeof(cl_real)
Definition at line 154 of file opencl_backend.cc.
View newest version in sPHENIX GitHub at line 154 of file opencl_backend.cc
References context_.
Referenced by clvisc::BulkInfo::BulkInfo(), clvisc::CLVisc::initialize_gpu_buffer_(), and clvisc::CLIdeal::initialize_gpu_buffer_().
template cl::Buffer clvisc::OpenclBackend::CreateBufferByCopyVector | ( | std::vector< ValueType > & | source_vector, |
bool | read_only | ||
) |
create a buffer on GPU, with the same size and content as source_vector Notice: the cl.hpp does not support creating buffers from (const void *); so one can not use const std::vector<ValueType> & source_vector here
Definition at line 159 of file opencl_backend.cc.
View newest version in sPHENIX GitHub at line 159 of file opencl_backend.cc
References context_.
Referenced by clvisc::CLVisc::initialize_gpu_buffer_(), and clvisc::CLIdeal::initialize_gpu_buffer_().
|
private |
helper functions: create context from the device type with one platform which support it
Definition at line 103 of file opencl_backend.cc.
View newest version in sPHENIX GitHub at line 103 of file opencl_backend.cc
References cl::Platform::get(), i, and j.
Referenced by OpenclBackend().
cl::Image2D clvisc::OpenclBackend::CreateImage2DByCopyVector | ( | std::vector< cl_float4 > & | source_vector, |
size_t | width, | ||
size_t | height, | ||
bool | read_only | ||
) |
create a image2d_t buffer on GPU by copying host point
Definition at line 171 of file opencl_backend.cc.
View newest version in sPHENIX GitHub at line 171 of file opencl_backend.cc
References context_.
Referenced by clvisc::CLIdeal::read_eos_table_().
|
inline |
Definition at line 84 of file opencl_backend.h.
View newest version in sPHENIX GitHub at line 84 of file opencl_backend.h
void clvisc::OpenclBackend::DeviceInfo | ( | ) |
printout the available devices
Definition at line 254 of file opencl_backend.cc.
View newest version in sPHENIX GitHub at line 254 of file opencl_backend.cc
References devices_.
Referenced by OpenclBackend().
cl_int clvisc::OpenclBackend::DeviceType | ( | ) |
printout the device type, CL_DEVICE_TYPE_CPU or CL_DEVICE_TYPE_GPU
Definition at line 278 of file opencl_backend.cc.
View newest version in sPHENIX GitHub at line 278 of file opencl_backend.cc
References device_type_.
Referenced by clvisc::CLIdeal::CLIdeal(), and clvisc::CLIdeal::max_energy_density().
void clvisc::OpenclBackend::enqueue_copy | ( | const std::vector< ValueType > & | src_vector, |
cl::Buffer & | dst_buffer | ||
) |
Definition at line 204 of file opencl_backend.cc.
View newest version in sPHENIX GitHub at line 204 of file opencl_backend.cc
References cl::CommandQueue::enqueueWriteBuffer(), event, and queue_.
Referenced by clvisc::BulkInfo::add_data(), clvisc::CLVisc::evolve(), and clvisc::CLIdeal::max_energy_density().
void clvisc::OpenclBackend::enqueue_copy | ( | const cl::Buffer & | src_buffer, |
std::vector< ValueType > & | dst_vector | ||
) |
Definition at line 221 of file opencl_backend.cc.
View newest version in sPHENIX GitHub at line 221 of file opencl_backend.cc
References cl::CommandQueue::enqueueReadBuffer(), event, and queue_.
void clvisc::OpenclBackend::enqueue_copy | ( | const cl::Buffer & | src_buffer, |
cl::Buffer & | dst_buffer, | ||
size_t | size | ||
) |
Definition at line 237 of file opencl_backend.cc.
View newest version in sPHENIX GitHub at line 237 of file opencl_backend.cc
References cl::CommandQueue::enqueueCopyBuffer(), event, and queue_.
void clvisc::OpenclBackend::enqueue_run | ( | const cl::Kernel & | kernel_, |
const cl::NDRange & | global_size, | ||
const cl::NDRange & | local_size | ||
) |
Definition at line 187 of file opencl_backend.cc.
View newest version in sPHENIX GitHub at line 187 of file opencl_backend.cc
References cl::CommandQueue::enqueueNDRangeKernel(), event, cl::NullRange, and queue_.
Referenced by clvisc::BulkInfo::add_data(), clvisc::CLIdeal::half_step_(), clvisc::CLVisc::half_step_israel_stewart_(), clvisc::CLVisc::half_step_visc_(), clvisc::CLVisc::israel_stewart_initialize_(), clvisc::CLIdeal::max_energy_density(), and clvisc::CLVisc::update_udiff_().
float clvisc::OpenclBackend::ExcutionTime | ( | cl::Event & | event | ) |
utility to compute the excution time of one event
get the kernel excution time in units of seconds
Definition at line 94 of file opencl_backend.cc.
View newest version in sPHENIX GitHub at line 94 of file opencl_backend.cc
|
inline |
return command queue
Definition at line 92 of file opencl_backend.h.
View newest version in sPHENIX GitHub at line 92 of file opencl_backend.h
References queue_.
std::map<std::string, cl::Buffer> clvisc::OpenclBackend::buffers |
Definition at line 77 of file opencl_backend.h.
View newest version in sPHENIX GitHub at line 77 of file opencl_backend.h
cl::Context clvisc::OpenclBackend::context_ |
Definition at line 72 of file opencl_backend.h.
View newest version in sPHENIX GitHub at line 72 of file opencl_backend.h
Referenced by BuildProgram(), Context(), CreateBuffer(), CreateBufferByCopyVector(), CreateImage2DByCopyVector(), and OpenclBackend().
|
private |
Definition at line 134 of file opencl_backend.h.
View newest version in sPHENIX GitHub at line 134 of file opencl_backend.h
Referenced by BuildProgram(), and OpenclBackend().
|
private |
Definition at line 133 of file opencl_backend.h.
View newest version in sPHENIX GitHub at line 133 of file opencl_backend.h
Referenced by OpenclBackend().
|
private |
Definition at line 131 of file opencl_backend.h.
View newest version in sPHENIX GitHub at line 131 of file opencl_backend.h
Referenced by DeviceType(), and OpenclBackend().
|
private |
Definition at line 132 of file opencl_backend.h.
View newest version in sPHENIX GitHub at line 132 of file opencl_backend.h
Referenced by BuildProgram(), DeviceInfo(), and OpenclBackend().
std::map<std::string, cl::Kernel> clvisc::OpenclBackend::kernel_funcs |
Definition at line 76 of file opencl_backend.h.
View newest version in sPHENIX GitHub at line 76 of file opencl_backend.h
std::map<std::string, cl::Program> clvisc::OpenclBackend::programs |
Definition at line 75 of file opencl_backend.h.
View newest version in sPHENIX GitHub at line 75 of file opencl_backend.h
cl::CommandQueue clvisc::OpenclBackend::queue_ |
Definition at line 73 of file opencl_backend.h.
View newest version in sPHENIX GitHub at line 73 of file opencl_backend.h
Referenced by enqueue_copy(), enqueue_run(), OpenclBackend(), and Queue().