Celeritas  0.5.0-56+6b053cd
Functions
Atomics.hh File Reference

Atomics for use in kernel code (CUDA/HIP/OpenMP). More...

#include "corecel/Assert.hh"
#include "corecel/Macros.hh"
#include "corecel/Types.hh"
#include "Algorithms.hh"
This graph shows which files directly or indirectly include this file:

Functions

template<class T >
CELER_FORCEINLINE_FUNCTIONceleritas::atomic_add (T *address, T value)
 Add to a value, returning the original value. More...
 
template<class T >
CELER_FORCEINLINE_FUNCTIONceleritas::atomic_min (T *address, T value)
 Set the value to the minimum of the actual and given, returning old.
 
template<class T >
CELER_FORCEINLINE_FUNCTIONceleritas::atomic_max (T *address, T value)
 Set the value to the maximum of the actual and given, returning old.
 

Detailed Description

Atomics for use in kernel code (CUDA/HIP/OpenMP).

Function Documentation

◆ atomic_add()

template<class T >
CELER_FORCEINLINE_FUNCTION T celeritas::atomic_add ( T *  address,
value 
)

Add to a value, returning the original value.

Note that on CPU, this assumes the atomic add is being done in with track-level parallelism rather than event-level because these utilities are meant for "kernel" code.

Warning
Multiple events must not use this function to simultaneously modify shared data.