mutex_array< Block, Allocator >

mutex_array< Block, Allocator >#

stdgpu: stdgpu::mutex_array< Block, Allocator >
stdgpu Latest
Efficient STL-like Data Structures on the GPU

Detailed Description

template<typename Block = mutex_default_type, typename Allocator = safe_device_allocator<Block>>
class stdgpu::mutex_array< Block, Allocator >

A class to model a mutex array on the GPU.

Template Parameters
BlockThe internal bit block type
AllocatorThe 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

Classes

class  reference
 

Public Types

using allocator_type = Allocator
 

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)