mirror of
https://github.com/NGSolve/netgen.git
synced 2024-12-26 05:50:32 +05:00
parallelization
This commit is contained in:
parent
580f4b9f52
commit
660f31d7cd
@ -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 <class T>
|
||||
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<T, 0> & 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);
|
||||
|
@ -17,12 +17,16 @@
|
||||
#endif
|
||||
*/
|
||||
|
||||
namespace netgen
|
||||
{
|
||||
int id = 0, ntasks = 1;
|
||||
}
|
||||
|
||||
#ifdef PARALLEL
|
||||
#include <mpi.h>
|
||||
|
||||
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();
|
||||
|
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user