Main Content
gpucoder.atomicCAS
Atomically compare and swap the value of a variable in global or shared memory
Since R2021b
Description
[A,oldA] = gpucoder.atomicCAS(
compares A
,B
,C
)B
to the value of A
in global or shared
memory and if the values are the same writes the value of C
into A. 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
Version History
Introduced in R2021b