From 398198855bd3cde4fbc32cf125ca6fdf2975761f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20Kl=C3=B6fkorn?= <robertk@mathematik.uni-stuttgart.de> Date: Tue, 29 Mar 2005 07:35:03 +0000 Subject: [PATCH] removed warning in no debug mode. git-svn-id: https://dune.mathematik.uni-freiburg.de/svn/alugrid/trunk@199 0d966ed9-3843-0410-af09-ebfb50bd7c74 --- src/duneinterface/gitter_dune_pll_impl.cc | 11 +++ src/parallel/gitter_pll_impl.h | 8 ++- src/parallel/gitter_pll_ldb.cc | 2 + src/parallel/gitter_pll_sti.cc | 11 ++- src/parallel/mpAccess_MPI.cc | 81 ++++++++++++++--------- src/parallel/mpAccess_MPI.h | 50 +++----------- src/serial/lock.h | 7 +- 7 files changed, 94 insertions(+), 76 deletions(-) diff --git a/src/duneinterface/gitter_dune_pll_impl.cc b/src/duneinterface/gitter_dune_pll_impl.cc index c31c50806..4e5167b6e 100644 --- a/src/duneinterface/gitter_dune_pll_impl.cc +++ b/src/duneinterface/gitter_dune_pll_impl.cc @@ -129,7 +129,12 @@ void GitterDunePll :: duneExchangeDynamicState () { const int nl = mpAccess ().nlinks () ; + +#ifndef NDEBUG + // if debug mode, then count time const int start = clock () ; +#endif + try { typedef Insert < AccessIteratorTT < hface_STI > :: InnerHandle, @@ -207,7 +212,9 @@ void GitterDunePll :: duneExchangeData (GatherScatterType & gs) // Regel hier eingeschleift werden. { const int nl = mpAccess ().nlinks () ; +#ifndef NDEBUG const int start = clock () ; +#endif try { typedef Insert < AccessIteratorTT < hface_STI > :: InnerHandle, @@ -602,7 +609,9 @@ void GitterDunePll :: coarse () { // vermerkt werden. Dann wird kein zweiter Versuch unternommen. a.second = false ; +#ifndef NDEBUG bool b = (*i)->accessPllX ().unlockAndResume (a.first) ; +#endif assert (b == a.first) ; } } @@ -617,7 +626,9 @@ void GitterDunePll :: coarse () { // vergr"obert werden darf und auch wird auf allen Teilgebieten also auch hier. Der // Vollzug der Vergr"oberung wird durch den R"uckgabewert getestet. +#ifndef NDEBUG bool b = (*i)->accessPllX ().unlockAndResume (bool (*j)) ; +#endif assert (b == bool (*j)) ; } }} diff --git a/src/parallel/gitter_pll_impl.h b/src/parallel/gitter_pll_impl.h index 60ec515b6..503e83cd9 100644 --- a/src/parallel/gitter_pll_impl.h +++ b/src/parallel/gitter_pll_impl.h @@ -1297,8 +1297,8 @@ template < class A > void BndsegPllBaseXClosure < A > :: readDynamicState (Objec template < class A > void BndsegPllBaseXClosure < A > :: readDynamicState (ObjectStream & os, int) { try { - int index; - assert( (true) ? (os.readObject( index ) , 1 ) : 1) ; + //int index; + //assert( (true) ? (os.readObject( index ) , 1 ) : 1) ; /* if(writeLogFile) { @@ -1312,8 +1312,10 @@ template < class A > void BndsegPllBaseXClosure < A > :: readDynamicState (Objec // read the real level of ghost os.readObject( _ghostLevel ); //logFile << "readLevel " << _ghostLevel << "\n"; - + +#ifndef NDEBUG int dimvx; +#endif assert( (true) ? (os.readObject( dimvx ), (dimvx == myhbnd().dimVx()) ? 1 : 0 ) : 1) ; double p[3]; diff --git a/src/parallel/gitter_pll_ldb.cc b/src/parallel/gitter_pll_ldb.cc index 5ed2cd291..9c3b4a536 100644 --- a/src/parallel/gitter_pll_ldb.cc +++ b/src/parallel/gitter_pll_ldb.cc @@ -161,7 +161,9 @@ static bool collectInsulatedNodes (const int nel, const float * const vertex_w, // periodischen Adapter nur indirekt, d.h. durch die Anzahl der abgehenden // Kanten, unterscheiden lassen (das ist aber ein zu schwaches Kriterium). +#ifndef NDEBUG const int ned = edge_p [nel] ; +#endif assert (edge_p [0] == 0) ; bool change = false ; for (int i = 0 ; i < nel ; i++ ) { diff --git a/src/parallel/gitter_pll_sti.cc b/src/parallel/gitter_pll_sti.cc index ca362083f..d0d1024e2 100644 --- a/src/parallel/gitter_pll_sti.cc +++ b/src/parallel/gitter_pll_sti.cc @@ -658,7 +658,9 @@ void GitterPll :: coarse () { // vermerkt werden. Dann wird kein zweiter Versuch unternommen. a.second = false ; +#ifndef NDEBUG bool b = (*i)->accessPllX ().unlockAndResume (a.first) ; +#endif assert (b == a.first) ; } } @@ -672,8 +674,10 @@ void GitterPll :: coarse () { // Selbe Situation wie oben, aber der Eigent"umer der Kante hat mitgeteilt, dass sie // vergr"obert werden darf und auch wird auf allen Teilgebieten also auch hier. Der // Vollzug der Vergr"oberung wird durch den R"uckgabewert getestet. - + +#ifndef NDEBUG bool b = (*i)->accessPllX ().unlockAndResume (bool (*j)) ; +#endif assert (b == bool (*j)) ; } }} @@ -777,7 +781,10 @@ void GitterPll :: exchangeDynamicState () { } { const int nl = mpAccess ().nlinks () ; + +#ifndef NDEBUG const int start = clock () ; +#endif try { vector < ObjectStream > osv (nl) ; {for (int l = 0 ; l < nl ; l ++) { @@ -827,7 +834,9 @@ void GitterPll :: exchangeStaticState () { // Zustand darf durch Verfeinerung und h"ohere Methoden nicht beeinflusst // sein. +#ifndef NDEBUG const int start = clock () ; +#endif try { const int nl = mpAccess ().nlinks () ; vector < ObjectStream > osv (nl) ; diff --git a/src/parallel/mpAccess_MPI.cc b/src/parallel/mpAccess_MPI.cc index 2e2f08ac0..b8b72e507 100644 --- a/src/parallel/mpAccess_MPI.cc +++ b/src/parallel/mpAccess_MPI.cc @@ -30,7 +30,7 @@ template < class A > vector < vector < A > > doGcollectV vector < vector < A > > res (np) ; { int ln = in.size () ; - int test = MPI_Allgather (& ln, 1, MPI_INT, rcounts, 1, MPI_INT, comm) ; + MY_INT_TEST MPI_Allgather (& ln, 1, MPI_INT, rcounts, 1, MPI_INT, comm) ; assert (test == MPI_SUCCESS) ; displ [0] = 0 ; {for (int j = 1 ; j < np ; j ++) { @@ -66,7 +66,7 @@ static vector < pair < char *, int > > doExchange (const vector < pair < char *, assert (req) ; { for (int link = 0 ; link < nl ; link ++) { - int test = MPI_Issend (in [link].first, in [link].second, MPI_BYTE, d [link], 123, comm, & req [link]) ; + MY_INT_TEST MPI_Issend (in [link].first, in [link].second, MPI_BYTE, d [link], 123, comm, & req [link]) ; assert (test == MPI_SUCCESS) ; } } @@ -74,14 +74,20 @@ static vector < pair < char *, int > > doExchange (const vector < pair < char *, for (int link = 0 ; link < nl ; link ++ ) { MPI_Status s ; int cnt ; - int test = MPI_Probe (d [link], 123, comm, & s) ; - assert (test == MPI_SUCCESS) ; - test = MPI_Get_count ( & s, MPI_BYTE, & cnt ) ; - assert (test == MPI_SUCCESS) ; + { + MY_INT_TEST MPI_Probe (d [link], 123, comm, & s) ; + assert (test == MPI_SUCCESS) ; + } + { + MY_INT_TEST MPI_Get_count ( & s, MPI_BYTE, & cnt ) ; + assert (test == MPI_SUCCESS) ; + } char * lne = new char [cnt] ; assert (lne) ; - test = MPI_Recv (lne, cnt, MPI_BYTE, d [link], 123, comm, & s) ; - assert (test == MPI_SUCCESS) ; + { + MY_INT_TEST MPI_Recv (lne, cnt, MPI_BYTE, d [link], 123, comm, & s) ; + assert (test == MPI_SUCCESS) ; + } out [link].first = lne ; out [link].second = cnt ; } @@ -89,7 +95,7 @@ static vector < pair < char *, int > > doExchange (const vector < pair < char *, { MPI_Status * sta = new MPI_Status [nl] ; assert (sta) ; - int test = MPI_Waitall (nl, req, sta) ; + MY_INT_TEST MPI_Waitall (nl, req, sta) ; assert (test == MPI_SUCCESS) ; delete [] sta ; } @@ -116,7 +122,7 @@ vector < vector < A > > doExchange (const vector < vector < A > > & in, assert (lne) ; copy (in [link].begin (), in [link].end (), lne) ; buf [link] = lne ; - int test = MPI_Issend (lne, size, mpiType, d [link], 123, comm, & req [link]) ; + MY_INT_TEST MPI_Issend (lne, size, mpiType, d [link], 123, comm, & req [link]) ; assert (test == MPI_SUCCESS) ; } } @@ -124,14 +130,22 @@ vector < vector < A > > doExchange (const vector < vector < A > > & in, for (int link = 0 ; link < nl ; link ++ ) { MPI_Status s ; int cnt ; - int test = MPI_Probe (d [link], 123, comm, & s) ; - assert (test == MPI_SUCCESS) ; - test = MPI_Get_count ( & s, mpiType, & cnt ) ; + { + MY_INT_TEST MPI_Probe (d [link], 123, comm, & s) ; + assert (test == MPI_SUCCESS) ; + } + + { + MY_INT_TEST MPI_Get_count ( & s, mpiType, & cnt ) ; assert (test == MPI_SUCCESS) ; + } + A * lne = new A [cnt] ; assert (lne) ; - test = MPI_Recv (lne, cnt, mpiType, d [link], 123, comm, & s) ; - assert (test == MPI_SUCCESS) ; + { + MY_INT_TEST MPI_Recv (lne, cnt, mpiType, d [link], 123, comm, & s) ; + assert (test == MPI_SUCCESS) ; + } copy (lne, lne + cnt, back_inserter (out[link])) ; delete [] lne ; } @@ -139,7 +153,10 @@ vector < vector < A > > doExchange (const vector < vector < A > > & in, { MPI_Status * sta = new MPI_Status [nl] ; assert (sta) ; - int test = MPI_Waitall (nl, req, sta) ; +#ifndef NDEBUG + MY_INT_TEST +#endif + MPI_Waitall (nl, req, sta) ; assert (test == MPI_SUCCESS) ; delete [] sta ; } @@ -152,86 +169,86 @@ vector < vector < A > > doExchange (const vector < vector < A > > & in, int MpAccessMPI :: gmax (int i) const { int j ; - int test = MPI_Allreduce (&i, &j, 1, MPI_INT, MPI_MAX, _mpiComm) ; + MY_INT_TEST MPI_Allreduce (&i, &j, 1, MPI_INT, MPI_MAX, _mpiComm) ; assert (test == MPI_SUCCESS) ; return j ; } int MpAccessMPI :: gmin (int i) const { int j ; - int test = MPI_Allreduce (&i, &j, 1, MPI_INT, MPI_MIN, _mpiComm) ; + MY_INT_TEST MPI_Allreduce (&i, &j, 1, MPI_INT, MPI_MIN, _mpiComm) ; assert (test == MPI_SUCCESS) ; return j ; } int MpAccessMPI :: gsum (int i) const { int j ; - int test = MPI_Allreduce (&i, &j, 1, MPI_INT, MPI_SUM, _mpiComm) ; + MY_INT_TEST MPI_Allreduce (&i, &j, 1, MPI_INT, MPI_SUM, _mpiComm) ; assert (test == MPI_SUCCESS) ; return j ; } long MpAccessMPI :: gmax (long i) const { long j ; - int test = MPI_Allreduce (&i, &j, 1, MPI_LONG, MPI_MAX, _mpiComm) ; + MY_INT_TEST MPI_Allreduce (&i, &j, 1, MPI_LONG, MPI_MAX, _mpiComm) ; assert (test == MPI_SUCCESS) ; return j ; } long MpAccessMPI :: gmin (long i) const { long j ; - int test = MPI_Allreduce (&i, &j, 1, MPI_LONG, MPI_MIN, _mpiComm) ; + MY_INT_TEST MPI_Allreduce (&i, &j, 1, MPI_LONG, MPI_MIN, _mpiComm) ; assert (test == MPI_SUCCESS) ; return j ; } long MpAccessMPI :: gsum (long i) const { long j ; - int test = MPI_Allreduce (&i, &j, 1, MPI_LONG, MPI_SUM, _mpiComm) ; + MY_INT_TEST MPI_Allreduce (&i, &j, 1, MPI_LONG, MPI_SUM, _mpiComm) ; assert (test == MPI_SUCCESS) ; return j ; } double MpAccessMPI :: gmax (double a) const { double x ; - int test = MPI_Allreduce (&a, &x, 1, MPI_DOUBLE, MPI_MAX, _mpiComm) ; + MY_INT_TEST MPI_Allreduce (&a, &x, 1, MPI_DOUBLE, MPI_MAX, _mpiComm) ; assert (test == MPI_SUCCESS) ; return x ; } double MpAccessMPI :: gmin (double a) const { double x ; - int test = MPI_Allreduce (&a, &x, 1, MPI_DOUBLE, MPI_MIN, _mpiComm) ; + MY_INT_TEST MPI_Allreduce (&a, &x, 1, MPI_DOUBLE, MPI_MIN, _mpiComm) ; assert (test == MPI_SUCCESS) ; return x ; } double MpAccessMPI :: gsum (double a) const { double x ; - int test = MPI_Allreduce (&a, &x, 1, MPI_DOUBLE, MPI_SUM, _mpiComm) ; + MY_INT_TEST MPI_Allreduce (&a, &x, 1, MPI_DOUBLE, MPI_SUM, _mpiComm) ; assert (test == MPI_SUCCESS) ; return x ; } void MpAccessMPI :: gmax (double* a,int size,double *x) const { - int test = MPI_Allreduce (a, x, size, MPI_DOUBLE, MPI_MAX, _mpiComm) ; + MY_INT_TEST MPI_Allreduce (a, x, size, MPI_DOUBLE, MPI_MAX, _mpiComm) ; assert (test == MPI_SUCCESS) ; } void MpAccessMPI :: gmin (double* a,int size,double *x) const { - int test = MPI_Allreduce (a, x, size, MPI_DOUBLE, MPI_MIN, _mpiComm) ; + MY_INT_TEST MPI_Allreduce (a, x, size, MPI_DOUBLE, MPI_MIN, _mpiComm) ; assert (test == MPI_SUCCESS) ; } void MpAccessMPI :: gsum (double* a,int size,double *x) const { - int test = MPI_Allreduce (a, x, size, MPI_DOUBLE, MPI_SUM, _mpiComm) ; + MY_INT_TEST MPI_Allreduce (a, x, size, MPI_DOUBLE, MPI_SUM, _mpiComm) ; assert (test == MPI_SUCCESS) ; } pair<double,double> MpAccessMPI :: gmax (pair<double,double> p) const { double x[2] ; double a[2]={p.first,p.second}; - int test = MPI_Allreduce (a, x, 2, MPI_DOUBLE, MPI_MAX, _mpiComm) ; + MY_INT_TEST MPI_Allreduce (a, x, 2, MPI_DOUBLE, MPI_MAX, _mpiComm) ; assert (test == MPI_SUCCESS) ; return pair<double,double>(x[0],x[1]) ; } @@ -239,7 +256,7 @@ pair<double,double> MpAccessMPI :: gmax (pair<double,double> p) const { pair<double,double> MpAccessMPI :: gmin (pair<double,double> p) const { double x[2] ; double a[2]={p.first,p.second}; - int test = MPI_Allreduce (a, x, 2, MPI_DOUBLE, MPI_MIN, _mpiComm) ; + MY_INT_TEST MPI_Allreduce (a, x, 2, MPI_DOUBLE, MPI_MIN, _mpiComm) ; assert (test == MPI_SUCCESS) ; return pair<double,double>(x[0],x[1]) ; } @@ -247,7 +264,7 @@ pair<double,double> MpAccessMPI :: gmin (pair<double,double> p) const { pair<double,double> MpAccessMPI :: gsum (pair<double,double> p) const { double x[2] ; double a[2]={p.first,p.second}; - int test = MPI_Allreduce (a, x, 2, MPI_DOUBLE, MPI_SUM, _mpiComm) ; + MY_INT_TEST MPI_Allreduce (a, x, 2, MPI_DOUBLE, MPI_SUM, _mpiComm) ; assert (test == MPI_SUCCESS) ; return pair<double,double>(x[0],x[1]) ; } @@ -293,7 +310,7 @@ vector < ObjectStream > MpAccessMPI :: gcollect (const ObjectStream & in) const { char * y = new char [bufSize] ; assert (y) ; - int test = MPI_Allgatherv (in._buf + in._rb, snum, MPI_BYTE, y, rcounts, displ, MPI_BYTE, _mpiComm) ; + MY_INT_TEST MPI_Allgatherv (in._buf + in._rb, snum, MPI_BYTE, y, rcounts, displ, MPI_BYTE, _mpiComm) ; assert (test == MPI_SUCCESS) ; {for (int i = 0 ; i < np ; i ++ ) { if (rcounts [i]) { diff --git a/src/parallel/mpAccess_MPI.h b/src/parallel/mpAccess_MPI.h index 42adc8331..7a41ab9da 100644 --- a/src/parallel/mpAccess_MPI.h +++ b/src/parallel/mpAccess_MPI.h @@ -1,36 +1,4 @@ - // (c) bernhard schupp 1997 - 1998 - - // $Source$ - // $Revision$ - // $Name$ - // $State$ - -/* $Id$ - * $Log$ - * Revision 1.1 2005/03/23 14:58:34 robertk - * all additional files for parallel version of ALU3dGrid. - * - * Revision 1.1 2004/10/25 16:39:54 robertk - * Some off the headers are old and changed from .hh to .h. - * All changes are made in the headers aswell. - * - * Some new file are the parallel grid files mostly have a _pll_ in then name. - * There some Constructors of Tetra and Hbdn3Top had to be adapted. - * - * Revision 1.7 2002/04/26 12:54:31 dedner - * Laufzeiterfassung - * - * Revision 1.6 2002/04/19 15:36:07 wesenber - * modifications required for IBM VisualAge C++ Version 5.0 - * - * Revision 1.5 2001/12/21 15:18:31 dedner - * GROSSER UMBAU: Berechnen von Adaptindikator und divBint und auch Zeitschritt bei Flussberechnung - * - * Revision 1.4 2001/12/10 13:56:37 wesenber - * RCS Log history and/or RCSId-variable added - * - ***/ - +// (c) bernhard schupp 1997 - 1998 #ifndef MPACCESS_MPI_H_INCLUDED #define MPACCESS_MPI_H_INCLUDED @@ -103,36 +71,40 @@ class MpAccessMPI : public MpAccessLocal { // # # ## # # # ## # // # # # ###### # # # ###### // - +#ifndef NDEBUG +#define MY_INT_TEST int test = +#else +#define MY_INT_TEST +#endif inline MpAccessMPI :: MpAccessMPI (MPI_Comm i) { - int test = MPI_Comm_dup (i, &_mpiComm) ; + MY_INT_TEST MPI_Comm_dup (i, &_mpiComm) ; assert (test == MPI_SUCCESS) ; return ; } inline MpAccessMPI :: MpAccessMPI (const MpAccessMPI & a) { - int test = MPI_Comm_dup (a._mpiComm, &_mpiComm) ; + MY_INT_TEST MPI_Comm_dup (a._mpiComm, &_mpiComm) ; assert (test == MPI_SUCCESS) ; return ; } inline MpAccessMPI :: ~MpAccessMPI () { - int test = MPI_Comm_free (&_mpiComm) ; + MY_INT_TEST MPI_Comm_free (&_mpiComm) ; assert (test == MPI_SUCCESS) ; return ; } inline int MpAccessMPI :: psize () const { int i ; - int test = MPI_Comm_size (_mpiComm, & i) ; + MY_INT_TEST MPI_Comm_size (_mpiComm, & i) ; assert (test == MPI_SUCCESS) ; return i ; } inline int MpAccessMPI :: myrank () const { int i ; - int test = MPI_Comm_rank (_mpiComm, & i) ; + MY_INT_TEST MPI_Comm_rank (_mpiComm, & i) ; assert (test == MPI_SUCCESS) ; return i ; } diff --git a/src/serial/lock.h b/src/serial/lock.h index 4e27a2d9c..2ad9d4aed 100644 --- a/src/serial/lock.h +++ b/src/serial/lock.h @@ -37,7 +37,12 @@ inline FSLock :: FSLock (const char * name) : _fname (0) { _fname = 0 ; cerr << "**WARNUNG (IGNORIERT) Lockfile konnte nicht erzeugt werden" << endl ; } else { - int test = fclose (fp) ; + + // only test in debug mode +#ifndef NDEBUG + int test = +#endif + fclose (fp) ; assert (test == 0) ; } return ; -- GitLab