diff --git a/doc/tutorial.rst b/doc/tutorial.rst index 4275474d9ce74e04aa3c7ae69356f0672db2128c..1bf9e39a7299bab17e09d7815730b094fc13c9d0 100644 --- a/doc/tutorial.rst +++ b/doc/tutorial.rst @@ -1063,6 +1063,24 @@ Conditionals Snippets of C ~~~~~~~~~~~~~ +Atomic operations +~~~~~~~~~~~~~~~~~ + +Loopy supports atomic operations. To use them, both the data on which the +atomic operations work as well as the operations themselves must be +suitably tagged, as in the following example:: + + + knl = lp.make_kernel( + "{ [i]: 0<=i<n }", + "out[i%20] = out[i%20] + 2*a[i] {atomic}", + [ + lp.GlobalArg("out", dtype, shape=lp.auto, for_atomic=True), + lp.GlobalArg("a", dtype, shape=lp.auto), + "..." + ], + assumptions="n>0") + .. }}} Common Problems