cuda::experimental::stf::exec_place_grid

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

class exec_place_grid : public cuda::experimental::stf::exec_place

Constructors

inline dim4 get_dims() const
inline int get_dim(int axis_id) const
inline size_t size() const
inline explicit operator bool() const
inline bool operator==(const exec_place_grid &rhs) const
inline ::std::ptrdiff_t current_place_id() const
inline const exec_place &get_place(pos4 p) const
inline const ::std::vector<exec_place> &get_places() const
inline void set_current_place(backend_ctx_untyped &ctx, size_t p_index)
inline const exec_place &get_current_place()
inline void set_current_place(backend_ctx_untyped &ctx, pos4 p)
inline void unset_current_place(backend_ctx_untyped &ctx)
inline ::std::shared_ptr<impl> get_impl() const
inline exec_place_grid()
inline exec_place_grid(::std::shared_ptr<impl> p)
inline exec_place_grid(::std::vector<exec_place> p, const dim4 &d)

Public Functions

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 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 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(::std::vector<exec_place> _places)
inline impl(::std::vector<exec_place> _places, const dim4 &_dims)
inline ::std::string to_string() const final
inline virtual exec_place activate(backend_ctx_untyped&) const override
inline virtual void deactivate(backend_ctx_untyped&, const exec_place &_prev) const override
inline virtual bool is_device() const override
inline virtual bool is_grid() const override
inline virtual bool operator==(const exec_place::impl &rhs) const override
inline bool operator==(const impl &rhs) const
inline const ::std::vector<exec_place> &get_places() const
inline exec_place grid_activate(backend_ctx_untyped &ctx, size_t i) const
inline void grid_deactivate(backend_ctx_untyped &ctx, size_t i, exec_place p) const
inline const exec_place &get_current_place()
inline void set_current_place(backend_ctx_untyped &ctx, size_t p_index)
inline void set_current_place(backend_ctx_untyped &ctx, pos4 p)
inline void unset_current_place(backend_ctx_untyped &ctx)
inline ::std::ptrdiff_t current_place_id() const
inline dim4 get_dims() const
inline int get_dim(int axis_id) const
inline virtual size_t size() const override
inline const exec_place &get_place(pos4 p) const
inline const exec_place &get_place(size_t p_index) const
inline virtual stream_pool &get_stream_pool(async_resources_handle &async_resources, bool for_computation) const override
inline virtual const data_place &affine_data_place() const
inline virtual void set_affine_data_place(data_place place)
inline decorated_stream getStream(async_resources_handle &async_resources, bool for_computation) const

Protected Attributes

data_place affine = data_place::invalid