Skip to content

Cookbook ​

Short answers to "how do I ...?". Each recipe shows the code and its real output; the reference has the details. The programs are in docs/examples/src: one per page, the recipe chosen by the command line argument.

PageRecipes
Device memorycustom bounds and an initial value, other kinds, resizing, allocate-and-copy keeping the bounds, transposed copies, counting the allocations
Kernelsnested loops, reductions, an iterative solver with swapped buffers, kernels in procedures, mapped arrays in procedures
MPIone device per rank, a global sum of device results, a halo exchange
Debuggingwhere the run happens, leaks, double frees, a wrong dev_id, making misuse fatal