mirror of
https://github.com/paboyle/Grid.git
synced 2025-04-09 21:50:45 +01:00
Namespace, format
This commit is contained in:
parent
7e70f4ed9c
commit
c01a1e02fe
@ -1,4 +1,4 @@
|
|||||||
/*************************************************************************************
|
/*************************************************************************************
|
||||||
|
|
||||||
Grid physics library, www.github.com/paboyle/Grid
|
Grid physics library, www.github.com/paboyle/Grid
|
||||||
|
|
||||||
@ -25,8 +25,8 @@ Author: paboyle <paboyle@ph.ed.ac.uk>
|
|||||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
|
|
||||||
See the full license in the file "LICENSE" in the top level distribution directory
|
See the full license in the file "LICENSE" in the top level distribution directory
|
||||||
*************************************************************************************/
|
*************************************************************************************/
|
||||||
/* END LEGAL */
|
/* END LEGAL */
|
||||||
#ifndef GRID_PERFCOUNT_H
|
#ifndef GRID_PERFCOUNT_H
|
||||||
#define GRID_PERFCOUNT_H
|
#define GRID_PERFCOUNT_H
|
||||||
|
|
||||||
@ -47,7 +47,7 @@ Author: paboyle <paboyle@ph.ed.ac.uk>
|
|||||||
#include <x86intrin.h>
|
#include <x86intrin.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
namespace Grid {
|
NAMESPACE_BEGIN(Grid);
|
||||||
|
|
||||||
#ifdef __linux__
|
#ifdef __linux__
|
||||||
static long perf_event_open(struct perf_event_attr *hw_event, pid_t pid,
|
static long perf_event_open(struct perf_event_attr *hw_event, pid_t pid,
|
||||||
@ -84,9 +84,9 @@ inline uint64_t cyclecount(void){
|
|||||||
|
|
||||||
#ifdef __bgq__
|
#ifdef __bgq__
|
||||||
inline uint64_t cyclecount(void){
|
inline uint64_t cyclecount(void){
|
||||||
uint64_t tmp;
|
uint64_t tmp;
|
||||||
asm volatile ("mfspr %0,0x10C" : "=&r" (tmp) );
|
asm volatile ("mfspr %0,0x10C" : "=&r" (tmp) );
|
||||||
return tmp;
|
return tmp;
|
||||||
}
|
}
|
||||||
#elif defined __x86_64__
|
#elif defined __x86_64__
|
||||||
inline uint64_t cyclecount(void){
|
inline uint64_t cyclecount(void){
|
||||||
@ -97,7 +97,7 @@ inline uint64_t cyclecount(void){
|
|||||||
#else
|
#else
|
||||||
|
|
||||||
inline uint64_t cyclecount(void){
|
inline uint64_t cyclecount(void){
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
@ -225,8 +225,8 @@ public:
|
|||||||
int N = PerformanceCounterConfigs[PCT].normalisation;
|
int N = PerformanceCounterConfigs[PCT].normalisation;
|
||||||
const char * sn = PerformanceCounterConfigs[N].name ;
|
const char * sn = PerformanceCounterConfigs[N].name ;
|
||||||
const char * sc = PerformanceCounterConfigs[PCT].name;
|
const char * sc = PerformanceCounterConfigs[PCT].name;
|
||||||
std::printf("tsc = %llu %s = %llu %s = %20llu\n (%s/%s) rate = %lf\n", elapsed,sn ,cycles,
|
std::printf("tsc = %llu %s = %llu %s = %20llu\n (%s/%s) rate = %lf\n", elapsed,sn ,cycles,
|
||||||
sc, count, sc,sn, (double)count/(double)cycles);
|
sc, count, sc,sn, (double)count/(double)cycles);
|
||||||
#else
|
#else
|
||||||
std::printf("%llu cycles \n", elapsed );
|
std::printf("%llu cycles \n", elapsed );
|
||||||
#endif
|
#endif
|
||||||
@ -241,5 +241,6 @@ public:
|
|||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
NAMESPACE_END(Grid);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
#include <Grid/perfmon/PerfCount.h>
|
#include <Grid/perfmon/PerfCount.h>
|
||||||
#include <Grid/perfmon/Stat.h>
|
#include <Grid/perfmon/Stat.h>
|
||||||
|
|
||||||
namespace Grid {
|
NAMESPACE_BEGIN(Grid);
|
||||||
|
|
||||||
bool PmuStat::pmu_initialized=false;
|
bool PmuStat::pmu_initialized=false;
|
||||||
|
|
||||||
@ -175,39 +175,39 @@ void PmuStat::KNLevsetup(const char *ename, int &fd, int event, int umask)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void PmuStat::KNLsetup(void){
|
void PmuStat::KNLsetup(void){
|
||||||
|
|
||||||
int ret;
|
int ret;
|
||||||
char fname[1024];
|
char fname[1024];
|
||||||
|
|
||||||
// MC RPQ inserts and WPQ inserts (reads & writes)
|
// MC RPQ inserts and WPQ inserts (reads & writes)
|
||||||
for (int mc = 0; mc < NMC; ++mc)
|
for (int mc = 0; mc < NMC; ++mc)
|
||||||
{
|
{
|
||||||
::snprintf(fname, sizeof(fname), "/sys/devices/uncore_imc_%d",mc);
|
::snprintf(fname, sizeof(fname), "/sys/devices/uncore_imc_%d",mc);
|
||||||
// RPQ Inserts
|
// RPQ Inserts
|
||||||
KNLevsetup(fname, gbl.mc_rd[mc], 0x1, 0x1);
|
KNLevsetup(fname, gbl.mc_rd[mc], 0x1, 0x1);
|
||||||
// WPQ Inserts
|
// WPQ Inserts
|
||||||
KNLevsetup(fname, gbl.mc_wr[mc], 0x2, 0x1);
|
KNLevsetup(fname, gbl.mc_wr[mc], 0x2, 0x1);
|
||||||
}
|
}
|
||||||
// EDC RPQ inserts and WPQ inserts
|
// EDC RPQ inserts and WPQ inserts
|
||||||
for (int edc=0; edc < NEDC; ++edc)
|
for (int edc=0; edc < NEDC; ++edc)
|
||||||
{
|
{
|
||||||
::snprintf(fname, sizeof(fname), "/sys/devices/uncore_edc_eclk_%d",edc);
|
::snprintf(fname, sizeof(fname), "/sys/devices/uncore_edc_eclk_%d",edc);
|
||||||
// RPQ inserts
|
// RPQ inserts
|
||||||
KNLevsetup(fname, gbl.edc_rd[edc], 0x1, 0x1);
|
KNLevsetup(fname, gbl.edc_rd[edc], 0x1, 0x1);
|
||||||
// WPQ inserts
|
// WPQ inserts
|
||||||
KNLevsetup(fname, gbl.edc_wr[edc], 0x2, 0x1);
|
KNLevsetup(fname, gbl.edc_wr[edc], 0x2, 0x1);
|
||||||
}
|
}
|
||||||
// EDC HitE, HitM, MissE, MissM
|
// EDC HitE, HitM, MissE, MissM
|
||||||
for (int edc=0; edc < NEDC; ++edc)
|
for (int edc=0; edc < NEDC; ++edc)
|
||||||
{
|
{
|
||||||
::snprintf(fname, sizeof(fname), "/sys/devices/uncore_edc_uclk_%d", edc);
|
::snprintf(fname, sizeof(fname), "/sys/devices/uncore_edc_uclk_%d", edc);
|
||||||
KNLevsetup(fname, gbl.edc_hite[edc], 0x2, 0x1);
|
KNLevsetup(fname, gbl.edc_hite[edc], 0x2, 0x1);
|
||||||
KNLevsetup(fname, gbl.edc_hitm[edc], 0x2, 0x2);
|
KNLevsetup(fname, gbl.edc_hitm[edc], 0x2, 0x2);
|
||||||
KNLevsetup(fname, gbl.edc_misse[edc], 0x2, 0x4);
|
KNLevsetup(fname, gbl.edc_misse[edc], 0x2, 0x4);
|
||||||
KNLevsetup(fname, gbl.edc_missm[edc], 0x2, 0x8);
|
KNLevsetup(fname, gbl.edc_missm[edc], 0x2, 0x8);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
uint64_t PmuStat::KNLreadctr(int fd)
|
uint64_t PmuStat::KNLreadctr(int fd)
|
||||||
{
|
{
|
||||||
@ -242,4 +242,5 @@ void PmuStat::KNLreadctrs(ctrs &c)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
}
|
NAMESPACE_END(Grid);
|
||||||
|
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
#define _KNIGHTS_LANDING_ROOTONLY
|
#define _KNIGHTS_LANDING_ROOTONLY
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
namespace Grid {
|
NAMESPACE_BEGIN(Grid);
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
// Extra KNL counters from MCDRAM
|
// Extra KNL counters from MCDRAM
|
||||||
@ -15,14 +15,14 @@ namespace Grid {
|
|||||||
#define NEDC 8
|
#define NEDC 8
|
||||||
struct ctrs
|
struct ctrs
|
||||||
{
|
{
|
||||||
uint64_t mcrd[NMC];
|
uint64_t mcrd[NMC];
|
||||||
uint64_t mcwr[NMC];
|
uint64_t mcwr[NMC];
|
||||||
uint64_t edcrd[NEDC];
|
uint64_t edcrd[NEDC];
|
||||||
uint64_t edcwr[NEDC];
|
uint64_t edcwr[NEDC];
|
||||||
uint64_t edchite[NEDC];
|
uint64_t edchite[NEDC];
|
||||||
uint64_t edchitm[NEDC];
|
uint64_t edchitm[NEDC];
|
||||||
uint64_t edcmisse[NEDC];
|
uint64_t edcmisse[NEDC];
|
||||||
uint64_t edcmissm[NEDC];
|
uint64_t edcmissm[NEDC];
|
||||||
};
|
};
|
||||||
// Peter/Azusa:
|
// Peter/Azusa:
|
||||||
// Our modification of a code provided by Larry Meadows from Intel
|
// Our modification of a code provided by Larry Meadows from Intel
|
||||||
@ -44,61 +44,62 @@ struct knl_gbl_
|
|||||||
|
|
||||||
class PmuStat
|
class PmuStat
|
||||||
{
|
{
|
||||||
uint64_t counters[8][256];
|
uint64_t counters[8][256];
|
||||||
#ifdef _KNIGHTS_LANDING_
|
#ifdef _KNIGHTS_LANDING_
|
||||||
static struct knl_gbl_ gbl;
|
static struct knl_gbl_ gbl;
|
||||||
#endif
|
#endif
|
||||||
const char *name;
|
const char *name;
|
||||||
|
|
||||||
uint64_t reads; // memory reads
|
uint64_t reads; // memory reads
|
||||||
uint64_t writes; // memory writes
|
uint64_t writes; // memory writes
|
||||||
uint64_t mrstart; // memory read counter at start of parallel region
|
uint64_t mrstart; // memory read counter at start of parallel region
|
||||||
uint64_t mrend; // memory read counter at end of parallel region
|
uint64_t mrend; // memory read counter at end of parallel region
|
||||||
uint64_t mwstart; // memory write counter at start of parallel region
|
uint64_t mwstart; // memory write counter at start of parallel region
|
||||||
uint64_t mwend; // memory write counter at end of parallel region
|
uint64_t mwend; // memory write counter at end of parallel region
|
||||||
|
|
||||||
// cumulative counters
|
// cumulative counters
|
||||||
uint64_t count; // number of invocations
|
uint64_t count; // number of invocations
|
||||||
uint64_t tregion; // total time in parallel region (from thread 0)
|
uint64_t tregion; // total time in parallel region (from thread 0)
|
||||||
uint64_t tcycles; // total cycles inside parallel region
|
uint64_t tcycles; // total cycles inside parallel region
|
||||||
uint64_t inst, ref, cyc; // fixed counters
|
uint64_t inst, ref, cyc; // fixed counters
|
||||||
uint64_t pmc0, pmc1;// pmu
|
uint64_t pmc0, pmc1;// pmu
|
||||||
// add memory counters here
|
// add memory counters here
|
||||||
// temp variables
|
// temp variables
|
||||||
uint64_t tstart; // tsc at start of parallel region
|
uint64_t tstart; // tsc at start of parallel region
|
||||||
uint64_t tend; // tsc at end of parallel region
|
uint64_t tend; // tsc at end of parallel region
|
||||||
// map for ctrs values
|
// map for ctrs values
|
||||||
// 0 pmc0 start
|
// 0 pmc0 start
|
||||||
// 1 pmc0 end
|
// 1 pmc0 end
|
||||||
// 2 pmc1 start
|
// 2 pmc1 start
|
||||||
// 3 pmc1 end
|
// 3 pmc1 end
|
||||||
// 4 tsc start
|
// 4 tsc start
|
||||||
// 5 tsc end
|
// 5 tsc end
|
||||||
static bool pmu_initialized;
|
static bool pmu_initialized;
|
||||||
public:
|
public:
|
||||||
static bool is_init(void){ return pmu_initialized;}
|
static bool is_init(void){ return pmu_initialized;}
|
||||||
static void pmu_init(void);
|
static void pmu_init(void);
|
||||||
static void pmu_fini(void);
|
static void pmu_fini(void);
|
||||||
static void pmu_start(void);
|
static void pmu_start(void);
|
||||||
static void pmu_stop(void);
|
static void pmu_stop(void);
|
||||||
void accum(int nthreads);
|
void accum(int nthreads);
|
||||||
static void xmemctrs(uint64_t *mr, uint64_t *mw);
|
static void xmemctrs(uint64_t *mr, uint64_t *mw);
|
||||||
void start(void);
|
void start(void);
|
||||||
void enter(int t);
|
void enter(int t);
|
||||||
void exit(int t);
|
void exit(int t);
|
||||||
void print(void);
|
void print(void);
|
||||||
void init(const char *regname);
|
void init(const char *regname);
|
||||||
void clear(void);
|
void clear(void);
|
||||||
#ifdef _KNIGHTS_LANDING_
|
#ifdef _KNIGHTS_LANDING_
|
||||||
static void KNLsetup(void);
|
static void KNLsetup(void);
|
||||||
static uint64_t KNLreadctr(int fd);
|
static uint64_t KNLreadctr(int fd);
|
||||||
static void KNLreadctrs(ctrs &c);
|
static void KNLreadctrs(ctrs &c);
|
||||||
static void KNLevsetup(const char *ename, int &fd, int event, int umask);
|
static void KNLevsetup(const char *ename, int &fd, int event, int umask);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
NAMESPACE_END(Grid);
|
||||||
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/*************************************************************************************
|
/*************************************************************************************
|
||||||
|
|
||||||
Grid physics library, www.github.com/paboyle/Grid
|
Grid physics library, www.github.com/paboyle/Grid
|
||||||
|
|
||||||
@ -24,8 +24,8 @@ Author: Peter Boyle <paboyle@ph.ed.ac.uk>
|
|||||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
|
|
||||||
See the full license in the file "LICENSE" in the top level distribution directory
|
See the full license in the file "LICENSE" in the top level distribution directory
|
||||||
*************************************************************************************/
|
*************************************************************************************/
|
||||||
/* END LEGAL */
|
/* END LEGAL */
|
||||||
#ifndef GRID_TIME_H
|
#ifndef GRID_TIME_H
|
||||||
#define GRID_TIME_H
|
#define GRID_TIME_H
|
||||||
|
|
||||||
@ -33,11 +33,9 @@ Author: Peter Boyle <paboyle@ph.ed.ac.uk>
|
|||||||
#include <ctime>
|
#include <ctime>
|
||||||
#include <chrono>
|
#include <chrono>
|
||||||
|
|
||||||
namespace Grid {
|
NAMESPACE_BEGIN(Grid)
|
||||||
|
|
||||||
|
|
||||||
// Dress the output; use std::chrono
|
|
||||||
|
|
||||||
|
// Dress the output; use std::chrono
|
||||||
// C++11 time facilities better?
|
// C++11 time facilities better?
|
||||||
inline double usecond(void) {
|
inline double usecond(void) {
|
||||||
struct timeval tv;
|
struct timeval tv;
|
||||||
@ -98,5 +96,6 @@ public:
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
NAMESPACE_END(Grid)
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user