Particle::value_type subtype using OpenCL.
More...
#include <vsmc/internal/forward.hpp>
|
| StateCL (size_type N) |
|
template<typename CharT , typename Traits > |
void | build (const std::string &source, const std::string &flags, std::basic_ostream< CharT, Traits > &os) |
| Build the OpenCL program from source. More...
|
|
void | build (const std::string &source, const std::string &flags=std::string()) |
|
template<typename CharT , typename Traits > |
void | build (const ::cl::Program &program, const std::string &flags, std::basic_ostream< CharT, Traits > &os) |
| Build from an existing program. More...
|
|
void | build (const ::cl::Program &program, const std::string &flags=std::string()) |
|
bool | build () const |
| Whether the last attempted building success. More...
|
|
int | build_id () const |
| The build id of the last attempted of building. More...
|
|
template<typename IntType > |
void | copy (std::size_t N, const IntType *copy_from) |
|
CLConfigure & | copy_configure () |
|
const CLConfigure & | copy_configure () const |
|
::cl::Kernel & | copy_kernel () |
|
const ::cl::Kernel & | copy_kernel () const |
|
void | copy_post_processor () |
|
void | copy_pre_processor () |
|
::cl::Kernel | create_kernel (const std::string &name) const |
| Create kernel with the current program. More...
|
|
const ::cl::Program & | program () const |
| The OpenCL program associated with this value collection. More...
|
|
void | resize_state (std::size_t state_size) |
| Change state size. More...
|
|
size_type | size () const |
|
const CLBuffer< char, ID > & | state_buffer () const |
| The OpenCL buffer that stores the state values. More...
|
|
state_pack_type | state_pack (size_type id) const |
|
std::size_t | state_size () const |
|
void | state_unpack (size_type id, const state_pack_type &pack) |
|
void | update_state (::cl_mem_flags flag) |
| Change state buffer flag (cause reallocation) More...
|
|
void | update_state (::cl_mem_flags flag, void *host_ptr) |
| Change state buffer flag and host pointer (cause reallocation) More...
|
|
template<std::size_t StateSize, typename FPType, typename ID>
class vsmc::StateCL< StateSize, FPType, ID >
Particle::value_type subtype using OpenCL.
Definition at line 76 of file forward.hpp.
template<std::size_t StateSize, typename FPType, typename ID>
template<std::size_t StateSize, typename FPType, typename ID>
template<std::size_t StateSize, typename FPType, typename ID>
template<std::size_t StateSize, typename FPType, typename ID>
template<std::size_t StateSize, typename FPType, typename ID>
template<std::size_t StateSize, typename FPType, typename ID>
template<std::size_t StateSize, typename FPType, typename ID>
template<typename CharT , typename Traits >
void vsmc::StateCL< StateSize, FPType, ID >::build |
( |
const std::string & |
source, |
|
|
const std::string & |
flags, |
|
|
std::basic_ostream< CharT, Traits > & |
os |
|
) |
| |
|
inline |
Build the OpenCL program from source.
- Parameters
-
source | The source of the program |
flags | The OpenCL compiler flags, e.g., -I |
os | The output stream to write the output when error occurs |
Note that a few macros are defined before the user supplied source
. Say the template parameter StateSize == 4
, FPType
of this class is set to cl_float
, and there are 1000
particles, then the complete source, which acutally get compiled looks like the following
#ifndef FP_TYPE
#define FP_TYPE float
#endif
#ifndef VSMC_HAS_OPENCL_DOUBLE
#define VSMC_HAS_OPENCL_DOUBLE 0
#endif
#ifndef SIZE
#define SIZE 1000UL;
#endif
#ifndef STATE_SIZE
#define STATE_SIZE 4UL;
#endif
#ifndef SEED
#define SEED 101UL;
#endif
After build, vsmc::Seed::instance().skip(N)
is called with N
being the nubmer of particles.
Definition at line 345 of file backend_cl.hpp.
template<std::size_t StateSize, typename FPType, typename ID>
void vsmc::StateCL< StateSize, FPType, ID >::build |
( |
const std::string & |
source, |
|
|
const std::string & |
flags = std::string() |
|
) |
| |
|
inline |
template<std::size_t StateSize, typename FPType, typename ID>
template<typename CharT , typename Traits >
void vsmc::StateCL< StateSize, FPType, ID >::build |
( |
const ::cl::Program & |
program, |
|
|
const std::string & |
flags, |
|
|
std::basic_ostream< CharT, Traits > & |
os |
|
) |
| |
|
inline |
template<std::size_t StateSize, typename FPType, typename ID>
void vsmc::StateCL< StateSize, FPType, ID >::build |
( |
const ::cl::Program & |
program, |
|
|
const std::string & |
flags = std::string() |
|
) |
| |
|
inline |
template<std::size_t StateSize, typename FPType, typename ID>
Whether the last attempted building success.
Definition at line 375 of file backend_cl.hpp.
template<std::size_t StateSize, typename FPType, typename ID>
The build id of the last attempted of building.
This function returns a non-decreasing sequence of integers
Definition at line 381 of file backend_cl.hpp.
template<std::size_t StateSize, typename FPType, typename ID>
template<typename IntType >
void vsmc::StateCL< StateSize, FPType, ID >::copy |
( |
std::size_t |
N, |
|
|
const IntType * |
copy_from |
|
) |
| |
|
inline |
template<std::size_t StateSize, typename FPType, typename ID>
template<std::size_t StateSize, typename FPType, typename ID>
template<std::size_t StateSize, typename FPType, typename ID>
::cl::Kernel& vsmc::StateCL< StateSize, FPType, ID >::copy_kernel |
( |
| ) |
|
|
inline |
template<std::size_t StateSize, typename FPType, typename ID>
const ::cl::Kernel& vsmc::StateCL< StateSize, FPType, ID >::copy_kernel |
( |
| ) |
const |
|
inline |
template<std::size_t StateSize, typename FPType, typename ID>
void vsmc::StateCL< StateSize, FPType, ID >::copy_post_processor |
( |
| ) |
|
|
inline |
template<std::size_t StateSize, typename FPType, typename ID>
void vsmc::StateCL< StateSize, FPType, ID >::copy_pre_processor |
( |
| ) |
|
|
inline |
template<std::size_t StateSize, typename FPType, typename ID>
::cl::Kernel vsmc::StateCL< StateSize, FPType, ID >::create_kernel |
( |
const std::string & |
name | ) |
const |
|
inline |
Create kernel with the current program.
If build() does not return true
, then calling this is an error
Definition at line 387 of file backend_cl.hpp.
template<std::size_t StateSize, typename FPType, typename ID>
template<std::size_t StateSize, typename FPType, typename ID>
const ::cl::Program& vsmc::StateCL< StateSize, FPType, ID >::program |
( |
| ) |
const |
|
inline |
The OpenCL program associated with this value collection.
Definition at line 305 of file backend_cl.hpp.
template<std::size_t StateSize, typename FPType, typename ID>
void vsmc::StateCL< StateSize, FPType, ID >::resize_state |
( |
std::size_t |
state_size | ) |
|
|
inline |
template<std::size_t StateSize, typename FPType, typename ID>
template<std::size_t StateSize, typename FPType, typename ID>
The OpenCL buffer that stores the state values.
Definition at line 302 of file backend_cl.hpp.
template<std::size_t StateSize, typename FPType, typename ID>
template<std::size_t StateSize, typename FPType, typename ID>
std::size_t vsmc::StateCL< StateSize, FPType, ID >::state_size |
( |
| ) |
const |
|
inline |
template<std::size_t StateSize, typename FPType, typename ID>
template<std::size_t StateSize, typename FPType, typename ID>
Change state buffer flag (cause reallocation)
Definition at line 290 of file backend_cl.hpp.
template<std::size_t StateSize, typename FPType, typename ID>
Change state buffer flag and host pointer (cause reallocation)
Definition at line 294 of file backend_cl.hpp.