gpucoder.atomicInc
Atomically increment a variable in global or shared memory within a specified upper bound
Since R2021b
Description
[A,oldA] = gpucoder.atomicInc(
increments the value of A
,B
)A
in global or shared memory within the upper
bound B
. If the value of A
is greater than or equal to
B
, it is reset. The operation is atomic in a sense that the entire
read-modify-write operation is guaranteed to be performed without interference from other
threads. The order of the input and output arguments must match the syntax provided.
Examples
Input Arguments
Limitations
Function handle input to the
gpucoder.stencilKernel
pragma cannot contain calls to atomic functions. For example,out1 = gpucoder.stencilKernel(@myAtomicInc,A,[3 3],'same',B);
Version History
Introduced in R2021b