23#define MINCOUNTS 100000
24#define MPX_TOLERANCE 0.20
25#define NUM_FLOPS 20000000
29main(
int argc,
char **argv )
34 double x = 1.1,
y, dtmp;
56 if ( !strcmp( argv[1],
"TESTS_QUIET" ) ) {
59 sleep_time = atoi( argv[1] );
60 if ( sleep_time <= 0 )
82 printf(
"\nAccuracy check of multiplexing routines.\n" );
83 printf(
"Investigating the variance of multiplexed measurements.\n\n" );
95 "PAPI multiplex init fail\n",
retval );
110 test_fail( __FILE__, __LINE__,
"PAPI_assign_eventset_component",
116 test_skip(__FILE__, __LINE__,
"Multiplex not supported", 1);
124 for (
i = 0;
i < nevents;
i++ ) {
136 test_skip( __FILE__, __LINE__,
"Not enough events left...", 0 );
144 t2 = 10000 * 20 * nevents;
146 test_skip( __FILE__, __LINE__,
"This test takes too much time",
157 iters = iters * (
int ) (
t2 /
t1 );
160 else if (
t1 > 30e6 ) {
161 test_skip( __FILE__, __LINE__,
"This test takes too much time",
183 printf(
"\nTest %d (of %d):\n",
i,
REPEATS );
192 printf(
"\n(calculated independent of PAPI)\n" );
193 printf(
"\tOperations= %.1f Mflop",
y * 1e-6 );
194 printf(
"\t(%g Mflop/s)\n\n",
195 (
y / (
double ) (
t2 -
t1 ) ) );
196 printf(
"PAPI measurements:\n" );
198 for ( j = 0; j < nevents; j++ ) {
201 printf(
"%lld",
values[j] );
208 for ( j = 0; j < nevents; j++ ) {
209 dtmp = ( double )
values[j];
211 valsample[j][
i - 1] = dtmp;
219 printf(
"\n\nEstimated variance relative "
220 "to average counts:\n" );
221 for ( j = 0; j < nevents; j++ )
222 printf(
" Event %.2d", j );
232 for ( j = 0; j < nevents; j++ ) {
236 double diff = ( valsample[j][
i] - avg[j] );
237 spread[j] += diff * diff;
239 spread[j] = sqrt( spread[j] /
REPEATS ) / avg[j];
241 printf(
"%9.2g ", spread[j] );
254 for ( j = 0; j < nevents; j++ ) {
256 printf(
"Event %.2d: mean=%10.0f, "
257 "sdev/mean=%7.2g nrpt=%2d -- %s\n",
258 j, avg[j], spread[j],
266 "Values outside threshold", fails );
static struct timeval t1 t2
add PAPI preset or native hardware event to an event set
Assign a component index to an existing but empty EventSet.
Create a new empty PAPI 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.
Read hardware counters from an event set.
Reset the hardware event counts in an 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)
char short_descr[PAPI_MIN_STR_LEN]