16#ifndef CABANA_GRID_HALO_HPP
17#define CABANA_GRID_HALO_HPP
24#include <Kokkos_Core.hpp>
25#include <Kokkos_Profiling_ScopedRegion.hpp>
43template <std::
size_t NumSpaceDim>
58 setNeighbors(
const std::vector<std::array<int, num_space_dim>>& neighbors )
60 _neighbors = neighbors;
70 std::vector<std::array<int, num_space_dim>> _neighbors;
75template <std::
size_t NumSpaceDim>
81class NodeHaloPattern<3> :
public HaloPattern<3>
87 std::vector<std::array<int, 3>> neighbors;
88 neighbors.reserve( 26 );
89 for (
int i = -1; i < 2; ++i )
90 for (
int j = -1; j < 2; ++j )
91 for (
int k = -1; k < 2; ++k )
92 if ( !( i == 0 && j == 0 && k == 0 ) )
93 neighbors.push_back( { i, j, k } );
101class NodeHaloPattern<2> :
public HaloPattern<2>
107 std::vector<std::array<int, 2>> neighbors;
108 neighbors.reserve( 8 );
109 for (
int i = -1; i < 2; ++i )
110 for (
int j = -1; j < 2; ++j )
111 if ( !( i == 0 && j == 0 ) )
112 neighbors.push_back( { i, j } );
119template <std::
size_t NumSpaceDim>
125class FaceHaloPattern<3> :
public HaloPattern<3>
131 std::vector<std::array<int, 3>> neighbors = {
132 { -1, 0, 0 }, { 1, 0, 0 }, { 0, -1, 0 },
133 { 0, 1, 0 }, { 0, 0, -1 }, { 0, 0, 1 } };
141class FaceHaloPattern<2> :
public HaloPattern<2>
147 std::vector<std::array<int, 2>> neighbors = {
148 { -1, 0 }, { 1, 0 }, { 0, -1 }, { 0, 1 } };
156namespace ScatterReduce
199template <
class MemorySpace>
215 template <
class Pattern,
class... ArrayTypes>
216 Halo(
const Pattern& pattern,
const int width,
const ArrayTypes&... arrays )
219 const std::size_t num_space_dim = Pattern::num_space_dim;
225 auto neighbor_id = [](
const std::array<int, num_space_dim>& ijk )
228 for ( std::size_t d = 1; d < num_space_dim; ++d )
229 id += num_space_dim *
id + ijk[d];
235 auto flip_id = [=](
const std::array<int, num_space_dim>& ijk )
237 std::array<int, num_space_dim> flip_ijk;
238 for ( std::size_t d = 0; d < num_space_dim; ++d )
239 flip_ijk[d] = -ijk[d];
246 auto neighbors = pattern.getNeighbors();
247 for (
const auto& n : neighbors )
250 int rank = local_grid->neighborRank( n );
256 _neighbor_ranks.push_back( rank );
260 _send_tags.push_back( neighbor_id( n ) );
264 _receive_tags.push_back( neighbor_id( flip_id( n ) ) );
272 _ghosted_steering, arrays... );
287 template <
class ExecutionSpace,
class... ArrayTypes>
288 void gather(
const ExecutionSpace& exec_space,
289 const ArrayTypes&... arrays )
const
291 Kokkos::Profiling::ScopedRegion region(
"Cabana::Grid::gather" );
294 int num_n = _neighbor_ranks.size();
299 auto comm =
getComm( arrays... );
302 std::vector<MPI_Request> requests( 2 * num_n, MPI_REQUEST_NULL );
306 const int mpi_tag = 1234;
309 for (
int n = 0; n < num_n; ++n )
312 if ( 0 < _ghosted_buffers[n].
size() )
314 MPI_Irecv( _ghosted_buffers[n].data(),
315 _ghosted_buffers[n].
size(), MPI_BYTE,
316 _neighbor_ranks[n], mpi_tag + _receive_tags[n], comm,
322 for (
int n = 0; n < num_n; ++n )
325 if ( 0 < _owned_buffers[n].
size() )
328 packBuffer( exec_space, _owned_buffers[n], _owned_steering[n],
332 MPI_Isend( _owned_buffers[n].data(), _owned_buffers[n].
size(),
333 MPI_BYTE, _neighbor_ranks[n],
334 mpi_tag + _send_tags[n], comm,
335 &requests[num_n + n] );
340 bool unpack_complete =
false;
341 while ( !unpack_complete )
344 int unpack_index = MPI_UNDEFINED;
345 MPI_Waitany( num_n, requests.data(), &unpack_index,
349 if ( MPI_UNDEFINED == unpack_index )
351 unpack_complete =
true;
358 _ghosted_buffers[unpack_index],
359 _ghosted_steering[unpack_index],
365 MPI_Waitall( num_n, requests.data() + num_n, MPI_STATUSES_IGNORE );
375 template <
class ExecutionSpace,
class ReduceOp,
class... ArrayTypes>
376 void scatter(
const ExecutionSpace& exec_space,
const ReduceOp& reduce_op,
377 const ArrayTypes&... arrays )
const
379 Kokkos::Profiling::ScopedRegion region(
"Cabana::Grid::scatter" );
382 int num_n = _neighbor_ranks.size();
387 auto comm =
getComm( arrays... );
390 std::vector<MPI_Request> requests( 2 * num_n, MPI_REQUEST_NULL );
394 const int mpi_tag = 2345;
397 for (
int n = 0; n < num_n; ++n )
400 if ( 0 < _owned_buffers[n].
size() )
402 MPI_Irecv( _owned_buffers[n].data(), _owned_buffers[n].
size(),
403 MPI_BYTE, _neighbor_ranks[n],
404 mpi_tag + _receive_tags[n], comm, &requests[n] );
409 for (
int n = 0; n < num_n; ++n )
412 if ( 0 < _ghosted_buffers[n].
size() )
416 _ghosted_steering[n], arrays.view()... );
419 MPI_Isend( _ghosted_buffers[n].data(),
420 _ghosted_buffers[n].
size(), MPI_BYTE,
421 _neighbor_ranks[n], mpi_tag + _send_tags[n], comm,
422 &requests[num_n + n] );
427 bool unpack_complete =
false;
428 while ( !unpack_complete )
431 int unpack_index = MPI_UNDEFINED;
432 MPI_Waitany( num_n, requests.data(), &unpack_index,
436 if ( MPI_UNDEFINED == unpack_index )
438 unpack_complete =
true;
445 _owned_buffers[unpack_index],
446 _owned_steering[unpack_index], arrays.view()... );
450 MPI_Waitall( num_n, requests.data() + num_n, MPI_STATUSES_IGNORE );
456 template <
class Array_t>
457 MPI_Comm
getComm(
const Array_t& array )
const
459 return array.layout()->localGrid()->globalGrid().comm();
463 template <
class Array_t,
class... ArrayTypes>
464 MPI_Comm
getComm(
const Array_t& array,
const ArrayTypes&... arrays )
const
471 MPI_Comm_compare( comm,
getComm( arrays... ), &result );
472 if ( result != MPI_IDENT && result != MPI_CONGRUENT )
473 throw std::runtime_error(
"Arrays have different communicators" );
480 template <
class Array_t>
483 return array.layout()->localGrid();
488 template <
class Array_t,
class... ArrayTypes>
495 if ( local_grid->haloCellWidth() !=
496 array.layout()->localGrid()->haloCellWidth() )
498 throw std::runtime_error(
"Arrays have different halo widths" );
505 template <
class DecompositionTag, std::size_t NumSpaceDim,
509 const std::array<int, NumSpaceDim>& nid,
510 std::vector<Kokkos::View<char*, memory_space>>& buffers,
511 std::vector<Kokkos::View<int**, memory_space>>& steering,
512 const ArrayTypes&... arrays )
515 const std::size_t num_array =
sizeof...( ArrayTypes );
518 std::array<std::size_t, num_array> value_byte_sizes = {
519 sizeof(
typename ArrayTypes::value_type )... };
523 std::array<IndexSpace<NumSpaceDim + 1>, num_array> spaces = {
524 ( arrays.layout()->sharedIndexSpace( decomposition_tag, nid,
529 int buffer_bytes = 0;
530 int buffer_num_element = 0;
531 for ( std::size_t a = 0; a < num_array; ++a )
533 buffer_bytes += value_byte_sizes[a] * spaces[a].size();
534 buffer_num_element += spaces[a].size();
540 Kokkos::View<char*, memory_space>(
"halo_buffer", buffer_bytes ) );
543 steering.push_back( Kokkos::View<int**, memory_space>(
544 "steering", buffer_num_element, 3 + NumSpaceDim ) );
548 buffer_num_element, steering );
552 template <std::
size_t NumArray>
555 const std::array<std::size_t, NumArray>& value_byte_sizes,
556 const int buffer_bytes,
const int buffer_num_element,
557 std::vector<Kokkos::View<int**, memory_space>>& steering )
563 Kokkos::create_mirror_view( Kokkos::HostSpace(), steering.back() );
564 int elem_counter = 0;
565 int byte_counter = 0;
566 for ( std::size_t a = 0; a < NumArray; ++a )
568 for (
int i = spaces[a].min( 0 ); i < spaces[a].max( 0 ); ++i )
570 for (
int j = spaces[a].min( 1 ); j < spaces[a].max( 1 ); ++j )
572 for (
int k = spaces[a].min( 2 ); k < spaces[a].max( 2 );
575 for (
int l = spaces[a].min( 3 );
576 l < spaces[a].max( 3 ); ++l )
579 host_steering( elem_counter, 0 ) = byte_counter;
582 host_steering( elem_counter, 1 ) = a;
585 host_steering( elem_counter, 2 ) = i;
586 host_steering( elem_counter, 3 ) = j;
587 host_steering( elem_counter, 4 ) = k;
588 host_steering( elem_counter, 5 ) = l;
594 byte_counter += value_byte_sizes[a];
602 if ( byte_counter != buffer_bytes )
603 throw std::logic_error(
"Steering vector contains different number "
604 "of bytes than buffer" );
605 if ( elem_counter != buffer_num_element )
606 throw std::logic_error(
"Steering vector contains different number "
607 "of elements than buffer" );
610 Kokkos::deep_copy( steering.back(), host_steering );
614 template <std::
size_t NumArray>
617 const std::array<std::size_t, NumArray>& value_byte_sizes,
618 const int buffer_bytes,
const int buffer_num_element,
619 std::vector<Kokkos::View<int**, memory_space>>& steering )
625 Kokkos::create_mirror_view( Kokkos::HostSpace(), steering.back() );
626 int elem_counter = 0;
627 int byte_counter = 0;
628 for ( std::size_t a = 0; a < NumArray; ++a )
630 for (
int i = spaces[a].min( 0 ); i < spaces[a].max( 0 ); ++i )
632 for (
int j = spaces[a].min( 1 ); j < spaces[a].max( 1 ); ++j )
634 for (
int l = spaces[a].min( 2 ); l < spaces[a].max( 2 );
638 host_steering( elem_counter, 0 ) = byte_counter;
641 host_steering( elem_counter, 1 ) = a;
644 host_steering( elem_counter, 2 ) = i;
645 host_steering( elem_counter, 3 ) = j;
646 host_steering( elem_counter, 4 ) = l;
652 byte_counter += value_byte_sizes[a];
659 if ( byte_counter != buffer_bytes )
660 throw std::logic_error(
"Steering vector contains different number "
661 "of bytes than buffer" );
662 if ( elem_counter != buffer_num_element )
663 throw std::logic_error(
"Steering vector contains different number "
664 "of elements than buffer" );
667 Kokkos::deep_copy( steering.back(), host_steering );
672 template <
class ArrayView>
673 KOKKOS_INLINE_FUNCTION
static std::enable_if_t<4 == ArrayView::rank, void>
675 const Kokkos::View<int**, memory_space>& steering,
676 const int element_idx,
const ArrayView& array_view )
678 const char* elem_ptr =
reinterpret_cast<const char*
>( &array_view(
679 steering( element_idx, 2 ), steering( element_idx, 3 ),
680 steering( element_idx, 4 ), steering( element_idx, 5 ) ) );
681 for ( std::size_t b = 0; b <
sizeof(
typename ArrayView::value_type );
684 buffer( steering( element_idx, 0 ) + b ) = *( elem_ptr + b );
690 template <
class ArrayView>
691 KOKKOS_INLINE_FUNCTION
static std::enable_if_t<3 == ArrayView::rank, void>
693 const Kokkos::View<int**, memory_space>& steering,
694 const int element_idx,
const ArrayView& array_view )
696 const char* elem_ptr =
reinterpret_cast<const char*
>(
697 &array_view( steering( element_idx, 2 ), steering( element_idx, 3 ),
698 steering( element_idx, 4 ) ) );
699 for ( std::size_t b = 0; b <
sizeof(
typename ArrayView::value_type );
702 buffer( steering( element_idx, 0 ) + b ) = *( elem_ptr + b );
707 template <
class... ArrayViews>
708 KOKKOS_INLINE_FUNCTION
static void
709 packArray(
const Kokkos::View<char*, memory_space>& buffer,
710 const Kokkos::View<int**, memory_space>& steering,
711 const int element_idx,
712 const std::integral_constant<std::size_t, 0>,
716 if ( 0 == steering( element_idx, 1 ) )
722 template <std::size_t N,
class... ArrayViews>
723 KOKKOS_INLINE_FUNCTION
static void
724 packArray(
const Kokkos::View<char*, memory_space>& buffer,
725 const Kokkos::View<int**, memory_space>& steering,
726 const int element_idx,
727 const std::integral_constant<std::size_t, N>,
731 if ( N == steering( element_idx, 1 ) )
739 packArray( buffer, steering, element_idx,
740 std::integral_constant<std::size_t, N - 1>(), array_views );
744 template <
class ExecutionSpace,
class... ArrayViews>
746 const Kokkos::View<char*, memory_space>& buffer,
747 const Kokkos::View<int**, memory_space>& steering,
748 ArrayViews... array_views )
const
751 Kokkos::parallel_for(
752 "Cabana::Grid::Halo::pack_buffer",
753 Kokkos::RangePolicy<ExecutionSpace>( exec_space, 0,
754 steering.extent( 0 ) ),
755 KOKKOS_LAMBDA(
const int i ) {
758 std::integral_constant<std::size_t,
759 sizeof...( ArrayViews ) - 1>(),
767 KOKKOS_INLINE_FUNCTION
static void
770 array_val += buffer_val;
775 KOKKOS_INLINE_FUNCTION
static void
778 if ( buffer_val < array_val )
779 array_val = buffer_val;
784 KOKKOS_INLINE_FUNCTION
static void
787 if ( buffer_val > array_val )
788 array_val = buffer_val;
793 KOKKOS_INLINE_FUNCTION
static void
796 array_val = buffer_val;
801 template <
class ReduceOp,
class ArrayView>
802 KOKKOS_INLINE_FUNCTION
static std::enable_if_t<4 == ArrayView::rank, void>
804 const Kokkos::View<char*, memory_space>& buffer,
805 const Kokkos::View<int**, memory_space>& steering,
806 const int element_idx,
const ArrayView& array_view )
808 typename ArrayView::value_type elem;
809 char* elem_ptr =
reinterpret_cast<char*
>( &elem );
810 for ( std::size_t b = 0; b <
sizeof(
typename ArrayView::value_type );
813 *( elem_ptr + b ) = buffer( steering( element_idx, 0 ) + b );
816 array_view( steering( element_idx, 2 ),
817 steering( element_idx, 3 ),
818 steering( element_idx, 4 ),
819 steering( element_idx, 5 ) ) );
824 template <
class ReduceOp,
class ArrayView>
825 KOKKOS_INLINE_FUNCTION
static std::enable_if_t<3 == ArrayView::rank, void>
827 const Kokkos::View<char*, memory_space>& buffer,
828 const Kokkos::View<int**, memory_space>& steering,
829 const int element_idx,
const ArrayView& array_view )
831 typename ArrayView::value_type elem;
832 char* elem_ptr =
reinterpret_cast<char*
>( &elem );
833 for ( std::size_t b = 0; b <
sizeof(
typename ArrayView::value_type );
836 *( elem_ptr + b ) = buffer( steering( element_idx, 0 ) + b );
839 array_view( steering( element_idx, 2 ),
840 steering( element_idx, 3 ),
841 steering( element_idx, 4 ) ) );
845 template <
class ReduceOp,
class... ArrayViews>
846 KOKKOS_INLINE_FUNCTION
static void
848 const Kokkos::View<char*, memory_space>& buffer,
849 const Kokkos::View<int**, memory_space>& steering,
850 const int element_idx,
851 const std::integral_constant<std::size_t, 0>,
855 if ( 0 == steering( element_idx, 1 ) )
861 template <
class ReduceOp, std::size_t N,
class... ArrayViews>
862 KOKKOS_INLINE_FUNCTION
static void
864 const Kokkos::View<char*, memory_space>& buffer,
865 const Kokkos::View<int**, memory_space>& steering,
866 const int element_idx,
867 const std::integral_constant<std::size_t, N>,
871 if ( N == steering( element_idx, 1 ) )
879 unpackArray( reduce_op, buffer, steering, element_idx,
880 std::integral_constant<std::size_t, N - 1>(),
885 template <
class ExecutionSpace,
class ReduceOp,
class... ArrayViews>
887 const ExecutionSpace& exec_space,
888 const Kokkos::View<char*, memory_space>& buffer,
889 const Kokkos::View<int**, memory_space>& steering,
890 ArrayViews... array_views )
const
893 Kokkos::parallel_for(
894 "Cabana::Grid::Halo::unpack_buffer",
895 Kokkos::RangePolicy<ExecutionSpace>( exec_space, 0,
896 steering.extent( 0 ) ),
897 KOKKOS_LAMBDA(
const int i ) {
899 reduce_op, buffer, steering, i,
900 std::integral_constant<std::size_t,
901 sizeof...( ArrayViews ) - 1>(),
908 std::vector<int> _neighbor_ranks;
911 std::vector<int> _send_tags;
914 std::vector<int> _receive_tags;
917 std::vector<Kokkos::View<char*, memory_space>> _owned_buffers;
920 std::vector<Kokkos::View<char*, memory_space>> _ghosted_buffers;
923 std::vector<Kokkos::View<int**, memory_space>> _owned_steering;
926 std::vector<Kokkos::View<int**, memory_space>> _ghosted_steering;
933template <
class ArrayT,
class... Types>
937 using type =
typename ArrayT::memory_space;
948template <
class Pattern,
class... ArrayTypes>
950 const ArrayTypes&... arrays )
953 return std::make_shared<Halo<memory_space>>( pattern, width, arrays... );
auto createHalo(const Pattern &pattern, const int width, const ArrayTypes &... arrays)
Halo creation function.
Definition Cabana_Grid_Halo.hpp:949
Pack variadic template parameters for device capture.
Definition Cabana_Grid_Halo.hpp:120
Base halo exchange pattern class.
Definition Cabana_Grid_Halo.hpp:45
std::vector< std::array< int, num_space_dim > > getNeighbors() const
Get the neighbors that are in the halo pattern.
Definition Cabana_Grid_Halo.hpp:64
void setNeighbors(const std::vector< std::array< int, num_space_dim > > &neighbors)
Assign the neighbors that are in the halo pattern.
Definition Cabana_Grid_Halo.hpp:58
static constexpr std::size_t num_space_dim
Spatial dimension.
Definition Cabana_Grid_Halo.hpp:48
static KOKKOS_INLINE_FUNCTION void unpackOp(ScatterReduce::Sum, const T &buffer_val, T &array_val)
Reduce an element into the buffer. Sum reduction.
Definition Cabana_Grid_Halo.hpp:768
MemorySpace memory_space
Memory space.
Definition Cabana_Grid_Halo.hpp:204
void scatter(const ExecutionSpace &exec_space, const ReduceOp &reduce_op, const ArrayTypes &... arrays) const
Scatter data from our ghosts to their owners using the given type of reduce operation.
Definition Cabana_Grid_Halo.hpp:376
static KOKKOS_INLINE_FUNCTION void packArray(const Kokkos::View< char *, memory_space > &buffer, const Kokkos::View< int **, memory_space > &steering, const int element_idx, const std::integral_constant< std::size_t, 0 >, const Cabana::ParameterPack< ArrayViews... > &array_views)
Pack an array into a buffer.
Definition Cabana_Grid_Halo.hpp:709
static KOKKOS_INLINE_FUNCTION std::enable_if_t< 4==ArrayView::rank, void > unpackElement(const ReduceOp &reduce_op, const Kokkos::View< char *, memory_space > &buffer, const Kokkos::View< int **, memory_space > &steering, const int element_idx, const ArrayView &array_view)
Definition Cabana_Grid_Halo.hpp:803
Halo(const Pattern &pattern, const int width, const ArrayTypes &... arrays)
Constructor.
Definition Cabana_Grid_Halo.hpp:216
void gather(const ExecutionSpace &exec_space, const ArrayTypes &... arrays) const
Gather data into our ghosts from their owners.
Definition Cabana_Grid_Halo.hpp:288
static KOKKOS_INLINE_FUNCTION void unpackOp(ScatterReduce::Replace, const T &buffer_val, T &array_val)
Reduce an element into the buffer. Replace reduction.
Definition Cabana_Grid_Halo.hpp:794
static KOKKOS_INLINE_FUNCTION std::enable_if_t< 4==ArrayView::rank, void > packElement(const Kokkos::View< char *, memory_space > &buffer, const Kokkos::View< int **, memory_space > &steering, const int element_idx, const ArrayView &array_view)
Definition Cabana_Grid_Halo.hpp:674
static KOKKOS_INLINE_FUNCTION void unpackArray(const ReduceOp &reduce_op, const Kokkos::View< char *, memory_space > &buffer, const Kokkos::View< int **, memory_space > &steering, const int element_idx, const std::integral_constant< std::size_t, 0 >, const Cabana::ParameterPack< ArrayViews... > &array_views)
Unpack an array from a buffer.
Definition Cabana_Grid_Halo.hpp:847
static KOKKOS_INLINE_FUNCTION void unpackOp(ScatterReduce::Min, const T &buffer_val, T &array_val)
Reduce an element into the buffer. Min reduction.
Definition Cabana_Grid_Halo.hpp:776
MPI_Comm getComm(const Array_t &array, const ArrayTypes &... arrays) const
Get the communicator and check to make sure all are the same.
Definition Cabana_Grid_Halo.hpp:464
static KOKKOS_INLINE_FUNCTION void unpackOp(ScatterReduce::Max, const T &buffer_val, T &array_val)
Reduce an element into the buffer. Max reduction.
Definition Cabana_Grid_Halo.hpp:785
static KOKKOS_INLINE_FUNCTION std::enable_if_t< 3==ArrayView::rank, void > packElement(const Kokkos::View< char *, memory_space > &buffer, const Kokkos::View< int **, memory_space > &steering, const int element_idx, const ArrayView &array_view)
Definition Cabana_Grid_Halo.hpp:692
void buildCommData(DecompositionTag decomposition_tag, const int width, const std::array< int, NumSpaceDim > &nid, std::vector< Kokkos::View< char *, memory_space > > &buffers, std::vector< Kokkos::View< int **, memory_space > > &steering, const ArrayTypes &... arrays)
Build communication data.
Definition Cabana_Grid_Halo.hpp:508
static KOKKOS_INLINE_FUNCTION void packArray(const Kokkos::View< char *, memory_space > &buffer, const Kokkos::View< int **, memory_space > &steering, const int element_idx, const std::integral_constant< std::size_t, N >, const Cabana::ParameterPack< ArrayViews... > &array_views)
Pack an array into a buffer.
Definition Cabana_Grid_Halo.hpp:724
MPI_Comm getComm(const Array_t &array) const
Get the communicator.
Definition Cabana_Grid_Halo.hpp:457
void unpackBuffer(const ReduceOp &reduce_op, const ExecutionSpace &exec_space, const Kokkos::View< char *, memory_space > &buffer, const Kokkos::View< int **, memory_space > &steering, ArrayViews... array_views) const
Unpack arrays from a buffer.
Definition Cabana_Grid_Halo.hpp:886
void packBuffer(const ExecutionSpace &exec_space, const Kokkos::View< char *, memory_space > &buffer, const Kokkos::View< int **, memory_space > &steering, ArrayViews... array_views) const
Pack arrays into a buffer.
Definition Cabana_Grid_Halo.hpp:745
auto getLocalGrid(const Array_t &array, const ArrayTypes &... arrays)
Definition Cabana_Grid_Halo.hpp:489
static KOKKOS_INLINE_FUNCTION std::enable_if_t< 3==ArrayView::rank, void > unpackElement(const ReduceOp &reduce_op, const Kokkos::View< char *, memory_space > &buffer, const Kokkos::View< int **, memory_space > &steering, const int element_idx, const ArrayView &array_view)
Definition Cabana_Grid_Halo.hpp:826
void buildSteeringVector(const std::array< IndexSpace< 4 >, NumArray > &spaces, const std::array< std::size_t, NumArray > &value_byte_sizes, const int buffer_bytes, const int buffer_num_element, std::vector< Kokkos::View< int **, memory_space > > &steering)
Build 3d steering vector.
Definition Cabana_Grid_Halo.hpp:553
auto getLocalGrid(const Array_t &array)
Definition Cabana_Grid_Halo.hpp:481
static KOKKOS_INLINE_FUNCTION void unpackArray(const ReduceOp reduce_op, const Kokkos::View< char *, memory_space > &buffer, const Kokkos::View< int **, memory_space > &steering, const int element_idx, const std::integral_constant< std::size_t, N >, const Cabana::ParameterPack< ArrayViews... > &array_views)
Unpack an array from a buffer.
Definition Cabana_Grid_Halo.hpp:863
void buildSteeringVector(const std::array< IndexSpace< 3 >, NumArray > &spaces, const std::array< std::size_t, NumArray > &value_byte_sizes, const int buffer_bytes, const int buffer_num_element, std::vector< Kokkos::View< int **, memory_space > > &steering)
Build 2d steering vector.
Definition Cabana_Grid_Halo.hpp:615
Structured index space.
Definition Cabana_Grid_IndexSpace.hpp:37
Definition Cabana_Grid_Halo.hpp:76
Core: particle data structures and algorithms.
Definition Cabana_AoSoA.hpp:36
auto size(SliceType slice, typename std::enable_if< is_slice< SliceType >::value, int >::type *=0)
Check slice size (differs from Kokkos View).
Definition Cabana_Slice.hpp:1012
ParameterPack< Types... > makeParameterPack(const Types &... ts)
Create a parameter pack.
Definition Cabana_ParameterPack.hpp:189
KOKKOS_FORCEINLINE_FUNCTION std::enable_if< is_parameter_pack< ParameterPack_t >::value, typenameParameterPack_t::templatevalue_type< N > & >::type get(ParameterPack_t &pp)
Get an element from a parameter pack.
Definition Cabana_ParameterPack.hpp:129
Infer array memory space.
Definition Cabana_Grid_Halo.hpp:935
typename ArrayT::memory_space type
Memory space.
Definition Cabana_Grid_Halo.hpp:937
Ghosted decomposition tag.
Definition Cabana_Grid_Types.hpp:197
Owned decomposition tag.
Definition Cabana_Grid_Types.hpp:190
Definition Cabana_Grid_Halo.hpp:173
Definition Cabana_Grid_Halo.hpp:167
Definition Cabana_Grid_Halo.hpp:181
Sum values from neighboring ranks into this rank's data.
Definition Cabana_Grid_Halo.hpp:161
Definition Cabana_ParameterPack.hpp:86