Kokkos
View inspection
Linaro DDT provides a pretty printer to inspect C++ Kokkos::View variables when
using Kokkos version 5.x with the CUDA device backend. The pretty printer is
used automatically to present Kokkos::View data in a more understandable
format.
The format includes the underlying data type of the view and the extent
of each dimension. Dynamic extents will be resolved at runtime. For example,
Linaro DDT will display Kokkos::View<double[10][3]> for a view that is declared as
Kokkos::View<double*[3]> v("v", 10) in the source code.
You can inspect individual Kokkos::View elements using the special
at(indices...) method provided by the pretty printer, which mirrors the
behavior of the Kokkos::View::operator(). For example, you can add the
expression v.at(1,1) in the Evaluate window to print the same
element that you would access with v(1,1) in the source code.
The at(indices...) method can also be used in tracepoint variables to log
individual view element values or in the condition expression of conditional
breakpoints.
There is partial support of the Multi-Dimensional Array Viewer
(MDA). You can use the MDA to inspect all elements of a Kokkos::View.
For example, to inspect above view enter
v.at($i,$j) as the Array Expression, then configure the
Ranges and press Evaluate. Visualizing elements of a
Kokkos::View is currently not supported. See Known issues and limitations
for a full list of known MDA limitations.
Dual View inspection
Linaro DDT allows inspecting a C++ Kokkos::DualView by expanding its attributes,
which are Kokkos::View objects using the above pretty printer.
A Kokkos::DualView has the following attributes d_view (view instance
on the device), h_view (view instance on the host) and modified_flags
(tracks host and device modification state).
For example, to inspect a device view element you can use
dual_view.d_view.at(indices...). To inspect the host or device modification
flag use dual_view.modified_flags.at(0) or dual_view.modified_flags.at(1)
respectively.
Known issues and limitations
This section provides information about known issues and limitations of debugging Kokkos codes.
Pretty printing of a
Kokkos::Viewis only supported forLayoutLeftandLayoutRight. Other built-in layouts, such asLayoutStride, and experimental layouts are not supported. For unsupported views Linaro DDT will show the internal structure of a view. If a layout is not explicitly specified in the view type definition, then Linaro DDT will assumeLayoutLeft(the default for the CUDA execution space).Element inspection of a
Kokkos::Viewusing theKokkos::Unmanagedmemory trait is not implemented.The reason that
at(indices...)is required to accessKokkos::Viewelements, instead ofoperator(), is due to an internal limitation.A
Kokkos::Viewcan only be inspected when the execution is stopped in its execution space. For example, a view defined in the CUDA execution space can only be inspected when stopped in a kernel executing on the CUDA device backend, but not when stopped in host code.The dimensions of a running Kokkos CUDA kernel might be larger than the range specified for the Kokkos kernel in the source code.
Incomplete debug information may result in the following symptoms:
A
Kokkos::Viewdeclared usingautowill likely not be pretty printed correctly. Element inspection will not function correctly.Views of a
Kokkos::DualViewwith static extents will only be pretty printed using its dynamic extents. Element inspection will not function correctly.The underlying data type of a
Kokkos::Viewmight be displayed as an internal Kokkos typedef/alias, for exampleKokkos::View<data_type>.Inspecting a
Kokkos::Viewwhile stopped in host code will show its internal structure (NVIDIA HPC Compiler only).Multi-Dimensional Array Viewer (MDA):
Ranges must be configured manually, and are not auto-detected based on
Kokkos::Viewextents.Visualizing a
Kokkos::Viewis not supported.Exporting a
Kokkos::Viewin HDF5 format is not supported.Exporting a
Kokkos::Viewin CSV format can take a long time when the number of exported elements exceeds 1000.