65 #include <sys/types.h> 115 #define MAXDIM GA_MAX_DIM 118 #define GA_OFFSET 1000 165 #ifdef ENABLE_CHECKPOINT 172 #define gam_CountElems(ndim, lo, hi, pelems){ \ 174 for(_d=0,*pelems=1; _d< ndim;_d++) *pelems *= hi[_d]-lo[_d]+1; \ 178 #define G_A_NULL (INT_MAX - GA_OFFSET) 185 #define def_isSampled_blocking() \ 187 def_timeBeg(isSampled); 190 #define def_isSampled_nonblocking() \ 192 def_timeBeg(isSampled); 195 #define def_isSampled() \ 196 bool isSampled = false; \ 197 thread_data_t* threadData = hpcrun_get_thread_data(); \ 199 lushPthr_t* xxx = &threadData->pthr_metrics; \ 200 xxx->doIdlenessCnt++; \ 201 if (xxx->doIdlenessCnt == hpcrun_ga_period) { \ 202 xxx->doIdlenessCnt = 0; \ 208 #define def_timeBeg(isSampled) \ 209 uint64_t timeBeg = 0; \ 211 timeBeg = time_getTSC(); \ 217 #define doSample_1sided_blocking(g_a, lo, hi) \ 219 double latency = timeElapsed(timeBeg); \ 220 uint64_t nbytes = bytesXfr(g_a, lo, hi); \ 223 doMetric(hpcrun_ga_metricId_onesidedOp, 1, i), \ 224 doMetric(hpcrun_ga_metricId_latency, latency, r), \ 225 doMetric(hpcrun_ga_metricId_bytesXfr, nbytes, i), \ 226 doMetric(dataMetricId, nbytes, i)); \ 230 #define doSample_1sided_nonblocking(g_a, lo, hi) \ 232 double latency = timeElapsed(timeBeg); \ 233 uint64_t nbytes = bytesXfr(g_a, lo, hi); \ 239 doMetric(hpcrun_ga_metricId_onesidedOp, 1, i), \ 240 doMetric(hpcrun_ga_metricId_latency, latency, r), \ 241 doMetric(hpcrun_ga_metricId_bytesXfr, nbytes, i), \ 242 doMetric(dataMetricId, nbytes, i)); \ 246 #define doSample_collective_blocking() \ 248 double latency = timeElapsed(timeBeg); \ 251 doMetric(hpcrun_ga_metricId_collectiveOp, 1, i), \ 252 doMetric(hpcrun_ga_metricId_latency, latency, r), \ 258 #define doSample(g_a, do1, do2, do3, do4) \ 261 if ((safe = hpcrun_safe_enter())) { \ 265 hpcrun_ga_metricId_dataDesc_t* ga_desc = NULL; \ 266 uint dataMetricId = HPCRUN_FMT_MetricId_NULL; \ 268 if (g_a != G_A_NULL) { \ 269 int idx = ga_getDataIdx(g_a); \ 270 if (hpcrun_ga_dataIdx_isValid(idx)) { \ 271 ga_desc = hpcrun_ga_metricId_dataTbl_find(idx); \ 272 dataMetricId = ga_desc->metricId; \ 278 sample_val_t smplVal = \ 279 hpcrun_sample_callpath(&uc, dataMetricId, \ 280 (hpcrun_metricVal_t) {.i=0}, \ 284 metric_set_t* metricVec = \ 285 metricVec = hpcrun_get_metric_set(smplVal.sample_node); \ 291 if (safe) hpcrun_safe_exit(); \ 296 #define doMetric(metricIdExpr, metricIncr, type) \ 298 int mId = (metricIdExpr); \ 299 if (mId >= 0 && mId != HPCRUN_FMT_MetricId_NULL) { \ 301 hpcrun_metric_std_inc(mId, metricVec, \ 302 (cct_metric_data_t){.type = metricIncr * hpcrun_ga_period}); \ 316 const double mhz = 2100;
318 return ((
double)(timeEnd - timeBeg) / mhz);
332 uint num_bytes = num_elems * ga_elemsize;
342 return (
int) GA[ga_hndl].
lock;
350 GA[ga_hndl].
lock = idx;
379 logical ret = real_pnga_create(type, ndim, dims, name, chunk, g_a);
382 #if (GA_DataCentric_Prototype) 402 Integer g_a = real_pnga_create_handle();
405 #if (GA_DataCentric_Prototype) 406 char* name =
"(unknown)";
445 real_pnga_get(g_a, lo, hi,
buf, ld);
460 real_pnga_put(g_a, lo, hi,
buf, ld);
475 real_pnga_acc(g_a, lo, hi,
buf, ld, alpha);
504 real_pnga_nbget(g_a, lo, hi,
buf, ld, nbhandle);
519 real_pnga_nbput(g_a, lo, hi,
buf, ld, nbhandle);
534 real_pnga_nbacc(g_a, lo, hi,
buf, ld, alpha, nbhandle);
551 real_pnga_nbwait(nbhandle);
577 real_pnga_brdcst(type,
buf, len, originator);
594 real_pnga_gop(type, x,
n, op);
static int ga_getDataIdx(Integer g_a)
void MONITOR_EXT_WRAP_NAME() pnga_nbput(Integer g_a, Integer *lo, Integer *hi, void *buf, Integer *ld, Integer *nbhandle)
void MONITOR_EXT_WRAP_NAME() pnga_get(Integer g_a, Integer *lo, Integer *hi, void *buf, Integer *ld)
void ga_getput_fn_t(Integer g_a, Integer *lo, Integer *hi, void *buf, Integer *ld)
#define doSample_1sided_blocking(g_a, lo, hi)
static void ga_setDataIdx(Integer g_a, int idx)
Integer MONITOR_EXT_WRAP_NAME() pnga_create_handle()
static uint bytesXfr(Integer g_a, Integer *lo, Integer *hi)
#define def_isSampled_nonblocking()
void ga_gop_fn_t(Integer type, void *x, Integer n, char *op)
void MONITOR_EXT_WRAP_NAME() pnga_nbwait(Integer *nbhandle)
MONITOR_EXT_DECLARE_REAL_FN(ga_create_fn_t, real_pnga_create)
void ga_nbgetput_fn_t(Integer g_a, Integer *lo, Integer *hi, void *buf, Integer *ld, Integer *nbhandle)
#define MONITOR_EXT_WRAP_NAME(name)
void MONITOR_EXT_WRAP_NAME() pnga_acc(Integer g_a, Integer *lo, Integer *hi, void *buf, Integer *ld, void *alpha)
static uint64_t time_getTSC()
#define def_timeBeg(isSampled)
void MONITOR_EXT_WRAP_NAME() pnga_gop(Integer type, void *x, Integer n, char *op)
void MONITOR_EXT_WRAP_NAME() pnga_put(Integer g_a, Integer *lo, Integer *hi, void *buf, Integer *ld)
#define gam_CountElems(ndim, lo, hi, pelems)
#define doSample_1sided_nonblocking(g_a, lo, hi)
#define doMetric(metricIdExpr, metricIncr, type)
#define doSample_collective_blocking()
void ga_nbacc_fn_t(Integer g_a, Integer *lo, Integer *hi, void *buf, Integer *ld, void *alpha, Integer *nbhandle)
void ga_nbwait_fn_t(Integer *nbhandle)
logical MONITOR_EXT_WRAP_NAME() pnga_create(Integer type, Integer ndim, Integer *dims, char *name, Integer *chunk, Integer *g_a)
#define MONITOR_EXT_GET_NAME_WRAP(var, name)
void ga_pgroup_sync_fn_t(Integer grp_id)
void MONITOR_EXT_WRAP_NAME() pnga_nbacc(Integer g_a, Integer *lo, Integer *hi, void *buf, Integer *ld, void *alpha, Integer *nbhandle)
#define def_isSampled_blocking()
void MONITOR_EXT_WRAP_NAME() pnga_sync()
#define doSample(g_a, do1, do2, do3, do4)
void MONITOR_EXT_WRAP_NAME() pnga_brdcst(Integer type, void *buf, Integer len, Integer originator)
void ga_pgroup_gop_fn_t(Integer p_grp, Integer type, void *x, Integer n, char *op)
void MONITOR_EXT_WRAP_NAME() pnga_nbget(Integer g_a, Integer *lo, Integer *hi, void *buf, Integer *ld, Integer *nbhandle)
static double timeElapsed(uint64_t timeBeg)
int hpcrun_ga_dataIdx_new(const char *name)
int hpcrun_ga_metricId_latency
logical ga_create_fn_t(Integer type, Integer ndim, Integer *dims, char *name, Integer *chunk, Integer *g_a)
<!-- ********************************************************************--> n<!-- HPCToolkit Experiment DTD --> n<!-- Version 2.1 --> n<!-- ********************************************************************--> n<!ELEMENT HPCToolkitExperiment(Header,(SecCallPathProfile|SecFlatProfile) *)> n<!ATTLIST HPCToolkitExperiment\n version CDATA #REQUIRED > n n<!-- ******************************************************************--> n n<!-- Info/NV:flexible name-value pairs:(n) ame;(t) ype;(v) alue --> n<!ELEMENT Info(NV *)> n<!ATTLIST Info\n n CDATA #IMPLIED > n<!ELEMENT NV EMPTY > n<!ATTLIST NV\n n CDATA #REQUIRED\n t CDATA #IMPLIED\n v CDATA #REQUIRED > n n<!-- ******************************************************************--> n<!-- Header --> n<!-- ******************************************************************--> n<!ELEMENT Header(Info *)> n<!ATTLIST Header\n n CDATA #REQUIRED > n n<!-- ******************************************************************--> n<!-- Section Header --> n<!-- ******************************************************************--> n<!ELEMENT SecHeader(MetricTable?, MetricDBTable?, TraceDBTable?, LoadModuleTable?, FileTable?, ProcedureTable?, Info *)> n n<!-- MetricTable:--> n<!ELEMENT MetricTable(Metric) * > n n<!-- Metric:(i) d;(n) ame --> n<!--(v) alue-type:transient type of values --> n<!--(t) ype:persistent type of metric --> n<!-- fmt:format;show;--> n<!ELEMENT Metric(MetricFormula *, Info?)> n<!ATTLIST Metric\n i CDATA #REQUIRED\n n CDATA #REQUIRED\n es CDATA #IMPLIED\n em CDATA #IMPLIED\n ep CDATA #IMPLIED\n v(raw|final|derived-incr|derived) \"raw\\ t (inclusive|exclusive|nil) \nil\\ partner CDATA #IMPLIED\ fmt CDATA #IMPLIED\ show (1|0) \1\\ show-percent (1|0) \1> n n<!-- MetricFormula represents derived metrics: (t)ype; (frm): formula --> n<!ELEMENT MetricFormula (Info?)> n<!ATTLIST MetricFormula\ t (combine|finalize) \finalize\\ i CDATA #IMPLIED\ frm CDATA #REQUIRED> n n<!-- Metric data, used in sections: (n)ame [from Metric]; (v)alue --> n<!ELEMENT M EMPTY> n<!ATTLIST M\ n CDATA #REQUIRED\ v CDATA #REQUIRED> n n<!-- MetricDBTable: --> n<!ELEMENT MetricDBTable (MetricDB)*> n n<!-- MetricDB: (i)d; (n)ame --> n<!-- (t)ype: persistent type of metric --> n<!-- db-glob: file glob describing files in metric db --> n<!-- db-id: id within metric db --> n<!-- db-num-metrics: number of metrics in db --> n<!-- db-header-sz: size (in bytes) of a db file header --> n<!ELEMENT MetricDB EMPTY> n<!ATTLIST MetricDB\ i CDATA #REQUIRED\ n CDATA #REQUIRED\ t (inclusive|exclusive|nil) \nil\\ partner CDATA #IMPLIED\ db-glob CDATA #IMPLIED\ db-id CDATA #IMPLIED\ db-num-metrics CDATA #IMPLIED\ db-header-sz CDATA #IMPLIED> n n<!-- TraceDBTable: --> n<!ELEMENT TraceDBTable (TraceDB)> n n<!-- TraceDB: (i)d --> n<!-- db-min-time: min beginning time stamp (global) --> n<!-- db-max-time: max ending time stamp (global) --> n<!ELEMENT TraceDB EMPTY> n<!ATTLIST TraceDB\ i CDATA #REQUIRED\ db-glob CDATA #IMPLIED\ db-min-time CDATA #IMPLIED\ db-max-time CDATA #IMPLIED\ db-header-sz CDATA #IMPLIED> n n<!-- LoadModuleTable assigns a short name to a load module --> n<!ELEMENT LoadModuleTable (LoadModule)*> n n<!ELEMENT LoadModule (Info?)> n<!ATTLIST LoadModule\ i CDATA #REQUIRED\ n CDATA #REQUIRED> n n<!-- FileTable assigns a short name to a file --> n<!ELEMENT FileTable (File)*> n n<!ELEMENT File (Info?)> n<!ATTLIST File\ i CDATA #REQUIRED\ n CDATA #REQUIRED> n n<!-- ProcedureTable assigns a short name to a procedure --> n<!ELEMENT ProcedureTable (Procedure)*> n n<!-- Info/NV: flexible name-value pairs: (n)ame; (t)ype; (v)alue --> n<!-- f: family of the procedure (fake, root, ...)--> n<!ELEMENT Procedure (Info?)> n<!ATTLIST Procedure\ i CDATA #REQUIRED\ n CDATA #REQUIRED\ f CDATA #IMPLIED> n n<!-- ****************************************************************** --> n<!-- Section: Call path profile --> n<!-- ****************************************************************** --> n<!ELEMENT SecCallPathProfile (SecHeader, SecCallPathProfileData)> n<!ATTLIST SecCallPathProfile\ i CDATA #REQUIRED\ n CDATA #REQUIRED> n n<!ELEMENT SecCallPathProfileData (PF|M)*> n<!-- Procedure frame --> n<!-- (i)d: unique identifier for cross referencing --> n<!-- (s)tatic scope id --> n<!-- (n)ame: a string or an id in ProcedureTable --> n<!-- (lm) load module: a string or an id in LoadModuleTable --> n<!-- (f)ile name: a string or an id in LoadModuleTable --> n<!-- (l)ine range: \beg-end\ (inclusive range) --> n<!-- (a)lien: whether frame is alien to enclosing P --> n<!-- (str)uct: hpcstruct node id --> n<!-- (t)ype: hpcrun node type: memory access, variable declaration, ... --> n<!-- (v)ma-range-set: \{[beg-end), [beg-end)...}\ --> n<!ELEMENT PF (PF|Pr|L|C|S|M)*> n<!ATTLIST PF\ i CDATA #IMPLIED\ s CDATA #IMPLIED\ n CDATA #REQUIRED\ lm CDATA #IMPLIED\ f CDATA #IMPLIED\ l CDATA #IMPLIED\ str CDATA #IMPLIED\ v CDATA #IMPLIED> n<!-- Procedure (static): GOAL: replace with 'P' --> n<!ELEMENT Pr (Pr|L|C|S|M)*> n<!ATTLIST Pr\ i CDATA #IMPLIED\ s CDATA #IMPLIED\ n CDATA #REQUIRED\ lm CDATA #IMPLIED\ f CDATA #IMPLIED\ l CDATA #IMPLIED\ a (1|0) \0\\ str CDATA #IMPLIED\ v CDATA #IMPLIED> n<!-- Callsite (a special StatementRange) --> n<!ELEMENT C (PF|M)*> n<!ATTLIST C\ i CDATA #IMPLIED\ s CDATA #IMPLIED\ l CDATA #IMPLIED\ str CDATA #IMPLIED\ v CDATA #IMPLIED> n n<!-- ****************************************************************** --> n<!-- Section: Flat profile --> n<!-- ****************************************************************** --> n<!ELEMENT SecFlatProfile (SecHeader, SecFlatProfileData)> n<!ATTLIST SecFlatProfile\ i CDATA #REQUIRED\ n CDATA #REQUIRED> n n<!ELEMENT SecFlatProfileData (LM|M)*> n<!-- Load module: (i)d; (n)ame; (v)ma-range-set --> n<!ELEMENT LM (F|P|M)*> n<!ATTLIST LM\ i CDATA #IMPLIED\ n CDATA #REQUIRED\ v CDATA #IMPLIED> n<!-- File --> n<!ELEMENT F (P|L|S|M)*> n<!ATTLIST F\ i CDATA #IMPLIED\ n CDATA #REQUIRED> n<!-- Procedure (Note 1) --> n<!ELEMENT P (P|A|L|S|C|M)*> n<!ATTLIST P\ i CDATA #IMPLIED\ n CDATA #REQUIRED\ l CDATA #IMPLIED\ str CDATA #IMPLIED\ v CDATA #IMPLIED> n<!-- Alien (Note 1) --> n<!ELEMENT A (A|L|S|C|M)*> n<!ATTLIST A\ i CDATA #IMPLIED\ f CDATA #IMPLIED\ n CDATA #IMPLIED\ l CDATA #IMPLIED\ str CDATA #IMPLIED\ v CDATA #IMPLIED> n<!-- Loop (Note 1,2) --> n<!ELEMENT L (A|Pr|L|S|C|M)*> n<!ATTLIST L\ i CDATA #IMPLIED\ s CDATA #IMPLIED\ l CDATA #IMPLIED\ f CDATA #IMPLIED\ str CDATA #IMPLIED\ v CDATA #IMPLIED> n<!-- Statement (Note 2) --> n<!-- (it): trace record identifier --> n<!ELEMENT S (S|M)*> n<!ATTLIST S\ i CDATA #IMPLIED\ it CDATA #IMPLIED\ s CDATA #IMPLIED\ l CDATA #IMPLIED\ str CDATA #IMPLIED\ v CDATA #IMPLIED> n<!-- Note 1: Contained Cs may not contain PFs --> n<!-- Note 2: The 's' attribute is not used for flat profiles --> n
void ga_brdcst_fn_t(Integer type, void *buf, Integer len, Integer originator)
void ga_acc_fn_t(Integer g_a, Integer *lo, Integer *hi, void *buf, Integer *ld, void *alpha)
Integer ga_create_handle_fn_t()