From 6b5612304d161e1de3d76f71fd6b5d503d511f9b Mon Sep 17 00:00:00 2001 From: secher Date: Wed, 18 Mar 2009 15:42:09 +0000 Subject: [PATCH] add test for perf measures --- src/ParaMEDMEM/Test/Makefile.am | 4 +- src/ParaMEDMEM/Test/test_perf.cxx | 316 ++++++++++++++++++++++++++++++ 2 files changed, 319 insertions(+), 1 deletion(-) create mode 100644 src/ParaMEDMEM/Test/test_perf.cxx diff --git a/src/ParaMEDMEM/Test/Makefile.am b/src/ParaMEDMEM/Test/Makefile.am index c10555ebe..b00a9498c 100644 --- a/src/ParaMEDMEM/Test/Makefile.am +++ b/src/ParaMEDMEM/Test/Makefile.am @@ -72,11 +72,13 @@ libParaMEDMEMTest_la_LDFLAGS= ../MEDLoader/libparamedmemmedloader.la @CPPUNIT_LI # Executables targets bin_PROGRAMS = TestParaMEDMEM \ TestMPIAccessDEC \ - TestMPIAccess + TestMPIAccess \ + test_perf dist_TestParaMEDMEM_SOURCES = TestParaMEDMEM.cxx dist_TestMPIAccessDEC_SOURCES = TestMPIAccessDEC.cxx dist_TestMPIAccess_SOURCES = TestMPIAccess.cxx +dist_test_perf_SOURCES = test_perf.cxx LDADD= $(MED2_LIBS) $(libMEDMEMTest_la_LDFLAGS) -lm $(MPI_LIBS) \ ../libparamedmem.la libParaMEDMEMTest.la \ diff --git a/src/ParaMEDMEM/Test/test_perf.cxx b/src/ParaMEDMEM/Test/test_perf.cxx new file mode 100644 index 000000000..6720d1173 --- /dev/null +++ b/src/ParaMEDMEM/Test/test_perf.cxx @@ -0,0 +1,316 @@ +#include +#include +#include +#include "ParaMEDMEMTest.hxx" +#include + +#include "CommInterface.hxx" +#include "ProcessorGroup.hxx" +#include "MPIProcessorGroup.hxx" +#include "Topology.hxx" +#include "DEC.hxx" +#include "MxN_Mapping.hxx" +#include "IntersectionDEC.hxx" +#include "ParaMESH.hxx" +#include "ParaFIELD.hxx" +#include "ICoCoMEDField.hxx" +#include "MEDLoader.hxx" + +#include + +// use this define to enable lines, execution of which leads to Segmentation Fault +#define ENABLE_FAULTS + +// use this define to enable CPPUNIT asserts and fails, showing bugs +#define ENABLE_FORCED_FAILURES + +#ifndef CLK_TCK +#include +#define CLK_TCK sysconf(_SC_CLK_TCK); +#endif + +using namespace std; +using namespace ParaMEDMEM; + +void testIntersectionDEC_2D(const string& filename1, const string& meshname1, + const string& filename2, const string& meshname2, + int nproc_source, double epsilon, bool tri, bool all); +void get_time( float *telps, float *tuser, float *tsys, float *tcpu ); + +int main(int argc, char *argv[]) +{ + string filename1, filename2; + string meshname1, meshname2; + int nproc_source=1, rank; + double epsilon=1.e-6; + int count=0; + bool tri=false; + bool all=false; + + MPI_Init(&argc,&argv); + + for(int i=1;i self_procs; + set procs_source; + set procs_target; + + for (int i=0; icontainsMyRank()){ + string master = filename_xml1; + + ostringstream strstream; + if( nproc_source == 1 ) + strstream <getNumberOfCells(); + double *value=parafield->getField()->getArray()->getPointer(); + for(int ielem=0; ielemcontainsMyRank()){ + string master= filename_xml2; + ostringstream strstream; + if( (size-nproc_source) == 1 ) + strstream << master<<".med"; + else + strstream << master<<(rank-nproc_source+1)<<".med"; + ostringstream meshname ; + if( (size-nproc_source) == 1 ) + meshname<< meshname2; + else + meshname<< meshname2<<"_"<incrRef(); + + paramesh=new ParaMESH (mesh,*target_group,"target mesh"); + ParaMEDMEM::ComponentTopology comptopo; + parafield = new ParaFIELD(ON_CELLS,paramesh, comptopo); + + int nb_local=mesh->getNumberOfCells(); + double *value=parafield->getField()->getArray()->getPointer(); + for(int ielem=0; ielemcontainsMyRank()){ + field_before_int = parafield->getVolumeIntegral(0); + get_time( &telps, &tcpu_u, &tcpu_s, &tcpu ); + dec.synchronize(); + get_time( &telps, &tcpu_u, &tcpu_s, &tcpu ); + if( rank == 0 ) + cout << "SYNCHRONIZE : Telapse = " << telps << " TuserCPU = " << tcpu_u << " TsysCPU = " << tcpu_s << " TCPU = " << tcpu << endl; + cout<<"DEC usage"<