diff --git a/libsrc/general/mpi_interface.hpp b/libsrc/general/mpi_interface.hpp index ec6018bd..3beaa498 100644 --- a/libsrc/general/mpi_interface.hpp +++ b/libsrc/general/mpi_interface.hpp @@ -15,17 +15,13 @@ namespace netgen { + extern int id, ntasks; + + #ifndef PARALLEL - - -// namespace netgen -// { - //using namespace netgen; - enum { id = 0 }; - enum { ntasks = 0 }; -// } - + // enum { id = 0 }; + // enum { ntasks = 0 }; #else // if PARALLEL @@ -37,12 +33,11 @@ namespace netgen //#include "parallelfunc.hpp" -extern MPI_Group MPI_HIGHORDER_WORLD; -extern MPI_Comm MPI_HIGHORDER_COMM; + extern MPI_Group MPI_HIGHORDER_WORLD; + extern MPI_Comm MPI_HIGHORDER_COMM; // namespace netgen // { - extern int id, ntasks; template MPI_Datatype MyGetMPIType ( ) { cerr << "ERROR in GetMPIType() -- no type found" << endl;return 0;} @@ -201,7 +196,8 @@ extern MPI_Comm MPI_HIGHORDER_COMM; inline void MyMPI_Bcast (Array & s, int root, MPI_Comm comm = MPI_COMM_WORLD) { int id; - MPI_Comm_rank(MPI_HIGHORDER_COMM, &id); + // MPI_Comm_rank(MPI_HIGHORDER_COMM, &id); + MPI_Comm_rank(comm, &id); int size = s.Size(); MPI_Bcast (&size, 1, MPI_INT, root, comm); diff --git a/ng/ngappinit.cpp b/ng/ngappinit.cpp index 9b54f44f..3a3d5639 100644 --- a/ng/ngappinit.cpp +++ b/ng/ngappinit.cpp @@ -17,12 +17,16 @@ #endif */ +namespace netgen +{ + int id = 0, ntasks = 1; +} + #ifdef PARALLEL #include namespace netgen { - int id, ntasks; MPI_Group MPI_HIGHORDER_WORLD; MPI_Comm MPI_HIGHORDER_COMM; } @@ -74,9 +78,6 @@ int main(int argc, char ** argv) { #ifdef PARALLEL - // parallel profiling -#pragma pomp inst init - MPI_Init(&argc, &argv); MPI_Comm_size(MPI_COMM_WORLD, &netgen::ntasks); @@ -92,10 +93,9 @@ int main(int argc, char ** argv) MPI_Comm_group ( MPI_COMM_WORLD, &MPI_GROUP_WORLD); MPI_Group_incl ( MPI_GROUP_WORLD, n_ho, process_ranks, & netgen::MPI_HIGHORDER_WORLD); MPI_Comm_create ( MPI_COMM_WORLD, netgen::MPI_HIGHORDER_WORLD, & netgen::MPI_HIGHORDER_COMM); - -#pragma pomp inst begin(main) #endif + if ( netgen::id == 0 ) { cout << "NETGEN-" << PACKAGE_VERSION << endl; @@ -313,7 +313,6 @@ int main(int argc, char ** argv) Tcl_DeleteInterp (myinterp); #ifdef PARALLEL -#pragma pomp inst altend(main) // MPI beenden MPI_Barrier(MPI_COMM_WORLD); @@ -328,8 +327,6 @@ int main(int argc, char ** argv) // main for parallel processors ParallelRun(); -#pragma pomp inst end(main) - // MPI beenden MPI_Barrier(MPI_COMM_WORLD); MPI_Finalize(); diff --git a/ng/parallelfunc.cpp b/ng/parallelfunc.cpp index d84297e8..9b9e0c0a 100644 --- a/ng/parallelfunc.cpp +++ b/ng/parallelfunc.cpp @@ -92,10 +92,8 @@ void Ng_Exit () void ParallelRun() { string message; - MPI_Status status; - // int id, rc, ntasks; MPI_Comm_size(MPI_COMM_WORLD, &ntasks); MPI_Comm_rank(MPI_COMM_WORLD, &id); @@ -104,8 +102,6 @@ void ParallelRun() bool test = true; - - testout = new ofstream (string("testout_proc") + id ); while ( test ) @@ -114,9 +110,7 @@ void ParallelRun() #pragma pomp inst begin (message) #endif - (*testout) << "wait for mess " << endl; MyMPI_Recv ( message, 0 ); - (*testout) << "message " << message << endl; #ifdef SCALASCA #pragma pomp inst end (message)