2 |
|
|
3 |
/**************************************************************/ |
/**************************************************************/ |
4 |
|
|
5 |
/* Paso: perfomance monitor interface using papi*/ |
/* Paso: perfomance monitor interface using papi */ |
6 |
|
|
7 |
/**************************************************************/ |
/**************************************************************/ |
8 |
|
|
9 |
/* Copyrights by ACcESS Australia 2003/04 */ |
/* Copyrights by ACcESS Australia 2006 */ |
10 |
/* Author: gross@access.edu.au */ |
/* Author: gross@access.edu.au */ |
11 |
|
|
12 |
/**************************************************************/ |
/**************************************************************/ |
14 |
#ifndef INC_PASO_PERFORMANCE |
#ifndef INC_PASO_PERFORMANCE |
15 |
#define INC_PASO_PERFORMANCE |
#define INC_PASO_PERFORMANCE |
16 |
|
|
17 |
#ifdef PAPI |
#define PERFORMANCE_UNMONITORED_EVENT -1 |
18 |
|
#define PERFORMANCE_NUM_EVENTS 10 /* maximum number of events handeled by PAPI */ |
|
#include <papi.h> |
|
19 |
|
|
20 |
Paso_Performance* Performance_init(); |
#define PERFORMANCE_ALL 0 |
21 |
void Performance_start_solver(Paso_Performance&); |
#define PERFORMANCE_SOLVER 1 |
22 |
void Performance_start_preconditioner_init(Paso_Performance&); |
#define PERFORMANCE_PRECONDITIONER_INIT 2 |
23 |
void Performance_start_preconditioner(Paso_Performance&); |
#define PERFORMANCE_PRECONDITIONER 3 |
24 |
void Performance_start_mvm(Paso_Performance&); |
#define PERFORMANCE_MVM 4 |
25 |
void Performance_end_preconditioner(Paso_Performance&); |
#define PERFORMANCE_ASSEMBLAGE 5 |
26 |
void Performance_end_preconditioner_init(Paso_Performance&); |
#define PERFORMANCE_UNKNOWN 6 /* more can be added here */ |
27 |
void Performance_end_mvm(Paso_Performance&); |
#define PERFORMANCE_NUM_MONITORS PERFORMANCE_UNKNOWN+1 |
28 |
void Performance_end_solver(Paso_Performance&); |
|
29 |
void Performance_finalized(Paso_Performance&); |
#define PERFORMANCE_UNUSED -1 |
30 |
|
#define PERFORMANCE_CLOSED 0 |
31 |
|
#define PERFORMANCE_OPENED 1 |
32 |
|
|
33 |
|
#ifdef PAPI |
34 |
|
#include <papi.h> |
35 |
struct Paso_Performance { |
struct Paso_Performance { |
36 |
|
int event_set; /* papi event sets for the monitors */ |
37 |
|
int num_events; /* number of events tracked by the monitors */ |
38 |
|
int events[PERFORMANCE_NUM_EVENTS]; /* the event tracked by the monitors */ |
39 |
|
long_long values[PERFORMANCE_NUM_MONITORS][PERFORMANCE_NUM_EVENTS]; /* counter accummulator */ |
40 |
|
long_long cycles[PERFORMANCE_NUM_MONITORS]; /* cycle accumulator */ |
41 |
|
int set[PERFORMANCE_NUM_MONITORS]; |
42 |
|
} |
43 |
|
#else |
44 |
|
struct Paso_Performance { |
45 |
|
int none; |
46 |
}; |
}; |
|
typedef Paso_Performance struct Paso_Performance; |
|
|
|
|
47 |
#endif |
#endif |
48 |
|
typedef struct Paso_Performance Paso_Performance; |
49 |
|
|
50 |
|
|
51 |
void Performance_init(void*) { |
void Performance_open(Paso_Performance* pp); |
52 |
#ifdef PAPI |
int Performance_getEventIndex(Paso_Performance* pp, int event_id); |
53 |
/* Initialize the PAPI library */ |
void Performance_close(Paso_Performance* pp); |
54 |
retval = PAPI_library_init(PAPI_VER_CURRENT); |
void Performance_startMonitor(Paso_Performance* pp,int monitor); |
55 |
if (retval != PAPI_VER_CURRENT && retval > 0) { |
void Performance_stopMonitor(Paso_Performance* pp,int monitor); |
|
fprintf(stderr,"PAPI library version mismatch!\n"); |
|
|
exit(1); |
|
|
} |
|
|
if (retval < 0) { |
|
|
fprintf(stderr, “Initialization error!\n”); |
|
|
exit(1); |
|
|
} |
|
|
#endif |
|
|
NUM_EVENTS=5; |
|
|
events={PAPI_FP_OPS,PAPI_L1_DCM,PAPI_L2_DCM,PAPI_L3_DCM}; |
|
|
|
|
|
out->all |
|
|
out->solver |
|
|
out->preconditioner_init |
|
|
out->preconditioner |
|
|
out->mvm |
|
|
} |
|
|
|
|
|
Performance_start(Paso_Performance& pp) { |
|
|
pp-> |
|
|
|
|
56 |
|
|
57 |
|
#endif |
58 |
|
|
59 |
} |
/* |
60 |
|
* $Log$ |
61 |
|
*/ |