gpucoder.atomicMax
Atomically find the maximum between value and variable in global or shared memory
Since R2021b
Description
The gpucoder.atomicMax function reads a value from a global or
shared GPU memory location, compares it to an operand, and writes the maximum value back to
the memory location. In generated GPU
code, the operation is atomic, which means that a GPU thread performs the
read-modify-write operation without interference from other threads.
[A,oldA] = gpucoder.atomicMax(
returns
the previous value of A,B)A as oldA. When you use this syntax,
use the coder.gpu.kernel pragma before the loop that contains
gpucoder.atomicMax.
Examples
Input Arguments
Extended Capabilities
Version History
Introduced in R2021b