HPCToolkit
ga-overrides.c File Reference
#include <sys/types.h>
#include <stdio.h>
#include <ucontext.h>
#include <unistd.h>
#include <limits.h>
#include <main.h>
#include <metrics.h>
#include <safe-sampling.h>
#include <sample_event.h>
#include <thread_data.h>
#include <trace.h>
#include <messages/messages.h>
#include <monitor-exts/monitor_ext.h>
#include <sample-sources/ga.h>
#include <lib/support-lean/timer.h>
Include dependency graph for ga-overrides.c:

Go to the source code of this file.

Classes

struct  global_array_t
 

Macros

#define GA_MAX_DIM   7
 
#define MAXDIM   GA_MAX_DIM
 
#define GA_OFFSET   1000
 
#define FNAM   31 /* length of array names */
 
#define gam_CountElems(ndim, lo, hi, pelems)
 
#define G_A_NULL   (INT_MAX - GA_OFFSET)
 
#define def_isSampled_blocking()
 
#define def_isSampled_nonblocking()
 
#define def_isSampled()
 
#define def_timeBeg(isSampled)
 
#define doSample_1sided_blocking(g_a, lo, hi)
 
#define doSample_1sided_nonblocking(g_a, lo, hi)
 
#define doSample_collective_blocking()
 
#define doSample(g_a, do1, do2, do3, do4)
 
#define doMetric(metricIdExpr, metricIncr, type)
 
#define do0()   {}
 

Typedefs

typedef int Integer
 
typedef Integer logical
 
typedef long armci_size_t
 
typedef Integer C_Integer
 
typedef armci_size_t C_Long
 
typedef logical ga_create_fn_t(Integer type, Integer ndim, Integer *dims, char *name, Integer *chunk, Integer *g_a)
 
typedef Integer ga_create_handle_fn_t()
 
typedef void ga_getput_fn_t(Integer g_a, Integer *lo, Integer *hi, void *buf, Integer *ld)
 
typedef void ga_acc_fn_t(Integer g_a, Integer *lo, Integer *hi, void *buf, Integer *ld, void *alpha)
 
typedef void ga_nbgetput_fn_t(Integer g_a, Integer *lo, Integer *hi, void *buf, Integer *ld, Integer *nbhandle)
 
typedef void ga_nbacc_fn_t(Integer g_a, Integer *lo, Integer *hi, void *buf, Integer *ld, void *alpha, Integer *nbhandle)
 
typedef void ga_nbwait_fn_t(Integer *nbhandle)
 
typedef void ga_brdcst_fn_t(Integer type, void *buf, Integer len, Integer originator)
 
typedef void ga_gop_fn_t(Integer type, void *x, Integer n, char *op)
 
typedef void ga_sync_fn_t()
 
typedef void ga_pgroup_sync_fn_t(Integer grp_id)
 
typedef void ga_pgroup_gop_fn_t(Integer p_grp, Integer type, void *x, Integer n, char *op)
 

Functions

static double timeElapsed (uint64_t timeBeg)
 
static uint bytesXfr (Integer g_a, Integer *lo, Integer *hi)
 
static int ga_getDataIdx (Integer g_a)
 
static void ga_setDataIdx (Integer g_a, int idx)
 
 MONITOR_EXT_DECLARE_REAL_FN (ga_create_fn_t, real_pnga_create)
 
logical MONITOR_EXT_WRAP_NAME() pnga_create (Integer type, Integer ndim, Integer *dims, char *name, Integer *chunk, Integer *g_a)
 
 MONITOR_EXT_DECLARE_REAL_FN (ga_create_handle_fn_t, real_pnga_create_handle)
 
Integer MONITOR_EXT_WRAP_NAME() pnga_create_handle ()
 
 MONITOR_EXT_DECLARE_REAL_FN (ga_getput_fn_t, real_pnga_get)
 
void MONITOR_EXT_WRAP_NAME() pnga_get (Integer g_a, Integer *lo, Integer *hi, void *buf, Integer *ld)
 
 MONITOR_EXT_DECLARE_REAL_FN (ga_getput_fn_t, real_pnga_put)
 
void MONITOR_EXT_WRAP_NAME() pnga_put (Integer g_a, Integer *lo, Integer *hi, void *buf, Integer *ld)
 
 MONITOR_EXT_DECLARE_REAL_FN (ga_acc_fn_t, real_pnga_acc)
 
