22#define MINCOUNTS 100000
23#define MPX_TOLERANCE 0.20
24#define NUM_FLOPS 20000000
28 long long *refvalues )
31 int i = nevents, j = 0;
34 printf(
"\nRelative accuracy:\n" );
35 for ( j = 0; j < nevents; j++ )
36 printf(
" Event %.2d", j + 1 );
40 for ( j = 0; j < nevents; j++ ) {
41 spread[j] = abs( (
int) ( refvalues[j] -
values[j] ) );
43 spread[j] /= ( double )
values[j];
45 printf(
"%10.3g ", spread[j] );
56 printf(
"reference = %lld, value = %lld, diff = %lld\n",
59 sprintf(buff,
"Error on %d, spread %lf > threshold %lf AND count %lld > minimum size threshold %d\n",j,spread[j],
MPX_TOLERANCE,
68 for ( j = 0; j < nevents; j++ ) {
70 printf(
"Event %.2d: ref=", j );
72 printf(
", diff/ref=%7.2g -- %s\n", spread[j], info.short_descr );
87 long long *refvalues )
94 if (!
TESTS_QUIET) printf(
"PAPI reference measurements:\n" );
99 for (
i = 0;
i < nevents;
i++ ) {
114 printf(
"\tOperations= %.1f Mflop",
y * 1e-6 );
115 printf(
"\t(%g Mflop/s)\n\n", ( (
float )
y / (
t2 -
t1 ) ) );
121 printf(
LLDFMT, refvalues[
i] );
153 if ( !strcmp( argv[1],
"TESTS_QUIET" ) ) {
156 sleep_time = atoi( argv[1] );
157 if ( sleep_time <= 0 )
183 printf(
"\nAccuracy check of multiplexing routines.\n" );
184 printf(
"Comparing a multiplex measurement with separate measurements.\n\n" );
195 for (
i = 0;
i < nevents;
i++ ) {
197 (info.
count && (strcmp( info.
derived,
"NOT_DERIVED")==0))) {
211 test_skip( __FILE__, __LINE__,
"Not enough events to multiplex...", 0 );
214 if (!
quiet) printf(
"Using %d events\n\n", nevents );
219 "PAPI multiplex init fail\n",
retval );
226 t2 = 10000 * 20 * nevents;
228 test_skip( __FILE__, __LINE__,
"This test takes too much time",
242 "do_flops3 takes no time to run!\n",
retval);
247 iters = iters * (
int ) (
t2 /
t1 );
249 printf(
"Modified iteration count to %d\n\n", iters );
270 test_fail( __FILE__, __LINE__,
"PAPI_assign_eventset_component",
275 test_skip(__FILE__, __LINE__,
"Multiplex not supported", 1);
284 if (!
quiet) printf(
"\nPAPI multiplexed measurements:\n" );
294 for ( j = 0; j < nevents; j++ ) {
static struct timeval t1 t2
add PAPI preset or native hardware event to an event set
add multiple PAPI presets or native hardware events to an event set
Assign a component index to an existing but empty EventSet.
Empty and destroy an EventSet.
Create a new empty PAPI EventSet.
Empty and destroy an EventSet.
Get the event's name and description info.
get real time counter value in microseconds
initialize the PAPI library.
Initialize multiplex support in the PAPI library.
Remove an array of hardware event codes from a PAPI event set.
Convert a standard event set to a multiplexed event set.
Start counting hardware events in an event set.
Stop counting hardware events in an event set.
double do_flops3(double x, int iters, int quiet)
char events[MAX_EVENTS][BUFSIZ]
static long long values[NUM_EVENTS]
Return codes and api definitions.
int tests_quiet(int argc, char **argv)
void PAPI_NORETURN test_fail(const char *file, int line, const char *call, int retval)
void PAPI_NORETURN test_pass(const char *filename)
void PAPI_NORETURN test_skip(const char *file, int line, const char *call, int retval)
void check_values(int eventset, int *events, int nevents, long long *values, long long *refvalues)
void ref_measurements(int iters, int *eventset, int *events, int nevents, long long *refvalues)
char short_descr[PAPI_MIN_STR_LEN]
char symbol[PAPI_HUGE_STR_LEN]
char derived[PAPI_MIN_STR_LEN]