In this exercise, you will learn how to use and manage basic Kokkos Views.
Open the file main.cpp that will be used for this exercise.
Create a 3D Kokkos View of size Nx x Ny x Nz of type double:
Kokkos::View<double***> matrix("matrix", Nx, Ny, Nz);Call the rank method to get the number of dimensions of the View and store it in a variable rank.
Add the code to print it in the terminal, for instance:
std::cout << "Matrix rank: " << rank << std::endl;Call the extent method to get the size of each dimension of the View
Add the code to print it in the terminal.
Call the stride method to get the stride of each dimension of the View
Add the code to print it in the terminal.
Compile the program using the OpenMP backend and run it. Check the output.
Deduce from the stride the layout of the View.
If you have access to a GPU, compile the program using a GPU backend and run it. Check the output and compare them with the OpenMP backend.