diff --git a/libsrc/core/mpi_wrapper.hpp b/libsrc/core/mpi_wrapper.hpp index f86943df..0a9576e7 100644 --- a/libsrc/core/mpi_wrapper.hpp +++ b/libsrc/core/mpi_wrapper.hpp @@ -521,6 +521,12 @@ namespace ngcore template void Bcast (Array & d, int root = 0) { ; } + template + void AllGather (T val, FlatArray recv) const + { + recv[0] = val; + } + template void ExchangeTable (DynamicTable & send_data, DynamicTable & recv_data, int tag) { ; } diff --git a/libsrc/general/mpi_interface.hpp b/libsrc/general/mpi_interface.hpp index df1bf5c8..a9d7147f 100644 --- a/libsrc/general/mpi_interface.hpp +++ b/libsrc/general/mpi_interface.hpp @@ -39,11 +39,11 @@ namespace netgen #endif -#ifdef PARALLEL enum { MPI_TAG_CMD = 110 }; enum { MPI_TAG_MESH = 210 }; enum { MPI_TAG_VIS = 310 }; +#ifdef PARALLEL [[deprecated("mympi_send int, use comm.Send instead")]] inline void MyMPI_Send (int i, int dest, int tag, MPI_Comm comm) @@ -306,6 +306,22 @@ namespace netgen } +#else + template + [[deprecated("do we need that ? ")]] + inline void MyMPI_ExchangeTable (TABLE & send_data, + TABLE & recv_data, int tag, + const NgMPI_Comm & comm) + { + ; + } + + template + [[deprecated("do we need that ? ")]] + inline void MyMPI_ExchangeTable (DynamicTable & send_data, + DynamicTable & recv_data, int tag, + const NgMPI_Comm & comm) + { ; } #endif // PARALLEL } diff --git a/libsrc/meshing/meshing.hpp b/libsrc/meshing/meshing.hpp index 253f2f93..52a0dfc2 100644 --- a/libsrc/meshing/meshing.hpp +++ b/libsrc/meshing/meshing.hpp @@ -64,9 +64,7 @@ namespace netgen #include "basegeom.hpp" #include "surfacegeom.hpp" -#ifdef PARALLEL #include "paralleltop.hpp" -#endif #endif diff --git a/libsrc/meshing/paralleltop.cpp b/libsrc/meshing/paralleltop.cpp index 994a2de4..5ed3e949 100644 --- a/libsrc/meshing/paralleltop.cpp +++ b/libsrc/meshing/paralleltop.cpp @@ -1,4 +1,4 @@ -#ifdef PARALLEL +// #ifdef PARALLEL #include @@ -90,7 +90,7 @@ namespace netgen L2G(pi) = num_master_points++; } - *testout << "nummaster = " << num_master_points << endl; + // *testout << "nummaster = " << num_master_points << endl; Array first_master_point(comm.Size()); comm.AllGather (num_master_points, first_master_point); @@ -355,8 +355,10 @@ namespace netgen else { - NgArray recvarray; - MyMPI_Recv (recvarray, 0, MPI_TAG_MESH+10, comm); + // NgArray recvarray; + // MyMPI_Recv (recvarray, 0, MPI_TAG_MESH+10, comm); + Array recvarray; + comm.Recv (recvarray, 0, MPI_TAG_MESH+10); // MyMPI_Recv (recvarray, 0, MPI_TAG_MESH+10, comm); int ii = 0; @@ -409,7 +411,7 @@ namespace netgen const MeshTopology & topology = mesh.GetTopology(); - NgArray cnt_send(ntasks); + Array cnt_send(ntasks); int maxsize = comm.AllReduce (mesh.mlbetweennodes.Size(), MPI_MAX); // update new vertices after mesh-refinement @@ -429,7 +431,8 @@ namespace netgen for (PointIndex pi : mesh.Points().Range()) for (int dist : GetDistantProcs(pi)) cnt_send[dist]++; - TABLE dest2vert(cnt_send); + // TABLE dest2vert(cnt_send); + DynamicTable dest2vert(cnt_send); for (PointIndex pi : mesh.Points().Range()) for (int dist : GetDistantProcs(pi)) dest2vert.Add (dist, pi); @@ -444,7 +447,8 @@ namespace netgen cnt_send[p]++; } - TABLE dest2pair(cnt_send); + // TABLE dest2pair(cnt_send); + DynamicTable dest2pair(cnt_send); for (PointIndex pi : mesh.mlbetweennodes.Range()) if (auto [v1,v2] = mesh.mlbetweennodes[pi]; v1.IsValid()) @@ -468,7 +472,8 @@ namespace netgen cnt_send[p]+=2; } - TABLE send_verts(cnt_send); + // TABLE send_verts(cnt_send); + DynamicTable send_verts(cnt_send); NgArray loc2exchange(mesh.GetNV()); @@ -494,7 +499,7 @@ namespace netgen } } - TABLE recv_verts(ntasks); + DynamicTable recv_verts(ntasks); MyMPI_ExchangeTable (send_verts, recv_verts, MPI_TAG_MESH+9, comm); for (int dest = 0; dest < ntasks; dest++) @@ -506,7 +511,7 @@ namespace netgen for (PointIndex pi : dest2vert[dest]) loc2exchange[pi] = cnt++; - NgFlatArray recvarray = recv_verts[dest]; + FlatArray recvarray = recv_verts[dest]; for (int ii = 0; ii < recvarray.Size(); ii+=2) for (PointIndex pi : dest2pair[dest]) { @@ -546,7 +551,8 @@ namespace netgen for (PointIndex pi : mesh.Points().Range()) for (int dist : GetDistantProcs(pi)) cnt_send[dist]++; - TABLE dest2vert(cnt_send); + // TABLE dest2vert(cnt_send); + DynamicTable dest2vert(cnt_send); for (PointIndex pi : mesh.Points().Range()) for (int dist : GetDistantProcs(pi)) dest2vert.Add (dist, pi); @@ -603,7 +609,7 @@ namespace netgen const MeshTopology & topology = mesh.GetTopology(); - NgArray cnt_send(ntasks); + Array cnt_send(ntasks); // NgArray sendarray, recvarray; // cout << "UpdateCoarseGrid - edges" << endl; @@ -624,7 +630,8 @@ namespace netgen for (PointIndex pi : mesh.Points().Range()) for (int dist : GetDistantProcs(pi)) cnt_send[dist]++; - TABLE dest2vert(cnt_send); + // TABLE dest2vert(cnt_send); + DynamicTable dest2vert(cnt_send); for (PointIndex pi : mesh.Points().Range()) for (int dist : GetDistantProcs(pi)) dest2vert.Add (dist, pi); @@ -646,9 +653,11 @@ namespace netgen cnt_send[p]+=1; } - TABLE dest2edge(cnt_send); + // TABLE dest2edge(cnt_send); + DynamicTable dest2edge(cnt_send); for (int & v : cnt_send) v *= 2; - TABLE send_edges(cnt_send); + // TABLE send_edges(cnt_send); + DynamicTable send_edges(cnt_send); for (int edge = 1; edge <= ned; edge++) { @@ -681,7 +690,8 @@ namespace netgen } // cout << "UpdateCoarseGrid - edges mpi-exchange" << endl; - TABLE recv_edges(ntasks); + // TABLE recv_edges(ntasks); + DynamicTable recv_edges(ntasks); MyMPI_ExchangeTable (send_edges, recv_edges, MPI_TAG_MESH+9, comm); // cout << "UpdateCoarseGrid - edges mpi-exchange done" << endl; @@ -697,7 +707,7 @@ namespace netgen vert2edge.Set(INDEX_2(v1,v2), edge); } - NgFlatArray recvarray = recv_edges[dest]; + FlatArray recvarray = recv_edges[dest]; for (int ii = 0; ii < recvarray.Size(); ii+=2) { INDEX_2 re(ex2loc[recvarray[ii]], @@ -736,7 +746,8 @@ namespace netgen cnt_send[dest]++; } - TABLE dest2face(cnt_send); + // TABLE dest2face(cnt_send); + DynamicTable dest2face(cnt_send); for (int face = 1; face <= nfa; face++) { topology.GetFaceVertices (face, verts); @@ -754,7 +765,8 @@ namespace netgen } for (int & c : cnt_send) c*=3; - TABLE send_faces(cnt_send); + // TABLE send_faces(cnt_send); + DynamicTable send_faces(cnt_send); NgArray loc2exchange(mesh.GetNV()); for (int dest = 0; dest < ntasks; dest++) if (dest != id) @@ -786,7 +798,8 @@ namespace netgen } // cout << "UpdateCoarseGrid - faces mpi-exchange" << endl; - TABLE recv_faces(ntasks); + // TABLE recv_faces(ntasks); + DynamicTable recv_faces(ntasks); MyMPI_ExchangeTable (send_faces, recv_faces, MPI_TAG_MESH+9, comm); // cout << "UpdateCoarseGrid - faces mpi-exchange done" << endl; @@ -802,7 +815,7 @@ namespace netgen vert2face.Set(INDEX_3(verts[0], verts[1], verts[2]), face); } - NgFlatArray recvarray = recv_faces[dest]; + FlatArray recvarray = recv_faces[dest]; for (int ii = 0; ii < recvarray.Size(); ii+=3) { INDEX_3 re(ex2loc[recvarray[ii]], @@ -825,4 +838,4 @@ namespace netgen } -#endif +// #endif