22int main(
int argc,
char **argv) {
25 long long high=0,low=0,average=0,
expected=1500000;
26 double error,double_result;
35 printf(
"\nTesting the PAPI_SP_OPS event.\n\n");
53 if (!
quiet) fprintf(
stderr,
"PAPI_SP_OPS not available!\n");
64 printf(
"Testing a loop with %lld floating point (%d times):\n",
68 for(
i=0;
i<num_runs;
i++) {
77 fprintf(
stderr,
"\tCode unimplemented\n");
78 test_skip( __FILE__, __LINE__,
"unimplemented", 0);
83 "reading PAPI_TOT_INS",
retval );
91 average=(
total/num_runs);
96 if (!
quiet) printf(
"Unexpected FP event value\n");
97 test_fail( __FILE__, __LINE__,
"Unexpected FP event", 1 );
100 if (!
quiet) printf(
"\n");
105 total=0; high=0; low=0;
111 printf(
"Testing a matrix multiply with %lld single-precision FP operations (%d times)\n",
115 for(
i=0;
i<num_runs;
i++) {
126 "reading PAPI_TOT_INS",
retval );
134 if (!
quiet) printf(
"Result %lf\n",double_result);
136 average=(
total/num_runs);
140 if ((error > 1.0) || (error<-1.0)) {
141 if (!
quiet) printf(
"Instruction count off by more than 1%%\n");
142 test_fail( __FILE__, __LINE__,
"Error too high", 1 );
145 if (!
quiet) printf(
"\n");
151 total=0; high=0; low=0;
159 printf(
"Testing a matrix multiply with %lld double-precision FP operations (%d times)\n",
163 for(
i=0;
i<num_runs;
i++) {
174 "reading PAPI_TOT_INS",
retval );
182 if (!
quiet) printf(
"Result %lf\n",double_result);
184 average=(
total/num_runs);
188 if ((error > 1.0) || (error<-1.0)) {
189 if (!
quiet) printf(
"Instruction count off by more than 1%%\n");
190 test_fail( __FILE__, __LINE__,
"Error too high", 1 );
193 if (!
quiet) printf(
"\n");
int branches_testcode(void)
add PAPI preset or native hardware event by name to an EventSet
Create a new empty PAPI EventSet.
initialize the PAPI library.
Reset the hardware event counts in an event set.
Finish using PAPI and free all related resources.
Start counting hardware events in an event set.
Stop counting hardware events in an event set.
static int expected[NUM_THREADS]
double display_error(long long average, long long high, long long low, long long expected, int quiet)
double flops_double_matrix_matrix_multiply(void)
int flops_double_init_matrix(void)
float flops_float_matrix_matrix_multiply(void)
int flops_float_init_matrix(void)
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)
#define CODE_UNIMPLEMENTED