void MONITOR_EXT_WRAP_NAME() pnga_acc (Integer g_a, Integer *lo, Integer *hi, void *buf, Integer *ld, void *alpha)
 
 MONITOR_EXT_DECLARE_REAL_FN (ga_nbgetput_fn_t, real_pnga_nbget)
 
void MONITOR_EXT_WRAP_NAME() pnga_nbget (Integer g_a, Integer *lo, Integer *hi, void *buf, Integer *ld, Integer *nbhandle)
 
 MONITOR_EXT_DECLARE_REAL_FN (ga_nbgetput_fn_t, real_pnga_nbput)
 
void MONITOR_EXT_WRAP_NAME() pnga_nbput (Integer g_a, Integer *lo, Integer *hi, void *buf, Integer *ld, Integer *nbhandle)
 
 MONITOR_EXT_DECLARE_REAL_FN (ga_nbacc_fn_t, real_pnga_nbacc)
 
void MONITOR_EXT_WRAP_NAME() pnga_nbacc (Integer g_a, Integer *lo, Integer *hi, void *buf, Integer *ld, void *alpha, Integer *nbhandle)
 
 MONITOR_EXT_DECLARE_REAL_FN (ga_nbwait_fn_t, real_pnga_nbwait)
 
void MONITOR_EXT_WRAP_NAME() pnga_nbwait (Integer *nbhandle)
 
 MONITOR_EXT_DECLARE_REAL_FN (ga_brdcst_fn_t, real_pnga_brdcst)
 
void MONITOR_EXT_WRAP_NAME() pnga_brdcst (Integer type, void *buf, Integer len, Integer originator)
 
 MONITOR_EXT_DECLARE_REAL_FN (ga_gop_fn_t, real_pnga_gop)
 
void MONITOR_EXT_WRAP_NAME() pnga_gop (Integer type, void *x, Integer n, char *op)
 
 MONITOR_EXT_DECLARE_REAL_FN (ga_sync_fn_t, real_pnga_sync)
 
void MONITOR_EXT_WRAP_NAME() pnga_sync ()
 

Variables

global_array_tGA
 

Macro Definition Documentation

◆ def_isSampled

#define def_isSampled ( )
Value:
bool isSampled = false; \
thread_data_t* threadData = hpcrun_get_thread_data(); \
{ \
lushPthr_t* xxx = &threadData->pthr_metrics; \
xxx->doIdlenessCnt++; \
if (xxx->doIdlenessCnt == hpcrun_ga_period) { \
xxx->doIdlenessCnt = 0; \
isSampled = true; \
} \
}
uint64_t hpcrun_ga_period
Definition: ga.c:77
thread_data_t *(* hpcrun_get_thread_data)(void)
Definition: thread_data.c:168

Definition at line 195 of file ga-overrides.c.

◆ def_isSampled_blocking

#define def_isSampled_blocking ( )
Value:
def_timeBeg(isSampled);
#define def_isSampled()
Definition: ga-overrides.c:195

Definition at line 185 of file ga-overrides.c.

◆ def_isSampled_nonblocking

#define def_isSampled_nonblocking ( )
Value:
def_timeBeg(isSampled);
#define def_isSampled()
Definition: ga-overrides.c:195

Definition at line 190 of file ga-overrides.c.

◆ def_timeBeg

#define def_timeBeg (   isSampled)
Value:
uint64_t timeBeg = 0; \
if (isSampled) { \
timeBeg = time_getTSC(); /* cycles */ \
}
static uint64_t time_getTSC()
Definition: timer.h:155

Definition at line 208 of file ga-overrides.c.

◆ do0

#define do0 ( )    {}

Definition at line 307 of file ga-overrides.c.

◆ doMetric

#define doMetric (   metricIdExpr,
  metricIncr,
  type 
)
Value:
{ \
int mId = (metricIdExpr); /* eval only once */ \
if (mId >= 0 && mId != HPCRUN_FMT_MetricId_NULL) { \
/*TMSG(GA, "doMetric: %d", nbytes); */ \
hpcrun_metric_std_inc(mId, metricVec, \
(cct_metric_data_t){.type = metricIncr * hpcrun_ga_period}); \
} \
}
uint64_t hpcrun_ga_period
Definition: ga.c:77
#define HPCRUN_FMT_MetricId_NULL
Definition: hpcrun-fmt.h:691

Definition at line 296 of file ga-overrides.c.

◆ doSample

