diff --git a/libsrc/core/mpi_wrapper.hpp b/libsrc/core/mpi_wrapper.hpp index e8461bb9..058dca70 100644 --- a/libsrc/core/mpi_wrapper.hpp +++ b/libsrc/core/mpi_wrapper.hpp @@ -286,25 +286,25 @@ namespace ngcore } /** --- non-blocking P2P --- **/ - + template())> - NG_MPI_Request ISend (T & val, int dest, int tag) const + [[nodiscard]] NG_MPI_Request ISend (T & val, int dest, int tag) const { NG_MPI_Request request; NG_MPI_Isend (&val, 1, GetMPIType(), dest, tag, comm, &request); return request; } - + template())> - NG_MPI_Request ISend (FlatArray s, int dest, int tag) const + [[nodiscard]] NG_MPI_Request ISend (FlatArray s, int dest, int tag) const { NG_MPI_Request request; NG_MPI_Isend (s.Data(), s.Size(), GetMPIType(), dest, tag, comm, &request); return request; } - + template())> - NG_MPI_Request IRecv (T & val, int dest, int tag) const + [[nodiscard]] NG_MPI_Request IRecv (T & val, int dest, int tag) const { NG_MPI_Request request; NG_MPI_Irecv (&val, 1, GetMPIType(), dest, tag, comm, &request); @@ -312,7 +312,7 @@ namespace ngcore } template())> - NG_MPI_Request IRecv (FlatArray s, int src, int tag) const + [[nodiscard]] NG_MPI_Request IRecv (FlatArray s, int src, int tag) const { NG_MPI_Request request; NG_MPI_Irecv (s.Data(), s.Size(), GetMPIType(), src, tag, comm, &request); @@ -393,8 +393,9 @@ namespace ngcore } + template - NgMPI_Request IBcast (std::array & d, int root = 0) const + [[nodiscard]] NgMPI_Request IBcast (std::array & d, int root = 0) const { NG_MPI_Request request; NG_MPI_Ibcast (&d[0], S, GetMPIType(), root, comm, &request); @@ -535,7 +536,12 @@ namespace ngcore template inline NG_MPI_Datatype GetMPIType () { return -1; } - class NgMPI_Request { }; + class NgMPI_Request { + public: + NgMPI_Request() = default; + NgMPI_Request(NgMPI_Request &&) { ; } + NgMPI_Request(NG_MPI_Request &&) { ; } + }; class NgMPI_Requests { public: diff --git a/libsrc/meshing/parallelmesh.cpp b/libsrc/meshing/parallelmesh.cpp index a1e388b7..9fad0603 100644 --- a/libsrc/meshing/parallelmesh.cpp +++ b/libsrc/meshing/parallelmesh.cpp @@ -1220,7 +1220,8 @@ namespace netgen recvrequests[0] = comm.IBcast (nnames); MyMPI_WaitAll (recvrequests); */ - comm.IBcast (nnames); + NgMPI_Requests requ; + requ += comm.IBcast (nnames); // cout << "nnames = " << FlatArray(nnames) << endl; materials.SetSize(nnames[0]); @@ -1235,7 +1236,7 @@ namespace netgen recvrequests[0] = comm.IBcast (name_sizes); MyMPI_WaitAll (recvrequests); */ - comm.IBcast (name_sizes); + requ += comm.IBcast (name_sizes); int tot_size = 0; for (int k = 0; k < tot_nn; k++) tot_size += name_sizes[k]; @@ -1245,7 +1246,8 @@ namespace netgen Array compiled_names(tot_size); // recvrequests[0] = comm.IBcast (compiled_names); // MyMPI_WaitAll (recvrequests); - comm.IBcast (compiled_names); + requ += comm.IBcast (compiled_names); + requ.WaitAll(); tot_nn = tot_size = 0; auto write_names = [&] (auto & array) {