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_DP_OPS event.\n\n");
53 if (!
quiet) fprintf(
stderr,
"PAPI_DP_OPS not available!\n");
63 printf(
"Testing a loop with %lld floating point (%d times):\n",
67 for(
i=0;
i<num_runs;
i++) {
76 fprintf(
stderr,
"\tCode unimplemented\n");
77 test_skip( __FILE__, __LINE__,
"unimplemented", 0);
82 "reading PAPI_TOT_INS",
retval );
90 average=(
total/num_runs);
95 if (!
quiet) printf(
"Unexpected FP event value\n");
96 test_fail( __FILE__, __LINE__,
"Unexpected FP event", 1 );
99 if (!
quiet) printf(
"\n");
104 total=0; high=0; low=0;
112 printf(
"Testing a matrix multiply with %lld single-precision FP operations (%d times)\n",
116 for(
i=0;
i<num_runs;
i++) {
127 "reading PAPI_TOT_INS",
retval );
135 if (!
quiet) printf(
"Result %lf\n",double_result);
137 average=(
total/num_runs);
141 if ((error > 1.0) || (error<-1.0)) {
142 if (!
quiet) printf(
"Instruction count off by more than 1%%\n");
143 test_fail( __FILE__, __LINE__,
"Error too high", 1 );
146 if (!
quiet) printf(
"\n");
152 total=0; high=0; low=0;
158 printf(
"Testing a matrix multiply with %lld double-precision FP operations (%d times)\n",
162 for(
i=0;
i<num_runs;
i++) {
173 "reading PAPI_TOT_INS",
retval );
181 if (!
quiet) printf(
"Result %lf\n",double_result);
183 average=(
total/num_runs);
187 if ((error > 1.0) || (error<-1.0)) {
188 if (!
quiet) printf(
"Instruction count off by more than 1%%\n");
189 test_fail( __FILE__, __LINE__,
"Error too high", 1 );
192 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