#define doSample (   g_a,
  do1,
  do2,
  do3,
  do4 
)

Definition at line 258 of file ga-overrides.c.

◆ doSample_1sided_blocking

#define doSample_1sided_blocking (   g_a,
  lo,
  hi 
)
Value:
if (isSampled) { \
double latency = timeElapsed(timeBeg); \
uint64_t nbytes = bytesXfr(g_a, lo, hi); \
doSample(g_a, \
doMetric(dataMetricId, nbytes, i)); \
}
static uint bytesXfr(Integer g_a, Integer *lo, Integer *hi)
Definition: ga-overrides.c:323
int hpcrun_ga_metricId_bytesXfr
Definition: ga.c:83
#define doMetric(metricIdExpr, metricIncr, type)
Definition: ga-overrides.c:296
int hpcrun_ga_metricId_onesidedOp
Definition: ga.c:79
#define doSample(g_a, do1, do2, do3, do4)
Definition: ga-overrides.c:258
static double timeElapsed(uint64_t timeBeg)
Definition: ga-overrides.c:314
int hpcrun_ga_metricId_latency
Definition: ga.c:81

Definition at line 217 of file ga-overrides.c.

◆ doSample_1sided_nonblocking

#define doSample_1sided_nonblocking (   g_a,
  lo,
  hi 
)
Value:
if (isSampled) { \
double latency = timeElapsed(timeBeg); \
uint64_t nbytes = bytesXfr(g_a, lo, hi); \
\
/* record time, cctNode, metricVec in nbhandle */ \
/* complete in: wait or sync */ \
doSample(g_a, \
doMetric(dataMetricId, nbytes, i)); \
}
static uint bytesXfr(Integer g_a, Integer *lo, Integer *hi)
Definition: ga-overrides.c:323
int hpcrun_ga_metricId_bytesXfr
Definition: ga.c:83
#define doMetric(metricIdExpr, metricIncr, type)
Definition: ga-overrides.c:296
int hpcrun_ga_metricId_onesidedOp
Definition: ga.c:79
#define doSample(g_a, do1, do2, do3, do4)
Definition: ga-overrides.c:258
static double timeElapsed(uint64_t timeBeg)
Definition: ga-overrides.c:314
int hpcrun_ga_metricId_latency
Definition: ga.c:81

Definition at line 230 of file ga-overrides.c.

◆ doSample_collective_blocking

#define doSample_collective_blocking ( )
Value:
if (isSampled) { \
double latency = timeElapsed(timeBeg); \
do0(), \
do0()); \
}
#define G_A_NULL
Definition: ga-overrides.c:178
#define doMetric(metricIdExpr, metricIncr, type)
Definition: ga-overrides.c:296
int hpcrun_ga_metricId_collectiveOp
Definition: ga.c:80
#define doSample(g_a, do1, do2, do3, do4)
Definition: ga-overrides.c:258
static double timeElapsed(uint64_t timeBeg)
Definition: ga-overrides.c:314
int hpcrun_ga_metricId_latency
Definition: ga.c:81
#define do0()
Definition: ga-overrides.c:307

Definition at line 246 of file ga-overrides.c.

◆ FNAM

#define FNAM   31 /* length of array names */

Definition at line 121 of file ga-overrides.c.

◆ G_A_NULL

#define G_A_NULL   (INT_MAX - GA_OFFSET)

Definition at line 178 of file ga-overrides.c.

◆ GA_MAX_DIM

#define GA_MAX_DIM   7

Definition at line 112 of file ga-overrides.c.

◆ GA_OFFSET

#define GA_OFFSET   1000

Definition at line 118 of file ga-overrides.c.

◆ gam_CountElems

#define gam_CountElems (   ndim,
  lo,
  hi,
  pelems 
)
Value:
{ \
int _d; \
for(_d=0,*pelems=1; _d< ndim;_d++) *pelems *= hi[_d]-lo[_d]+1; \
}

Definition at line 172 of file ga-overrides.c.

◆ MAXDIM

#define MAXDIM   GA_MAX_DIM

Definition at line 115 of file ga-overrides.c.

Typedef Documentation

◆ armci_size_t

typedef long armci_size_t

Definition at line 108 of file ga-overrides.c.

◆ C_Integer

typedef Integer C_Integer

Definition at line 123 of file ga-overrides.c.

◆ C_Long

Definition at line 124 of file ga-overrides.c.

◆ ga_acc_fn_t

