Skip to content

Commit

Permalink
shorten cheatsheet
Browse files Browse the repository at this point in the history
- change naming to reflect alpaka index order
- remove comments where code can say everything
  • Loading branch information
psychocoderHPC committed Sep 30, 2024
1 parent e3cc330 commit 3d858fc
Showing 1 changed file with 9 additions and 13 deletions.
22 changes: 9 additions & 13 deletions docs/source/basic/cheatsheet.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
Cheatsheet
==========

.. raw:: pdf
Spacer 0,1
.. only:: html

Download pdf version :download:`here <../../cheatsheet/cheatsheet.pdf>`
Expand All @@ -18,10 +22,6 @@ General
#include <alpaka/alpaka.hpp>
using namespace alpaka;

.. raw:: pdf
Spacer 0,5
Accelerator, Platform and Device
--------------------------------

Expand Down Expand Up @@ -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++
Expand Down Expand Up @@ -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<Dim, Idx> extent = value;
// If Dim is DimInt<2>;
Vec<Dim, Idx> extent = {value1, value2};
Vec<DimInt<1>, Idx> extent = value;
Vec<DimInt<2>, Idx> extent = {valueY, valueX};

// Allocate memory for the alpaka buffer, which is a dynamic array
using BufHost = Buf<DevHost, DataType, Dim, Idx>;
Expand Down Expand Up @@ -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++
Expand Down

0 comments on commit 3d858fc

Please sign in to comment.