22 {
23
25 long long high=0,low=0,average=0,
expected=1500000;
26 double error,double_result;
27
31
33
35 printf("\nTesting the PAPI_FP_OPS event.\n\n");
36 }
37
38
42 }
43
44
48 }
49
50
53 if (!
quiet) fprintf(
stderr,
"PAPI_FP_OPS not available!\n");
55 }
56
57
58
59
60 total=0; high=0; low=0;
62
64 printf("Testing a loop with %lld floating point (%d times):\n",
66 }
67
68 for(
i=0;
i<num_runs;
i++) {
71
73
75
77 fprintf(
stderr,
"\tCode unimplemented\n");
78 test_skip( __FILE__, __LINE__,
"unimplemented", 0);
79 }
80
83 "reading PAPI_TOT_INS",
retval );
84 }
85
89 }
90
91 average=(
total/num_runs);
92
94
95 if (average>10) {
96 if (!
quiet) printf(
"Unexpected FP event value\n");
97 test_fail( __FILE__, __LINE__,
"Unexpected FP event", 1 );
98 }
99
100 if (!
quiet) printf(
"\n");
101
102
103
104
105 total=0; high=0; low=0;
107
108 num_runs=3;
109
111 printf("Testing a matrix multiply with %lld single-precision FP operations (%d times)\n",
113 }
114
115 for(
i=0;
i<num_runs;
i++) {
116
119
121
123
126 "reading PAPI_TOT_INS",
retval );
127 }
128
132 }
133
134 if (!
quiet) printf(
"Result %lf\n",double_result);
135
136 average=(
total/num_runs);
137
139
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 );
143 }
144
145 if (!
quiet) printf(
"\n");
146
147
148
149
150
151 total=0; high=0; low=0;
153
154 num_runs=3;
155
157 printf("Testing a matrix multiply with %lld double-precision FP operations (%d times)\n",
159 }
160
161 for(
i=0;
i<num_runs;
i++) {
162
165
167
169
172 "reading PAPI_TOT_INS",
retval );
173 }
174
178 }
179
180 if (!
quiet) printf(
"Result %lf\n",double_result);
181
182 average=(
total/num_runs);
183
185
186 if ((error > 1.0) || (error<-1.0)) {
187 if (!
quiet) printf(
"Instruction count off by more than 1%%\n");
188 test_fail( __FILE__, __LINE__,
"Error too high", 1 );
189 }
190
191 if (!
quiet) printf(
"\n");
192
194
196
197 return 0;
198}
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)
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