typedef void ga_acc_fn_t(Integer g_a, Integer *lo, Integer *hi, void *buf, Integer *ld, void *alpha)

Definition at line 433 of file ga-overrides.c.

◆ ga_brdcst_fn_t

typedef void ga_brdcst_fn_t(Integer type, void *buf, Integer len, Integer originator)

Definition at line 566 of file ga-overrides.c.

◆ ga_create_fn_t

typedef logical ga_create_fn_t(Integer type, Integer ndim, Integer *dims, char *name, Integer *chunk, Integer *g_a)

Definition at line 365 of file ga-overrides.c.

◆ ga_create_handle_fn_t

typedef Integer ga_create_handle_fn_t()

Definition at line 392 of file ga-overrides.c.

◆ ga_getput_fn_t

typedef void ga_getput_fn_t(Integer g_a, Integer *lo, Integer *hi, void *buf, Integer *ld)

Definition at line 431 of file ga-overrides.c.

◆ ga_gop_fn_t

typedef void ga_gop_fn_t(Integer type, void *x, Integer n, char *op)

Definition at line 583 of file ga-overrides.c.

◆ ga_nbacc_fn_t

typedef void ga_nbacc_fn_t(Integer g_a, Integer *lo, Integer *hi, void *buf, Integer *ld, void *alpha, Integer *nbhandle)

Definition at line 490 of file ga-overrides.c.

◆ ga_nbgetput_fn_t

typedef void ga_nbgetput_fn_t(Integer g_a, Integer *lo, Integer *hi, void *buf, Integer *ld, Integer *nbhandle)

Definition at line 488 of file ga-overrides.c.

◆ ga_nbwait_fn_t

typedef void ga_nbwait_fn_t(Integer *nbhandle)

Definition at line 492 of file ga-overrides.c.

◆ ga_pgroup_gop_fn_t

typedef void ga_pgroup_gop_fn_t(Integer p_grp, Integer type, void *x, Integer n, char *op)

Definition at line 622 of file ga-overrides.c.

◆ ga_pgroup_sync_fn_t

typedef void ga_pgroup_sync_fn_t(Integer grp_id)

Definition at line 618 of file ga-overrides.c.

◆ ga_sync_fn_t

typedef void ga_sync_fn_t()

Definition at line 600 of file ga-overrides.c.

◆ Integer

typedef int Integer

Definition at line 103 of file ga-overrides.c.

◆ logical

typedef Integer logical

Definition at line 104 of file ga-overrides.c.

Function Documentation

◆ bytesXfr()

static uint bytesXfr ( Integer  g_a,
Integer lo,
Integer hi 
)
inlinestatic

Definition at line 323 of file ga-overrides.c.

◆ ga_getDataIdx()

static int ga_getDataIdx ( Integer  g_a)
inlinestatic

Definition at line 338 of file ga-overrides.c.

◆ ga_setDataIdx()

static void ga_setDataIdx ( Integer  g_a,
int  idx 
)
inlinestatic

Definition at line 347 of file ga-overrides.c.

Here is the caller graph for this function:

◆ MONITOR_EXT_DECLARE_REAL_FN() [1/12]

MONITOR_EXT_DECLARE_REAL_FN ( ga_create_fn_t  ,
real_pnga_create   
)
Here is the caller graph for this function:

◆ MONITOR_EXT_DECLARE_REAL_FN() [2/12]

MONITOR_EXT_DECLARE_REAL_FN ( ga_create_handle_fn_t  ,
real_pnga_create_handle   
)

◆ MONITOR_EXT_DECLARE_REAL_FN() [3/12]

MONITOR_EXT_DECLARE_REAL_FN ( ga_getput_fn_t  ,
real_pnga_get   
)

◆ MONITOR_EXT_DECLARE_REAL_FN() [4/12]

MONITOR_EXT_DECLARE_REAL_FN ( ga_getput_fn_t  ,
real_pnga_put   
)

◆ MONITOR_EXT_DECLARE_REAL_FN() [5/12]

MONITOR_EXT_DECLARE_REAL_FN ( ga_acc_fn_t  ,
real_pnga_acc   
)

◆ MONITOR_EXT_DECLARE_REAL_FN() [6/12]

MONITOR_EXT_DECLARE_REAL_FN ( ga_nbgetput_fn_t  ,
real_pnga_nbget   
)

◆ MONITOR_EXT_DECLARE_REAL_FN() [7/12]

