From 0b02b725fe0a14f367d0d4e177318a5ea96462d6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Oberhuber?= <oberhuber.tomas@gmail.com> Date: Thu, 7 Feb 2019 20:53:50 +0100 Subject: [PATCH] Implemented MpiCommunicator::Send. --- src/TNL/Communicators/MpiCommunicator.h | 27 ++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/src/TNL/Communicators/MpiCommunicator.h b/src/TNL/Communicators/MpiCommunicator.h index 1cb98926c5..86acf01a8f 100644 --- a/src/TNL/Communicators/MpiCommunicator.h +++ b/src/TNL/Communicators/MpiCommunicator.h @@ -295,7 +295,32 @@ class MpiCommunicator } template <typename T> - static Request ISend( const T* data, int count, int dest, int tag, CommunicationGroup group) + static void Send( const T* data, int count, int dest, int tag, CommunicationGroup group = AllGroup ) + { +#ifdef HAVE_MPI + TNL_ASSERT_TRUE(IsInitialized(), "Fatal Error - MPI communicator is not initialized"); + TNL_ASSERT_NE(group, NullGroup, "Send cannot be called with NullGroup"); + MPI_Send( const_cast< void* >( ( const void* ) data ), count, MPITypeResolver< T >::getType(), dest, tag, group ); +#else + throw Exceptions::MPISupportMissing(); +#endif + } + + template <typename T> + static void Recv( T* data, int count, int src, int tag, CommunicationGroup group = AllGroup ) + { +#ifdef HAVE_MPI + TNL_ASSERT_TRUE(IsInitialized(), "Fatal Error - MPI communicator is not initialized"); + TNL_ASSERT_NE(group, NullGroup, "Recv cannot be called with NullGroup"); + MPI_Status status; + MPI_Recv( const_cast< void* >( ( const void* ) data ), count, MPITypeResolver< T >::getType() , src, tag, group, &status ); +#else + throw Exceptions::MPISupportMissing(); +#endif + } + + template <typename T> + static Request ISend( const T* data, int count, int dest, int tag, CommunicationGroup group = AllGroup ) { #ifdef HAVE_MPI TNL_ASSERT_TRUE(IsInitialized(), "Fatal Error - MPI communicator is not initialized"); -- GitLab