From 3d858fc587dd9492220b6c121965c42e204d4735 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Widera?= Date: Mon, 30 Sep 2024 08:37:40 +0200 Subject: [PATCH] shorten cheatsheet - change naming to reflect alpaka index order - remove comments where code can say everything --- docs/source/basic/cheatsheet.rst | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/docs/source/basic/cheatsheet.rst b/docs/source/basic/cheatsheet.rst index 7d25ef493b1..31949e49693 100644 --- a/docs/source/basic/cheatsheet.rst +++ b/docs/source/basic/cheatsheet.rst @@ -1,6 +1,10 @@ Cheatsheet ========== +.. raw:: pdf + + Spacer 0,1 + .. only:: html Download pdf version :download:`here <../../cheatsheet/cheatsheet.pdf>` @@ -18,10 +22,6 @@ General #include using namespace alpaka; -.. raw:: pdf - - Spacer 0,5 - Accelerator, Platform and Device -------------------------------- @@ -61,8 +61,7 @@ Create a queue for a device Property: .. code-block:: c++ - Blocking - NonBlocking + Blocking, NonBlocking Put a task for execution .. code-block:: c++ @@ -109,10 +108,8 @@ Allocate a buffer in host memory .. code-block:: c++ // Use alpaka vector as a static array for the extents - // If Dim is DimInt<1>; - Vec extent = value; - // If Dim is DimInt<2>; - Vec extent = {value1, value2}; + Vec, Idx> extent = value; + Vec, Idx> extent = {valueY, valueX}; // Allocate memory for the alpaka buffer, which is a dynamic array using BufHost = Buf; @@ -153,9 +150,8 @@ Get a mdspan to a buffer or view initialization, etc. .. code-block:: c++ auto bufOrViewMdSpan = experimental::getMdSpan(bufOrViewAcc) - // Accessing and setting the items of a 2D mdspan - auto value = bufOrViewMdSpan(i,j); - bufOrViewMdSpan(i,j) = value; + auto value = bufOrViewMdSpan(y,x); // access 2D mdspan + bufOrViewMdSpan(y,x) = value; // assign item to 2D mdspan Allocate a buffer in device memory .. code-block:: c++