MONITOR_EXT_DECLARE_REAL_FN ( ga_nbgetput_fn_t  ,
real_pnga_nbput   
)

◆ MONITOR_EXT_DECLARE_REAL_FN() [8/12]

MONITOR_EXT_DECLARE_REAL_FN ( ga_nbacc_fn_t  ,
real_pnga_nbacc   
)

◆ MONITOR_EXT_DECLARE_REAL_FN() [9/12]

MONITOR_EXT_DECLARE_REAL_FN ( ga_nbwait_fn_t  ,
real_pnga_nbwait   
)

◆ MONITOR_EXT_DECLARE_REAL_FN() [10/12]

MONITOR_EXT_DECLARE_REAL_FN ( ga_brdcst_fn_t  ,
real_pnga_brdcst   
)

◆ MONITOR_EXT_DECLARE_REAL_FN() [11/12]

MONITOR_EXT_DECLARE_REAL_FN ( ga_gop_fn_t  ,
real_pnga_gop   
)

◆ MONITOR_EXT_DECLARE_REAL_FN() [12/12]

MONITOR_EXT_DECLARE_REAL_FN ( ga_sync_fn_t  ,
real_pnga_sync   
)

◆ pnga_acc()

void MONITOR_EXT_WRAP_NAME() pnga_acc ( Integer  g_a,
Integer lo,
Integer hi,
void *  buf,
Integer ld,
void *  alpha 
)

Definition at line 469 of file ga-overrides.c.

◆ pnga_brdcst()

void MONITOR_EXT_WRAP_NAME() pnga_brdcst ( Integer  type,
void *  buf,
Integer  len,
Integer  originator 
)

Definition at line 571 of file ga-overrides.c.

◆ pnga_create()

logical MONITOR_EXT_WRAP_NAME() pnga_create ( Integer  type,
Integer  ndim,
Integer dims,
char *  name,
Integer chunk,
Integer g_a 
)

Definition at line 372 of file ga-overrides.c.

Here is the call graph for this function:

◆ pnga_create_handle()

Integer MONITOR_EXT_WRAP_NAME() pnga_create_handle ( )

Definition at line 397 of file ga-overrides.c.

Here is the call graph for this function:

◆ pnga_get()

void MONITOR_EXT_WRAP_NAME() pnga_get ( Integer  g_a,
Integer lo,
Integer hi,
void *  buf,
Integer ld 
)

Definition at line 439 of file ga-overrides.c.

Here is the call graph for this function:

◆ pnga_gop()

void MONITOR_EXT_WRAP_NAME() pnga_gop ( Integer  type,
void *  x,
Integer  n,
char *  op 
)

Definition at line 588 of file ga-overrides.c.

◆ pnga_nbacc()

void MONITOR_EXT_WRAP_NAME() pnga_nbacc ( Integer  g_a,
Integer lo,
Integer hi,
void *  buf,
Integer ld,
void *  alpha,
Integer nbhandle 
)

Definition at line 528 of file ga-overrides.c.

Here is the call graph for this function:

◆ pnga_nbget()

void MONITOR_EXT_WRAP_NAME() pnga_nbget ( Integer  g_a,
Integer lo,
Integer hi,
void *  buf,
Integer ld,
Integer nbhandle 
)

Definition at line 498 of file ga-overrides.c.

Here is the call graph for this function:

◆ pnga_nbput()

void MONITOR_EXT_WRAP_NAME() pnga_nbput ( Integer  g_a,
Integer lo,
Integer hi,
void *  buf,
Integer ld,
Integer nbhandle 
)

Definition at line 513 of file ga-overrides.c.

Here is the call graph for this function:

◆ pnga_nbwait()

void MONITOR_EXT_WRAP_NAME() pnga_nbwait ( Integer nbhandle)

Definition at line 543 of file ga-overrides.c.

Here is the call graph for this function:

◆ pnga_put()

void MONITOR_EXT_WRAP_NAME() pnga_put ( Integer  g_a,
Integer lo,
Integer hi,
void *  buf,
Integer ld 
)

Definition at line 454 of file ga-overrides.c.

Here is the call graph for this function:

◆ pnga_sync()

void MONITOR_EXT_WRAP_NAME() pnga_sync ( )

Definition at line 605 of file ga-overrides.c.

◆ timeElapsed()

static double timeElapsed ( uint64_t  timeBeg)
inlinestatic

Definition at line 314 of file ga-overrides.c.

Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ GA