Cuda battery library
Loading...
Searching...
No Matches
group.hpp File Reference
#include "utility.hpp"

Go to the source code of this file.

Classes

struct  battery::Sequential

Namespaces

namespace  battery

Detailed Description

Groups of threads executing a collective operation together, with the same interface for the current thread, a warp, a block, the warps of a block and a grid.

A group provides rank(), size(), bool any_sync(bool p), a barrier returning the logical or of p over all its threads, and sync(), a plain barrier. For instance, the loop for(int k = g.rank(); k < n; k += g.size()) splits the iterations 0, ..., n-1 among the members of the group g.

Group Threads any_sync
Sequential the current thread none
ThisBlock the threads of the block __syncthreads_or
WarpsOfBlock the warps of the block __syncthreads_or
ThisWarp the lanes of the warp __any_sync
GridGroup the threads of the grid __syncthreads_or and grid.sync()

Synchronization convention for the collective methods of an object, i.e., the methods called by all the threads of a group: A collective method does not synchronize the threads when it returns: add a barrier before reading its results. It does not synchronize on entry either: the caller guarantees that all the threads have exited the other methods of the same object (e.g., with a barrier) before calling it.