cuda::experimental::stf::exec_place_host

Defined in include/cuda/experimental/__stf/places/places.cuh

class exec_place_host : public cuda::experimental::stf::exec_place

Designates execution that is to run on the host.

Public Functions

inline ::std::shared_ptr<impl> make()
inline bool operator==(const exec_place &rhs) const
inline bool operator!=(const exec_place &rhs) const
inline iterator begin()
inline iterator end()
inline ::std::string to_string() const

Returns a string representation of the execution place object.

Returns

std::string

inline const data_place &affine_data_place() const

Returns the data_place naturally associated with this execution place.

inline void set_affine_data_place(data_place place)
inline stream_pool &get_stream_pool(async_resources_handle &async_resources, bool for_computation) const
inline decorated_stream getStream(async_resources_handle &async_resources, bool for_computation) const
inline const ::std::shared_ptr<impl> &get_impl() const
inline exec_place activate(backend_ctx_untyped &state) const

Set computation to run on this place.

Returns

exec_place The previous execution place. See deactivate below.

inline void deactivate(backend_ctx_untyped &state, const exec_place &p) const

Undoes the effect of activate.

Call with the previous exec_place object retured by activate.

Warning

Undefined behavior if you don’t pass the result of activate.

inline bool is_device() const
inline bool is_grid() const
inline size_t size() const
inline exec_place_grid as_grid() const
inline size_t grid_dim(int axid_is) const
inline dim4 grid_dims() const
template<typename Fun>
inline auto operator->*(Fun &&fun) const

Execute lambda on this place.

This method accepts a functor, saves the current CUDA device, changes it to the current execution place, invokes the lambda, and finally sets the current device back to the previous one. The last step is taken even if the lambda throws an exception.

Template Parameters

Fun – A callable entity type

Parameters

fun – Input functor that will be forwarded and executed

Returns

auto the result of the executed functor.

Public Static Functions

static inline exec_place device(int devid)
static inline exec_place_cuda_stream cuda_stream(cudaStream_t stream)
static inline exec_place_cuda_stream cuda_stream(const decorated_stream &dstream)
static inline exec_place current_device()

Returns the currently active device.

Returns

exec_place

static inline exec_place_grid all_devices()
static inline exec_place_grid n_devices(size_t n, dim4 dims)
static inline exec_place_grid n_devices(size_t n)
static inline exec_place_grid repeat(const exec_place &e, size_t cnt)

Public Static Attributes

static const exec_place_host host = {}
static const exec_place device_auto = {data_place::device_auto}
class impl : public cuda::experimental::stf::exec_place::impl

Public Functions

inline impl()
inline virtual exec_place activate(backend_ctx_untyped&) const override
inline virtual void deactivate(backend_ctx_untyped&, const exec_place &p) const override
inline virtual const data_place &affine_data_place() const override
inline virtual stream_pool &get_stream_pool(async_resources_handle &async_resources, bool for_computation) const override
inline ::std::string to_string() const
inline virtual bool is_device() const
inline virtual bool is_grid() const
inline virtual size_t size() const
inline virtual void set_affine_data_place(data_place place)
inline virtual bool operator==(const impl &rhs) const
inline decorated_stream getStream(async_resources_handle &async_resources, bool for_computation) const

Protected Attributes

data_place affine = data_place::invalid