From 85a48758a3e0ddca44ae06125fd99a1f9ed39014 Mon Sep 17 00:00:00 2001 From: "hanouvit@vz" <vithanousek@seznam.cz> Date: Mon, 18 Sep 2017 21:57:08 +0200 Subject: [PATCH] Improve of Distributed Grid Performance Testing Application --- src/TNL/Meshes/DistributedGrid.h | 28 +++++++++++++++++++-------- tests/mpi/CMakeLists.txt | 26 +++++++++++++++++++++++++ tests/mpi/MeshFunctionEvauateTest.cpp | 27 ++++++++++++++++++++++---- 3 files changed, 69 insertions(+), 12 deletions(-) diff --git a/src/TNL/Meshes/DistributedGrid.h b/src/TNL/Meshes/DistributedGrid.h index 0a06fdf23e..2df74f4b3a 100644 --- a/src/TNL/Meshes/DistributedGrid.h +++ b/src/TNL/Meshes/DistributedGrid.h @@ -165,10 +165,7 @@ class DistributedGrid <GridType,1> else localsize.x()+=2*overlap.x(); - } - - - + } }; void SetupGrid( GridType& grid) @@ -182,9 +179,14 @@ class DistributedGrid <GridType,1> void printcoords(std::ostream& out) { - out<<rank<<":" <<std::endl; + out<<rank<<":"; }; - + + void printdistr(std::ostream& out) + { + out<<"("<<nproc<<"):"; + }; + bool isMPIUsed(void) { return this->mpiInUse; @@ -394,7 +396,12 @@ class DistributedGrid <GridType,2> void printcoords(std::ostream& out) { - out<<"("<<myproccoord[0]<<","<<myproccoord[1]<<"):" <<std::endl; + out<<"("<<myproccoord[0]<<","<<myproccoord[1]<<"):"; + }; + + void printdistr(std::ostream& out) + { + out<<"("<<procsdistr[0]<<","<<procsdistr[1]<<"):"; }; bool isMPIUsed(void) @@ -692,7 +699,12 @@ class DistributedGrid <GridType,3> void printcoords(std::ostream& out ) { - out<<"("<<myproccoord[0]<<","<<myproccoord[1]<<","<<myproccoord[2]<<"):" <<std::endl; + out<<"("<<myproccoord[0]<<","<<myproccoord[1]<<","<<myproccoord[2]<<"):"; + }; + + void printdistr(std::ostream& out) + { + out<<"("<<procsdistr[0]<<","<<procsdistr[1]<<","<<procsdistr[2]<<"):"; }; bool isMPIUsed(void) diff --git a/tests/mpi/CMakeLists.txt b/tests/mpi/CMakeLists.txt index d698bc64ea..6f38e4efb6 100644 --- a/tests/mpi/CMakeLists.txt +++ b/tests/mpi/CMakeLists.txt @@ -1,4 +1,30 @@ ADD_EXECUTABLE( tnlMeshFuncttionEvaluateTest${debugExt} ${headers} MeshFunctionEvauateTest.cpp ) TARGET_LINK_LIBRARIES( tnlMeshFuncttionEvaluateTest${debugExt} ${CPPUNIT_LIBRARIES} tnl${mpiExt}${debugExt}-0.1 ) + TARGET_COMPILE_DEFINITIONS( tnlMeshFuncttionEvaluateTest${debugExt} PUBLIC "-DDIMENSION=2" ) + TARGET_COMPILE_DEFINITIONS( tnlMeshFuncttionEvaluateTest${debugExt} PUBLIC "-DXDISTR -DYDISTR" ) + + ADD_EXECUTABLE( tnlMeshFuncttionEvaluateTestX${debugExt} ${headers} MeshFunctionEvauateTest.cpp ) + TARGET_LINK_LIBRARIES( tnlMeshFuncttionEvaluateTestX${debugExt} ${CPPUNIT_LIBRARIES} + tnl${mpiExt}${debugExt}-0.1 ) + TARGET_COMPILE_DEFINITIONS( tnlMeshFuncttionEvaluateTestX${debugExt} PUBLIC "-DDIMENSION=2" ) + TARGET_COMPILE_DEFINITIONS( tnlMeshFuncttionEvaluateTestX${debugExt} PUBLIC "-DXDISTR" ) + + ADD_EXECUTABLE( tnlMeshFuncttionEvaluateTestY${debugExt} ${headers} MeshFunctionEvauateTest.cpp ) + TARGET_LINK_LIBRARIES( tnlMeshFuncttionEvaluateTestY${debugExt} ${CPPUNIT_LIBRARIES} + tnl${mpiExt}${debugExt}-0.1 ) + TARGET_COMPILE_DEFINITIONS( tnlMeshFuncttionEvaluateTestY${debugExt} PUBLIC "-DDIMENSION=2" ) + TARGET_COMPILE_DEFINITIONS( tnlMeshFuncttionEvaluateTestY${debugExt} PUBLIC "-DYDISTR" ) + + #ADD_EXECUTABLE( tnlMeshFuncttionEvaluateTestZ${debugExt} ${headers} MeshFunctionEvauateTest.cpp ) + #TARGET_LINK_LIBRARIES( tnlMeshFuncttionEvaluateTestZ${debugExt} ${CPPUNIT_LIBRARIES} + # tnl${mpiExt}${debugExt}-0.1 ) + #TARGET_COMPILE_DEFINITIONS( tnlMeshFuncttionEvaluateTestZ${debugExt} PUBLIC "-DDIMENSION=3" ) + #TARGET_COMPILE_DEFINITIONS( tnlMeshFuncttionEvaluateTestZ${debugExt} PUBLIC "-DZDISTR" ) + + #ADD_EXECUTABLE( tnlMeshFuncttionEvaluateTestXY${debugExt} ${headers} MeshFunctionEvauateTest.cpp ) + #TARGET_LINK_LIBRARIES( tnlMeshFuncttionEvaluateTestXY${debugExt} ${CPPUNIT_LIBRARIES} + # tnl${mpiExt}${debugExt}-0.1 ) + #TARGET_COMPILE_DEFINITIONS( tnlMeshFuncttionEvaluateTestXY${debugExt} PUBLIC "-DDIMENSION=3" ) + #TARGET_COMPILE_DEFINITIONS( tnlMeshFuncttionEvaluateTestXY${debugExt} PUBLIC "-DXDISTR -DYDISTR" ) diff --git a/tests/mpi/MeshFunctionEvauateTest.cpp b/tests/mpi/MeshFunctionEvauateTest.cpp index 08109465b8..b4908a1b4b 100644 --- a/tests/mpi/MeshFunctionEvauateTest.cpp +++ b/tests/mpi/MeshFunctionEvauateTest.cpp @@ -24,9 +24,11 @@ using namespace std; #include <TNL/Timer.h> -#define DIMENSION 2 +//#define DIMENSION 2 //#define OUTPUT - +//#define XDISTR +//#define YDISTR +//#define ZDISTR #include "../../src/UnitTests/Mpi/Functions.h" @@ -83,7 +85,20 @@ int main ( int argc, char *argv[]) int distr[DIMENSION]; for(int i=0;i<DIMENSION;i++) - distr[i]=0; + distr[i]=1; + + #ifdef XDISTR + distr[0]=0; + #endif + + #ifdef YDISTR + distr[1]=0; + #endif + + #ifdef ZDISTR + distr[2]=0; + #endif + DistributedGridType distrgrid(globalGrid, distr); SharedPointer<MeshType> gridptr; @@ -136,7 +151,11 @@ int main ( int argc, char *argv[]) if(MPI::COMM_WORLD.Get_rank()==0) { cout << sum <<endl<<endl; - + + cout<<"distr: "; + distrgrid.printdistr(cout); + cout << endl; + cout<<"setup: "<<setup.getRealTime() <<endl; cout<<"evalpercycle: "<<eval.getRealTime()/cycles<<endl; cout<<"syncpercycle: "<<sync.getRealTime()/cycles<<endl; -- GitLab