Commit 2bfd6e1a authored by Ondrej Vysocky's avatar Ondrej Vysocky
Browse files

ENH merge #50 #38

parents 737a8195 c6cfee3b
......@@ -4,6 +4,7 @@ build
*.so
*.o
*.a
*.mod
test/mericMeasurement*
test/hdeemMeasurement*
tools/__pycache__/
......@@ -11,6 +12,8 @@ tools/jetsonMeasurement/
tools/yokogawaMeasurement/
tools/staticMERICtool/energyMeasureStart
tools/staticMERICtool/energyMeasureStop
tools/DBI/*
include/meric
test/sleepTest
test/test_mpi
......
### XX.XX.XXXX #################################################################
- new Dynamic Binary Instrymentation (DBI) tool for MERIC instrumentation
- new MERIC API RAII function for scope measurement MERIC_captureScope(const char * region)
- barriers turn off available not only for production runs
- new MERIC_MODE=6 stores only regions runtime
- MERIC_MeasureStop() and MERIC_MeasureStopStart() now returns runtime of the stopped region
- new instrument.h
+ new version of readex.h, not backward compatible (new functions parameters)
+ support for MERIC, Score-P, TIMEPROF, GEOPM, TAU
- new function runtime profiling library TIMEPROF is now part of the repository
### 05.06.2018 #################################################################
- fixed single RAPL overflow
- HDEEM error handled without writing zero values into output files
......
......@@ -23,26 +23,32 @@ INCLUDES_JETSON= $(PAPI_INC_JETSON) $(X86A_INC_JETSON) $(CPUFREQ_INC_JETSON) $(F
LIBPATH_JETSON= $(PAPI_LIB_JETSON) $(X86A_LIB_JETSON) $(CPUFREQ_LIB_JETSON) $(FREEIPMI_LIB_JETSON)
## DAVIDE ######################################################################
CPUFREQ_INC_DAVIDE=-I/davide/home/userexternal/lriha000/cpufrequtils-008/lib/
CPUFREQ_LIB_DAVIDE=-L/davide/home/userexternal/lriha000/cpufrequtils-008/
CPUFREQ_INC_DAVIDE=-I$(HOME)/cpufrequtils-008/lib/
CPUFREQ_LIB_DAVIDE=-L$(HOME)/cpufrequtils-008/
INCLUDES_DAVIDE=-I/davide/home/userexternal/lriha000/json/single_include/ -I/davide/home/userexternal/lriha000/rest-client/include/ $(CPUFREQ_INC_DAVIDE)
LIBPATH_DAVIDE=-L/davide/home/userexternal/lriha000/rest-client/libs/ -lrestclient-cpp $(CPUFREQ_LIB_DAVIDE)
INCLUDES_DAVIDE=-I$(HOME)/json/single_include/ -I$(HOME)/rest-client/include/ $(CPUFREQ_INC_DAVIDE)
LIBPATH_DAVIDE=-L$(HOME)/rest-client/libs/ -lrestclient-cpp $(CPUFREQ_LIB_DAVIDE)
################################################################################
INCLUDES_MERIC= $(INCLUDES_DAVIDE)
LIBPATH_MERIC= $(LIBPATH_DAVIDE)
INCLUDES_MERIC=
LIBPATH_MERIC=
unexport CXX
ifeq ($(FC),ifort)
FORTFLAGS=-module
else
FORTFLAGS=-J
endif
all:
make configure
make install
configure:
./waf configure --cpp=icpc --mpi=mpiicpc --flag="$(LIBPATH_MERIC) $(INCLUDES_MERIC)" # -DVERBOSE"
./waf configure --cpp=icpc --mpi=mpiicpc --flag="$(LIBPATH_MERIC) $(INCLUDES_MERIC)"
install:
./waf install
./waf install
i:
make install
......@@ -50,12 +56,15 @@ i:
ddt:
make love
./waf configure --cpp=icpc --mpi=mpiicpc --flag="$(LIBPATH_MERIC) $(INCLUDES_MERIC) -O0 -g" --verbose
make install
./waf install -v
gcc:
./waf configure --withgcc --cpp=g++ --flag="$(LIBPATH_MERIC) $(INCLUDES_MERIC) -DVERBOSE"
make install
fortran:
$(FC) -c include/meric_mod.F90 $(FORTFLAGS) include/ -o include/meric_mod.o
arm:
./waf configure --withgcc --cpp=g++ --flag="$(LIBPATH_JETSON) $(INCLUDES_JETSON)" --dummy
make install
......
This diff is collapsed.
......@@ -6,15 +6,25 @@
extern "C" {
#endif
void MERIC_Init();
void MERIC_Close();
void MERIC_Init();
void MERIC_Close();
void MERIC_MeasureStart(const char* region);
void MERIC_MeasureStop();
void MERIC_MeasureStopStart(const char* region);
void MERIC_MeasureStart(const char* region);
double MERIC_MeasureStop();
double MERIC_MeasureStopStart(const char* region);
void MERIC_IgnoreStart();
void MERIC_IgnoreStop();
void MERIC_IgnoreStart();
void MERIC_IgnoreStop();
//void MERIC_captureScope(const char * region);
//RAII scope measurement - it does not return time
void MERIC_scopeEnd(const char ** region)
{
MERIC_MeasureStop();
}
#define MERIC_captureScope( region ) \
MERIC_MeasureStart( region ); \
const char * tmp __attribute__((cleanup(MERIC_scopeEnd))) = region;
#ifdef __cplusplus
}
......
USE, INTRINSIC :: ISO_C_BINDING
IMPLICIT NONE
INTERFACE
SUBROUTINE MERIC_Init() &
BIND(c,NAME='MERIC_Init')
END SUBROUTINE MERIC_Init
SUBROUTINE MERIC_Close() &
BIND(c,NAME='MERIC_Close')
END SUBROUTINE MERIC_Close
SUBROUTINE MERIC_IgnoreStart() &
BIND(c,NAME='MERIC_IgnoreStart')
END SUBROUTINE MERIC_IgnoreStart
SUBROUTINE MERIC_IgnoreStop() &
BIND(c,NAME='MERIC_IgnoreStop')
END SUBROUTINE MERIC_IgnoreStop
SUBROUTINE MERIC_MeasureStart(reg_name) &
BIND(c,NAME='MERIC_MeasureStart')
IMPORT C_CHAR
CHARACTER(KIND=C_CHAR) :: reg_name(*)
END SUBROUTINE MERIC_MeasureStart
SUBROUTINE MERIC_MeasureStop() &
BIND(c,NAME='MERIC_MeasureStop')
END SUBROUTINE MERIC_MeasureStop
END INTERFACE
/**
* Shared intarface for MERIC and Score-P libraries
* Shared interface for MERIC and Score-P libraries
*
* version 3.4
* 19.02.2018
* version 3.6
* 28.11.2018
* Ondrej Vysocky, ondrej.vysocky@vsb.cz
* IT4Innovations national supercomputing center, Czech Republic
**/
......@@ -17,6 +17,7 @@
#ifdef USE_SCOREP
#include <scorep/SCOREP_User.h>
#include <scorep/SCOREP_User_Types.h>
//function that allows user to use MERIC's stop functions return value (region runtime)
#endif
#ifdef USE_MERIC
......@@ -96,28 +97,31 @@
//READEX_REGION_STOP(handle)
#ifdef USE_SCOREP_MANUAL
#define READEX_REGION_STOP( handle ) \
0.0; \
SCOREP_USER_REGION_END( handle );
#elif defined USE_MERIC
#define READEX_REGION_STOP( handle ) \
MERIC_MeasureStop();
#else
#define READEX_REGION_STOP( handle )
#define READEX_REGION_STOP( handle ) \
0.0;
#endif
//READEX_REGION_STOP_START(stop_handle, start_handle, start_name, start_type)
#ifdef USE_SCOREP_MANUAL
#define READEX_REGION_STOP_START( stop_handle, start_handle, start_name, start_type ) \
0.0; \
SCOREP_USER_REGION_END( stop_handle ); \
SCOREP_USER_REGION_BEGIN( start_handle, start_name, start_type );
#elif defined USE_MERIC
#define READEX_REGION_STOP_START( stop_handle, start_handle, start_name, start_type ) \
MERIC_MeasureStopStart( start_name );
#else
#define READEX_REGION_STOP_START( stop_handle, start_handle, start_name, start_type )
#define READEX_REGION_STOP_START( stop_handle, start_handle, start_name, start_type ) \
0.0;
#endif
//READEX_PHASE_START(handle, name, type)
#ifdef USE_SCOREP
#define READEX_PHASE_START( handle, name, type ) \
......@@ -132,12 +136,14 @@
//READEX_PHASE_STOP(handle)
#ifdef USE_SCOREP
#define READEX_PHASE_STOP( handle ) \
0.0; \
SCOREP_USER_OA_PHASE_END( handle );
#elif defined USE_MERIC
#define READEX_PHASE_STOP( handle ) \
MERIC_MeasureStop();
#else
#define READEX_PHASE_STOP( handle )
#define READEX_PHASE_STOP( handle ) \
0.0;
#endif
//List of Score-P API functions (SCOREP_User.h) that will be ignored if the code is not compiled with Score-P
......@@ -174,4 +180,8 @@
#define SCOREP_RECORDING_IS_ON() 0
#endif
#ifndef USE_MERIC
#define MERIC_captureScope( region )
#endif
#endif /* READEX_H_ */
#ifndef TIMEPROF_H_
#define TIMEPROF_H_
#ifdef __cplusplus
extern "C" {
#endif
void TIMEPROF_regionStart (const char * regionName);
double TIMEPROF_regionStop (const char * regionName);
void TIMEPROF_evaluate (unsigned int timeThrashold = 0, const char * fileName = "");
double TIMEPROF_getLastRegionDuration();
//void TIMEPROF_captureScope(const char * regionName);
//RAII scope measurement - it does not return time, can be read using TIMEPROF_getLastRegionDuration()
void TIMEPROF_scopeEnd(const char ** regionName)
{
TIMEPROF_regionStop (*regionName);
}
#define TIMEPROF_captureScope( regionName ) \
TIMEPROF_regionStart (regionName); \
const char * tmp __attribute__((cleanup(TIMEPROF_scopeEnd))) = regionName;
#ifdef __cplusplus
}
#endif
#endif // TIMEPROF_H_
......@@ -55,14 +55,14 @@ void MERIC_MeasureStart(const char* name)
holder->start(name);
}
void MERIC_MeasureStop()
double MERIC_MeasureStop()
{
holder->stop();
return holder->stop();
}
void MERIC_MeasureStopStart(const char* name)
double MERIC_MeasureStopStart(const char* name)
{
holder->stopStart(name);
return holder->stopStart(name);
}
void MERIC_IgnoreStart()
......
......@@ -196,7 +196,18 @@ DistributedMeric::DistributedMeric()
_storeList.back()->setMPIWrite(true);
}
}
if (_storeList.size() > 0 || Meric::MODE == MODE_TIME)
{
if(Meric::AGGREGATE)
{
_storeList.insert(_storeList.begin(), new InfoAggregateStore<InfoStore>(_storingProcs));
_storeList.front()->setMPIWrite(!_MPInodeRank);
}
else
_storeList.insert(_storeList.begin(), new InfoStore(!_MPInodeRank));
}
//INIT
if (Meric::MODE == MODE_JETSON)
Environment::init(SYS_JETSON, defaultParameter, _MPInodeRank);
......
......@@ -10,6 +10,7 @@
#include "../../store/aggregated/detailedaggregatestore.h"
#include "../../store/aggregated/debugaggregatestore.h"
#include "../../store/aggregated/countersaggregatestore.h"
#include "../../store/aggregated/infoaggregatestore.h"
namespace meric {
......@@ -21,11 +22,14 @@ public:
void start(const std::string &region)
{
if (_storeList[0]->getMPIWrite())
MERIC_INFO << "region '" << region << "' starting\n";
#pragma omp master
if (OMPbarriers)
{
#pragma omp barrier
}
#pragma omp single nowait
{
if (_storeList[0]->getMPIWrite())
MERIC_INFO << "region '" << region << "' starting\n";
SocketsRegionParameters change = regionValue(currentState, region, _nodeId);
if (MPIbarriers)
MPI_Barrier(_currentNode);
......@@ -33,54 +37,71 @@ public:
}
if (Meric::IGNORE)
return;
#pragma omp master
#pragma omp single nowait
{
if (!ignoreRegion(region))
Meric::start(region);
_stack.push_back(getRegionID(region));
}
if (OMPbarriers)
{
#pragma omp barrier
}
}
void stop()
double stop()
{
if (_storeList[0]->getMPIWrite())
MERIC_INFO << "region '" << getRegionName(_stack.size(), _stack.back()) << "' stopping\n";
#pragma omp master
double regionRuntime = 0.0;
if (OMPbarriers)
{
#pragma omp barrier
}
#pragma omp single nowait
{
if (_storeList[0]->getMPIWrite())
MERIC_INFO << "region '" << getRegionName(_stack.size(), _stack.back()) << "' stopping\n";
SocketsRegionParameters change = regionValue(currentState, getRegionName(_stack.size()-1, _stack.back()-1), _nodeId);
if (MPIbarriers)
MPI_Barrier(_currentNode);
setRegionEnvironment(change, !_MPInodeRank);
}
if (Meric::IGNORE)
return;
#pragma omp master
return 0.0;
#pragma omp single nowait
{
if (!ignoreRegion(getRegionName(_stack.size(), _stack.back())))
{
if (!_stack.size())
{
std::cerr << "MERIC ERROR: Incorrect regions. There are more 'ends' than 'starts'!\n";
regionRuntime = -1.0;
}
else
{
Meric::stop();
regionRuntime = Meric::stop();
_stack.pop_back();
}
}
else
_stack.pop_back();
}
if (OMPbarriers)
{
#pragma omp barrier
}
return regionRuntime;
}
void stopStart(const std::string &region)
double stopStart(const std::string &region)
{
MERIC_INFO << "region '" << getRegionName(_stack.size(), _stack.back()) << "' stopping and staring region'" << region << "'\n";
#pragma omp master
double regionRuntime = 0.0;
if (OMPbarriers)
{
#pragma omp barrier
}
#pragma omp single nowait
{
MERIC_INFO << "region '" << getRegionName(_stack.size(), _stack.back()) << "' stopping and staring region'" << region << "'\n";
SocketsRegionParameters change = regionValue(currentState, region, _nodeId);
if (MPIbarriers)
MPI_Barrier(_currentNode);
......@@ -88,23 +109,28 @@ public:
}
if (Meric::IGNORE)
return;
return 0.0;
if (!_stack.size())
{
#pragma omp single
#pragma omp single nowait
std::cerr << "MERIC ERROR: Incorrect regions. There are more 'ends' than 'starts'!\n";
return;
return -1.0;
}
#pragma omp master
#pragma omp single nowait
{
if (!ignoreRegion(getRegionName(_stack.size(), _stack.back())))
Meric::stop();
regionRuntime = Meric::stop();
_stack.pop_back();
if (!ignoreRegion(region))
Meric::start(region);
_stack.push_back(getRegionID(region));
}
if (OMPbarriers)
{
#pragma omp barrier
}
return regionRuntime;
}
void startIgnore()
......
......@@ -87,23 +87,23 @@ int Meric::getDefaultParameters()
Meric::MODE = MODE_HDEEM;
}
if (Meric::MODE == MODE_RUN && Meric::BARRIERS != "all")
if (Meric::BARRIERS != "all")
{
if (Meric::BARRIERS == "mpi")
{
Meric::OMPbarriers = false;
MERIC_INFO << "MERIC WARNING: OpenMP BARRIERS turned off\n";
std::cerr << "MERIC WARNING: OpenMP BARRIERS turned off\n";
}
else if (Meric::BARRIERS == "omp")
{
Meric::MPIbarriers = false;
MERIC_INFO << "MERIC WARNING: MPI BARRIERS turned off\n";
std::cerr << "MERIC WARNING: MPI BARRIERS turned off\n";
}
else if (Meric::BARRIERS == "none")
{
Meric::OMPbarriers = false;
Meric::MPIbarriers = false;
MERIC_INFO << "MERIC WARNING: BARRIERS turned off\n";
std::cerr << "MERIC WARNING: BARRIERS turned off\n";
}
}
......
......@@ -18,6 +18,7 @@
#include "../store/detailedtimestore.h"
#include "../store/timeenergystore.h"
#include "../store/countersstore.h"
#include "../store/infostore.h"
#include "../wrapper/environmentwrapper.h"
#include "../wrapper/perfeventwrapper.h"
......@@ -54,7 +55,7 @@ public:
MERIC_INFO << "region '" << region << "' started\n";
}
virtual void stop()
virtual double stop()
{
//stop should be in opposite order as start
//if MERIC_CONTINUAL is used, we want to start it first and stop it last
......@@ -63,9 +64,14 @@ public:
if (_storeList[i]->getMPIWrite())
_storeList[i]->addEnd(_stack.back());
}
if (_storeList[0]->getMPIWrite())
MERIC_INFO << "region '" << getRegionName(_stack.size(), _stack.back()) << "' stopped\n";
if (_storeList.size() && _storeList[0]->getMPIWrite())
//infostore is allways the first store in the list
//only the infostore returns the region runtime, other return 0.0
return _storeList[0]->getRegionDuration();
else
return 0.0;
}
virtual void startIgnore()
......@@ -77,7 +83,7 @@ public:
{
#pragma omp barrier
}
#pragma omp single
#pragma omp single nowait
{
if (IGNORE)
std::cerr << "MERIC WARNING: starting nested MERIC ignore sections not supported\n";
......@@ -102,7 +108,7 @@ public:
{
#pragma omp barrier
}
#pragma omp single
#pragma omp single nowait
{
if (!IGNORE)
std::cerr << "MERIC WARNING: stopping already stopped MERIC ignore section\n";
......
......@@ -40,14 +40,14 @@ void MERIC_MeasureStart(const char* name)
holder->start(name);
}
void MERIC_MeasureStop()
double MERIC_MeasureStop()
{
holder->stop();
return holder->stop();
}
void MERIC_MeasureStopStart(const char* name)
double MERIC_MeasureStopStart(const char* name)
{
holder->stopStart(name);
return holder->stopStart(name);
}
void MERIC_IgnoreStart()
......
......@@ -60,6 +60,9 @@ SharedMeric::SharedMeric()
_storeList.push_back(new CountersStore<PAPI, unsigned long long int>(Meric::SAMPLES));
}
if (_storeList.size() > 0 || Meric::MODE == MODE_TIME)
_storeList.insert(_storeList.begin(), new InfoStore());
for (int i=0; i<_storeList.size(); i++)
_storeList[i]->setMPIWrite(true);
......
......@@ -13,87 +13,116 @@ public:
void start(const std::string &region)
{
MERIC_INFO << "region '" << region << "' starting\n";
timespec spectime1, spectime2;
clock_gettime(CLOCK_REALTIME, &spectime1);
#pragma omp master
if (OMPbarriers)
{
#pragma omp barrier
}
#pragma omp single nowait
{
MERIC_INFO << "region '" << region << "' starting\n";
clock_gettime(CLOCK_REALTIME, &spectime1);
SocketsRegionParameters change = regionValue(currentState, region);
setRegionEnvironment(change);
clock_gettime(CLOCK_REALTIME, &spectime2);
MERIC_INFO << "MERIC settings changed in " << mutils::timeToDouble(spectime2 - spectime1)*1000 << " ms\n";
}
clock_gettime(CLOCK_REALTIME, &spectime2);
MERIC_INFO << "MERIC settings changed in " << mutils::timeToDouble(spectime2 - spectime1)*1000 << " ms\n";
//startRegionEnvironment(region);
if (Meric::IGNORE)
return;
#pragma omp master
#pragma omp single nowait
{
if (!ignoreRegion(region))
Meric::start(region);
_stack.push_back(getRegionID(region));
clock_gettime(CLOCK_REALTIME, &spectime1);
MERIC_INFO << "MERIC status recorded in " << mutils::timeToDouble(spectime1 - spectime2)*1000 << " ms\n";
}
if (OMPbarriers)
{
#pragma omp barrier
}
clock_gettime(CLOCK_REALTIME, &spectime1);
MERIC_INFO << "MERIC status recorded in " << mutils::timeToDouble(spectime1 - spectime2)*1000 << " ms\n";
}
void stop()
double stop()
{
MERIC_INFO << "region '" << getRegionName(_stack.size(), _stack.back()) << "' stopping\n";
#pragma omp master
double regionRuntime = 0.0;
if (OMPbarriers)
{
#pragma omp barrier
}