From eade1f6b2d366c589cf289cef48aee467b537f5e Mon Sep 17 00:00:00 2001 From: Joachim Schoeberl Date: Sat, 16 Jun 2012 16:58:46 +0000 Subject: [PATCH] mpi --- libsrc/general/Makefile.am | 3 ++- libsrc/general/mpi_interface.hpp | 34 +++++--------------------------- libsrc/general/optmem.cpp | 3 +-- 3 files changed, 8 insertions(+), 32 deletions(-) diff --git a/libsrc/general/Makefile.am b/libsrc/general/Makefile.am index 9c555b02..b80fb3f2 100644 --- a/libsrc/general/Makefile.am +++ b/libsrc/general/Makefile.am @@ -9,6 +9,7 @@ METASOURCES = AUTO noinst_LTLIBRARIES = libgen.la libgen_la_SOURCES = array.cpp bitarray.cpp dynamicmem.cpp flags.cpp \ hashtabl.cpp mystring.cpp ngexception.cpp optmem.cpp parthreads.cpp \ - profiler.cpp seti.cpp sort.cpp spbita2d.cpp symbolta.cpp table.cpp + profiler.cpp seti.cpp sort.cpp spbita2d.cpp symbolta.cpp table.cpp \ + mpi_interface.cpp # moveablemem.cpp diff --git a/libsrc/general/mpi_interface.hpp b/libsrc/general/mpi_interface.hpp index 39060ec0..358f8678 100644 --- a/libsrc/general/mpi_interface.hpp +++ b/libsrc/general/mpi_interface.hpp @@ -27,10 +27,11 @@ namespace netgen extern MPI_Comm mesh_comm; template - MPI_Datatype MyGetMPIType ( ) { cerr << "ERROR in GetMPIType() -- no type found" << endl;return 0;} + MPI_Datatype MyGetMPIType ( ) + { cerr << "ERROR in GetMPIType() -- no type found" << endl;return 0; } template <> - inline MPI_Datatype MyGetMPIType ( ) + inline MPI_Datatype MyGetMPIType ( ) { return MPI_INT; } template <> @@ -214,36 +215,11 @@ namespace netgen - inline void MyMPI_SendCmd (const char * cmd) - { - char buf[100]; - strcpy (buf, cmd); - // MPI_Bcast (&buf, 100, MPI_CHAR, 0, MPI_COMM_WORLD); + extern void MyMPI_SendCmd (const char * cmd); + extern string MyMPI_RecvCmd (); - for (int dest = 1; dest < ntasks; dest++) - MPI_Bsend( &buf, 100, MPI_CHAR, dest, MPI_TAG_CMD, MPI_COMM_WORLD); - } - inline string MyMPI_RecvCmd () - { - char buf[100]; - // MPI_Bcast (&buf, 100, MPI_CHAR, 0, MPI_COMM_WORLD); - VT_OFF(); - MPI_Status status; - int flag; - do - { - MPI_Iprobe (0, MPI_TAG_CMD, MPI_COMM_WORLD, &flag, &status); - if (!flag) usleep (1000); - } - while (!flag); - VT_ON(); - - MPI_Recv( &buf, 100, MPI_CHAR, 0, MPI_TAG_CMD, MPI_COMM_WORLD, &status); - - return string(buf); - } template inline void MyMPI_Bcast (T & s, MPI_Comm comm = MPI_COMM_WORLD) diff --git a/libsrc/general/optmem.cpp b/libsrc/general/optmem.cpp index adb4b36e..4d31f987 100644 --- a/libsrc/general/optmem.cpp +++ b/libsrc/general/optmem.cpp @@ -1,5 +1,5 @@ /**************************************************************************/ -/* File: optmem.cc */ +/* File: optmem.cpp */ /* Author: Joachim Schoeberl */ /* Date: 04. Apr. 97 */ /**************************************************************************/ @@ -14,7 +14,6 @@ namespace netgen { - //using namespace netgen; BlockAllocator :: BlockAllocator (unsigned asize, unsigned ablocks) : bablocks (0)