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 );
253 if (!
quiet) fprintf(stdout,
"y=%lf\n",
y);
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++ ) {
int PAPI_stop(int EventSet, long long *values)
void test_pass(const char *filename)
int PAPI_add_event(int EventSet, int EventCode)
double do_flops3(double x, int iters, int quiet)
int PAPI_remove_events(int EventSet, int *Events, int number)
char derived[PAPI_MIN_STR_LEN]
int PAPI_add_events(int EventSet, int *Events, int number)
Return codes and api definitions.
int PAPI_get_event_info(int EventCode, PAPI_event_info_t *info)
void test_skip(const char *file, int line, const char *call, int retval)
char events[MAX_EVENTS][BUFSIZ]
void ref_measurements(int iters, int *eventset, int *events, int nevents, long long *refvalues)
int PAPI_library_init(int version)
void check_values(int eventset, int *events, int nevents, long long *values, long long *refvalues)
char symbol[PAPI_HUGE_STR_LEN]
int main(int argc, char **argv)
char short_descr[PAPI_MIN_STR_LEN]
int PAPI_cleanup_eventset(int EventSet)
int PAPI_assign_eventset_component(int EventSet, int cidx)
int PAPI_create_eventset(int *EventSet)
int PAPI_multiplex_init(void)
long long PAPI_get_real_usec(void)
int tests_quiet(int argc, char **argv)
void test_fail(const char *file, int line, const char *call, int retval)
int PAPI_set_multiplex(int EventSet)
int PAPI_destroy_eventset(int *EventSet)
int PAPI_start(int EventSet)
static long long values[NUM_EVENTS]