diff --git a/docs/source/basic/cheatsheet.rst b/docs/source/basic/cheatsheet.rst index 21ade07e134..5295a56de5b 100644 --- a/docs/source/basic/cheatsheet.rst +++ b/docs/source/basic/cheatsheet.rst @@ -122,11 +122,6 @@ Allocate a buffer in host memory using BufHost = alpaka::Buf; BufHost bufHost = allocBuf(devHost, extent); -(Optional, affects CPU – GPU memory copies) Prepare it for asynchronous memory copies - .. code-block:: c++ - - prepareForAsyncCopy(bufHost); - Create a view to host memory represented by a pointer .. code-block:: c++ @@ -154,6 +149,18 @@ Get a raw pointer to a buffer or view initialization, etc. DataType* raw = view::getPtrNative(bufHost); DataType* rawViewPtr = view::getPtrNative(hostView); +Get the pitches (memory in bytes to the next element in the buffer along the pitch dimension) of a buffer + .. code-block:: c++ + + auto pitchBufAcc = alpaka::getPitchesInBytes(bufAcc) + auto pitchViewAcc = alpaka::getPitchesInBytes(viewAcc) + +Get a mdspan to a buffer or view initialization, etc. + .. code-block:: c++ + + auto bufMdSpan = alpaka::experimental::getMdSpan(bufAcc) + auto viewMdSpan = alpaka::experimental::getMdSpan(viewAcc) + Allocate a buffer in device memory .. code-block:: c++ @@ -216,18 +223,23 @@ Manually set a kernel launch configuration threadsPerBlock, elementsPerThread}; -Instantiate a kernel and create a task that will run it (does not launch it yet) +Instantiate a kernel (does not launch it yet) .. code-block:: c++ Kernel kernel{argumentsForConstructor}; - auto taskRunKernel = createTaskKernel(workDiv, kernel, parameters); acc parameter of the kernel is provided automatically, does not need to be specified here +Get information about the kernel from the device (size, maxThreadsPerBlock, sharedMemSize, registers, etc.) + .. code-block:: c++ + + auto kernelFunctionAttributes = alpaka::getFunctionAttributes(devAcc, kernel, parameters...); + + Put the kernel for execution .. code-block:: c++ - enqueue(queue, taskRunKernel); + exec(queue, workDiv, kernel, parameters...); Kernel Implementation --------------------- @@ -259,7 +271,12 @@ Access components of and destructure multi-dimensional indices and extents Linearize multi-dimensional vectors .. code-block:: c++ - auto linearIdx = mapIdx<1u>(idx, extent); + auto linearIdx = mapIdx<1u>(idxND, extentND); + +More generally, index multi-dimensional vectors with a different dimensionality + .. code-block:: c++ + + auto idxND = alpaka::mapIdx(idxMD, extentMD); .. raw:: pdf