From b320b9c5d1f62650dbe3205ce1e887cd4e02f338 Mon Sep 17 00:00:00 2001 From: Andreas Kloeckner <inform@tiker.net> Date: Tue, 22 Mar 2016 09:22:14 -0500 Subject: [PATCH] Add atomic ops to tutorial --- doc/tutorial.rst | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/doc/tutorial.rst b/doc/tutorial.rst index 4275474d9..1bf9e39a7 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 -- GitLab