stdgpu: stdgpu::mutex_array< Block, Allocator > — stdgpu Latest documentation (original) (raw)
mutex_array< Block, Allocator >#
stdgpu: stdgpu::mutex_array< Block, Allocator >
stdgpu Latest
Efficient STL-like Data Structures on the GPU
- stdgpu
- mutex_array
template<typename Block = mutex_default_type, typename Allocator = safe_device_allocator>
class stdgpu::mutex_array< Block, Allocator >
A class to model a mutex array on the GPU.
Template Parameters
| Block | The internal bit block type |
|---|---|
| Allocator | The allocator type |
Differences to std::mutex:
- Mutexes must be modeled as containers since threads have to call the exact same object
- Manual allocation and destruction of container required
- No guaranteed valid state
- Blocking lock is not supported
| Public Member Functions | |
|---|---|
| mutex_array () noexcept=default | |
| STDGPU_HOST_DEVICE bool | empty () const noexcept |
| STDGPU_HOST_DEVICE allocator_type | get_allocator () const noexcept |
| STDGPU_DEVICE_ONLY reference | operator[] (const index_t n) |
| STDGPU_DEVICE_ONLY const reference | operator[] (const index_t n) const |
| STDGPU_HOST_DEVICE index_t | size () const noexcept |
| bool | valid () const |
| template<typename ExecutionPolicy , STDGPU_DETAIL_OVERLOAD_IF(is_execution_policy_v< remove_cvref_t< ExecutionPolicy > >) > | |
| bool | valid (ExecutionPolicy &&policy) const |
| Static Public Member Functions | |
|---|---|
| static mutex_array | createDeviceObject (const index_t &size, const Allocator &allocator=Allocator()) |
| template<typename ExecutionPolicy , STDGPU_DETAIL_OVERLOAD_IF(is_execution_policy_v< remove_cvref_t< ExecutionPolicy > >) > | |
| static mutex_array | createDeviceObject (ExecutionPolicy &&policy, const index_t &size, const Allocator &allocator=Allocator()) |
| template<typename ExecutionPolicy , STDGPU_DETAIL_OVERLOAD_IF(is_execution_policy_v< remove_cvref_t< ExecutionPolicy > >) > | |
| static void | destroyDeviceObject (ExecutionPolicy &&policy, mutex_array &device_object) |
| static void | destroyDeviceObject (mutex_array &device_object) |