118{
120 int maxthr = omp_get_max_threads( );
121 int flopper = 0;
122 long long *flops = calloc( maxthr, sizeof ( long long ) );
123 long long *flopi = calloc( maxthr, sizeof ( long long ) );
124
126
127 if ( maxthr < 2 )
129
130 if ( ( flops == NULL ) || ( flopi == NULL ) )
132
136
139 test_fail( __FILE__, __LINE__,
"PAPI_get_hardware_info", 2 );
140
143 long ( * )( void ) ) ( omp_get_thread_num ) );
147 else
149
150 flopper =
Thread( 65536 ) / 65536;
151 printf( "flopper=%d\n", flopper );
152
153 for (
int i = 0;
i < 100000;
i++ )
154#pragma omp parallel private(tid)
155 {
156 tid = omp_get_thread_num( );
157 flopi[tid] = rand( ) * 3;
159#pragma omp barrier
160#pragma omp master
161 if ( flops[tid] < flopi[tid] ) {
162 printf(
"test iteration=%d\n",
i );
163 for ( int j = 0; j < omp_get_num_threads( ); j++ ) {
164 printf( "Thread %#x Value %6lld %c %6lld", j, flops[j],
165 ( flops[j] < flopi[j] ) ? '<' : '=', flopi[j] );
166 for ( int k = 0; k < omp_get_num_threads( ); k++ )
167 if ( ( k != j ) && ( flops[k] == flops[j] ) )
168 printf( " == Thread %#x!", k );
169 printf( "\n" );
170 }
171 test_fail( __FILE__, __LINE__,
"value returned for thread",
173 }
174 }
175
177 exit( 0 );
178}
get information about the system hardware
initialize the PAPI library.
Initialize thread support in the PAPI library.
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)
const PAPI_hw_info_t * hw_info