Multidimensional Arrays in C++

From SHARCNETHelp
Revision as of 07:57, 1 October 2024 by Syam (talk | contribs) (Created page with "The C++ 2023 standard has std::mdspan which provides a light-weight non-owning multidimensional view of a contiguous single-dimensioned array. This enables the reinterpretatio...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search

The C++ 2023 standard has std::mdspan which provides a light-weight non-owning multidimensional view of a contiguous single-dimensioned array. This enables the reinterpretation of an underlying contiguous array as a multi-dimensional array with support for different memory layouts (e.g., C and Fortran) and accessing elements (e.g., directly, using atomics, etc.). As found in other programming languages, subset views / "slices" are also possible. One does not need to use the latest compiler tools or C++ standard: one can use mdspan using a reference implementation that has been backported to C++17 and C++14 as well with NVIDIA's CUDA and NVHPC tools. This talk will discuss how to use mdspan in C++ programs.