Loading src/TNL/Containers/Array.h +7 −0 Original line number Diff line number Diff line Loading @@ -966,6 +966,13 @@ File& operator>>( File& file, Array< Value, Device, Index, Allocator >& array ); template< typename Value, typename Device, typename Index, typename Allocator > File& operator>>( File&& file, Array< Value, Device, Index, Allocator >& array ); template< typename Value, typename Device, typename Index, typename Allocator > void send( const Array< Value, Device, Index, Allocator >& array, int dest, int tag = 0, MPI_Comm comm = MPI_COMM_WORLD ); template< typename Value, typename Device, typename Index, typename Allocator > void receive( Array< Value, Device, Index, Allocator >& array, int src, int tag = 0, MPI_Comm comm = MPI_COMM_WORLD ); } // namespace Containers } // namespace TNL Loading src/TNL/Containers/Array.hpp +20 −0 Original line number Diff line number Diff line Loading @@ -911,5 +911,25 @@ File& operator>>( File&& file, Array< Value, Device, Index, Allocator >& array ) return f >> array; } template< typename Value, typename Device, typename Index, typename Allocator > void send( const Array< Value, Device, Index, Allocator >& array, int dest, int tag, MPI_Comm comm ) { send( array.getConstView(), dest, tag, comm ); } template< typename Value, typename Device, typename Index, typename Allocator > void receive( Array< Value, Device, Index, Allocator >& array, int src, int tag, MPI_Comm comm ) { TNL_ASSERT( false, "Does not work" ); MPI_Status status; Index size; MPI_Recv( ( void* ) size, 1, MPI::getDataType< Index >(), src, tag, comm, &status ); std::cerr << "Size = " << size << std::endl; array.setSize( size ); MPI_Recv( ( void* ) array.getData(), size * sizeof( Value ), MPI_BYTE, src, tag, comm, &status ); } } // namespace Containers } // namespace TNL src/TNL/Containers/ArrayView.h +4 −0 Original line number Diff line number Diff line Loading @@ -767,6 +767,10 @@ File& operator>>( File& file, ArrayView< Value, Device, Index > view ); template< typename Value, typename Device, typename Index > File& operator>>( File&& file, ArrayView< Value, Device, Index > view ); template< typename Value, typename Device, typename Index > void send( const ArrayView< Value, Device, Index >& view, int dest, int tag = 0, MPI_Comm comm = MPI_COMM_WORLD ); } // namespace Containers } // namespace TNL Loading src/TNL/Containers/ArrayView.hpp +11 −0 Original line number Diff line number Diff line Loading @@ -20,6 +20,7 @@ #include <TNL/Containers/detail/ArrayIO.h> #include <TNL/Containers/detail/ArrayAssignment.h> #include <TNL/Allocators/Default.h> #include <TNL/MPI/getDataType.h> #include "ArrayView.h" Loading Loading @@ -540,5 +541,15 @@ File& operator>>( File&& file, ArrayView< Value, Device, Index > view ) return f >> view; } template< typename Value, typename Device, typename Index > void send( const ArrayView< Value, Device, Index >& view, int dest, int tag, MPI_Comm comm ) { TNL_ASSERT( false, "Does not work" ); auto size = view.getSize(); MPI_Send( ( const void* ) size, 1, MPI::getDataType< Index >(), dest, tag, comm ); MPI_Send( ( const void* ) view.getData(), view.getSize() * sizeof( Value ), MPI_BYTE, dest, tag, comm ); } } // namespace Containers } // namespace TNL Loading
src/TNL/Containers/Array.h +7 −0 Original line number Diff line number Diff line Loading @@ -966,6 +966,13 @@ File& operator>>( File& file, Array< Value, Device, Index, Allocator >& array ); template< typename Value, typename Device, typename Index, typename Allocator > File& operator>>( File&& file, Array< Value, Device, Index, Allocator >& array ); template< typename Value, typename Device, typename Index, typename Allocator > void send( const Array< Value, Device, Index, Allocator >& array, int dest, int tag = 0, MPI_Comm comm = MPI_COMM_WORLD ); template< typename Value, typename Device, typename Index, typename Allocator > void receive( Array< Value, Device, Index, Allocator >& array, int src, int tag = 0, MPI_Comm comm = MPI_COMM_WORLD ); } // namespace Containers } // namespace TNL Loading
src/TNL/Containers/Array.hpp +20 −0 Original line number Diff line number Diff line Loading @@ -911,5 +911,25 @@ File& operator>>( File&& file, Array< Value, Device, Index, Allocator >& array ) return f >> array; } template< typename Value, typename Device, typename Index, typename Allocator > void send( const Array< Value, Device, Index, Allocator >& array, int dest, int tag, MPI_Comm comm ) { send( array.getConstView(), dest, tag, comm ); } template< typename Value, typename Device, typename Index, typename Allocator > void receive( Array< Value, Device, Index, Allocator >& array, int src, int tag, MPI_Comm comm ) { TNL_ASSERT( false, "Does not work" ); MPI_Status status; Index size; MPI_Recv( ( void* ) size, 1, MPI::getDataType< Index >(), src, tag, comm, &status ); std::cerr << "Size = " << size << std::endl; array.setSize( size ); MPI_Recv( ( void* ) array.getData(), size * sizeof( Value ), MPI_BYTE, src, tag, comm, &status ); } } // namespace Containers } // namespace TNL
src/TNL/Containers/ArrayView.h +4 −0 Original line number Diff line number Diff line Loading @@ -767,6 +767,10 @@ File& operator>>( File& file, ArrayView< Value, Device, Index > view ); template< typename Value, typename Device, typename Index > File& operator>>( File&& file, ArrayView< Value, Device, Index > view ); template< typename Value, typename Device, typename Index > void send( const ArrayView< Value, Device, Index >& view, int dest, int tag = 0, MPI_Comm comm = MPI_COMM_WORLD ); } // namespace Containers } // namespace TNL Loading
src/TNL/Containers/ArrayView.hpp +11 −0 Original line number Diff line number Diff line Loading @@ -20,6 +20,7 @@ #include <TNL/Containers/detail/ArrayIO.h> #include <TNL/Containers/detail/ArrayAssignment.h> #include <TNL/Allocators/Default.h> #include <TNL/MPI/getDataType.h> #include "ArrayView.h" Loading Loading @@ -540,5 +541,15 @@ File& operator>>( File&& file, ArrayView< Value, Device, Index > view ) return f >> view; } template< typename Value, typename Device, typename Index > void send( const ArrayView< Value, Device, Index >& view, int dest, int tag, MPI_Comm comm ) { TNL_ASSERT( false, "Does not work" ); auto size = view.getSize(); MPI_Send( ( const void* ) size, 1, MPI::getDataType< Index >(), dest, tag, comm ); MPI_Send( ( const void* ) view.getData(), view.getSize() * sizeof( Value ), MPI_BYTE, dest, tag, comm ); } } // namespace Containers } // namespace TNL