Update Kokkos library to v2.7.00
This commit is contained in:
@ -145,46 +145,48 @@ int main (int narg, char* arg[]) {
|
||||
|
||||
Kokkos::initialize (narg, arg);
|
||||
|
||||
// The number of mesh points along each dimension of the mesh, not
|
||||
// including boundaries.
|
||||
const size_type size = 100;
|
||||
{
|
||||
// The number of mesh points along each dimension of the mesh, not
|
||||
// including boundaries.
|
||||
const size_type size = 100;
|
||||
|
||||
// A is the full cubic 3-D mesh, including the boundaries.
|
||||
mesh_type A ("A", size+2, size+2, size+2);
|
||||
// Ai is the "inner" part of A, _not_ including the boundaries.
|
||||
//
|
||||
// A pair of indices in a particular dimension means the contiguous
|
||||
// zero-based index range in that dimension, including the first
|
||||
// entry of the pair but _not_ including the second entry.
|
||||
inner_mesh_type Ai = subview(A, pair<size_type, size_type> (1, size+1),
|
||||
pair<size_type, size_type> (1, size+1),
|
||||
pair<size_type, size_type> (1, size+1));
|
||||
// A has six boundaries, one for each face of the cube.
|
||||
// Create a View of each of these boundaries.
|
||||
// ALL() means "select all indices in that dimension."
|
||||
xy_plane_type Zneg_halo = subview(A, ALL (), ALL (), 0);
|
||||
xy_plane_type Zpos_halo = subview(A, ALL (), ALL (), 101);
|
||||
xz_plane_type Yneg_halo = subview(A, ALL (), 0, ALL ());
|
||||
xz_plane_type Ypos_halo = subview(A, ALL (), 101, ALL ());
|
||||
yz_plane_type Xneg_halo = subview(A, 0, ALL (), ALL ());
|
||||
yz_plane_type Xpos_halo = subview(A, 101, ALL (), ALL ());
|
||||
// A is the full cubic 3-D mesh, including the boundaries.
|
||||
mesh_type A ("A", size+2, size+2, size+2);
|
||||
// Ai is the "inner" part of A, _not_ including the boundaries.
|
||||
//
|
||||
// A pair of indices in a particular dimension means the contiguous
|
||||
// zero-based index range in that dimension, including the first
|
||||
// entry of the pair but _not_ including the second entry.
|
||||
inner_mesh_type Ai = subview(A, pair<size_type, size_type> (1, size+1),
|
||||
pair<size_type, size_type> (1, size+1),
|
||||
pair<size_type, size_type> (1, size+1));
|
||||
// A has six boundaries, one for each face of the cube.
|
||||
// Create a View of each of these boundaries.
|
||||
// ALL() means "select all indices in that dimension."
|
||||
xy_plane_type Zneg_halo = subview(A, ALL (), ALL (), 0);
|
||||
xy_plane_type Zpos_halo = subview(A, ALL (), ALL (), 101);
|
||||
xz_plane_type Yneg_halo = subview(A, ALL (), 0, ALL ());
|
||||
xz_plane_type Ypos_halo = subview(A, ALL (), 101, ALL ());
|
||||
yz_plane_type Xneg_halo = subview(A, 0, ALL (), ALL ());
|
||||
yz_plane_type Xpos_halo = subview(A, 101, ALL (), ALL ());
|
||||
|
||||
// Set the boundaries to their initial conditions.
|
||||
parallel_for (Zneg_halo.extent(0), set_boundary<xy_plane_type> (Zneg_halo, 1));
|
||||
parallel_for (Zpos_halo.extent(0), set_boundary<xy_plane_type> (Zpos_halo, -1));
|
||||
parallel_for (Yneg_halo.extent(0), set_boundary<xz_plane_type> (Yneg_halo, 2));
|
||||
parallel_for (Ypos_halo.extent(0), set_boundary<xz_plane_type> (Ypos_halo, -2));
|
||||
parallel_for (Xneg_halo.extent(0), set_boundary<yz_plane_type> (Xneg_halo, 3));
|
||||
parallel_for (Xpos_halo.extent(0), set_boundary<yz_plane_type> (Xpos_halo, -3));
|
||||
// Set the boundaries to their initial conditions.
|
||||
parallel_for (Zneg_halo.extent(0), set_boundary<xy_plane_type> (Zneg_halo, 1));
|
||||
parallel_for (Zpos_halo.extent(0), set_boundary<xy_plane_type> (Zpos_halo, -1));
|
||||
parallel_for (Yneg_halo.extent(0), set_boundary<xz_plane_type> (Yneg_halo, 2));
|
||||
parallel_for (Ypos_halo.extent(0), set_boundary<xz_plane_type> (Ypos_halo, -2));
|
||||
parallel_for (Xneg_halo.extent(0), set_boundary<yz_plane_type> (Xneg_halo, 3));
|
||||
parallel_for (Xpos_halo.extent(0), set_boundary<yz_plane_type> (Xpos_halo, -3));
|
||||
|
||||
// Set the interior of the mesh to its initial condition.
|
||||
parallel_for (Ai.extent(0), set_inner<inner_mesh_type> (Ai, 0));
|
||||
// Set the interior of the mesh to its initial condition.
|
||||
parallel_for (Ai.extent(0), set_inner<inner_mesh_type> (Ai, 0));
|
||||
|
||||
// Update the interior of the mesh.
|
||||
// This simulates one timestep with dt = 0.1.
|
||||
parallel_for (Ai.extent(0), update<mesh_type> (A, 0.1));
|
||||
// Update the interior of the mesh.
|
||||
// This simulates one timestep with dt = 0.1.
|
||||
parallel_for (Ai.extent(0), update<mesh_type> (A, 0.1));
|
||||
|
||||
printf ("Done\n");
|
||||
printf ("Done\n");
|
||||
}
|
||||
Kokkos::finalize ();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user