Class GridBarrier

Class Documentation

class GridBarrier

Provides Grid-Level Synchronization of thread blocks.

Public Types

using Counter = atomic<unsigned int, MemoryScope::AGENT>

Public Functions

GridBarrier()

Default constructor.

GridBarrier(unique_ptr<Counter[]> counters)

Constructor.

Parameters:

counters – Counters allocated by AllocateCounters/AllocateCountersHost

__device__ __forceinline__ void Sync () const

Performs synchronization (blocks until all thread blocks have gotten here)

Public Static Functions

static unique_ptr<Counter[]> AllocateCounters(unsigned int num_blocks, int hip_dev)

Allocates and initializes counters in memory backing device hip_dev.

Parameters:
  • num_blocks – number of thread blocks in grid

  • hip_dev – Device where to allocate the counters

static unique_ptr<Counter[]> AllocateCountersHost(unsigned int num_blocks)

Allocates and initializes counters in host memory.

Parameters:

num_blocks – number of thread blocks in grid