36 #error "This compiler does not understand OPENMP" 98 printf(
"Thread %#x PAPI_TOT_CYC: \t%lld\n", omp_get_thread_num( ),
100 printf(
"Thread %#x Real usec : \t%lld\n", omp_get_thread_num( ),
102 printf(
"Thread %#x Real cycles : \t%lld\n", omp_get_thread_num( ),
120 int maxthr = omp_get_max_threads( );
122 long long *flops = calloc( maxthr,
sizeof (
long long ) );
123 long long *flopi = calloc( maxthr,
sizeof (
long long ) );
130 if ( ( flops == NULL ) || ( flopi == NULL ) )
139 test_fail( __FILE__, __LINE__,
"PAPI_get_hardware_info", 2 );
143 long ( * )(
void ) ) ( omp_get_thread_num ) );
150 flopper =
Thread( 65536 ) / 65536;
151 printf(
"flopper=%d\n", flopper );
153 for (
int i = 0;
i < 100000;
i++ )
154 #pragma omp parallel
private(tid)
156 tid = omp_get_thread_num( );
157 flopi[tid] =
rand( ) * 3;
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 );
171 test_fail( __FILE__, __LINE__,
"value returned for thread",
char event_name[2][PAPI_MAX_STR_LEN]
int PAPI_stop(int EventSet, long long *values)
void test_pass(const char *filename)
void test_skip(const char *file, int line, const char *call, int retval)
int PAPI_thread_init(unsigned long int(*id_fn)(void))
int PAPI_library_init(int version)
const PAPI_hw_info_t * hw_info
int add_two_events(int *num_events, int *papi_event, int *mask)
void free_test_space(long long **values, int num_tests)
int main(int argc, char **argv)
int PAPI_event_code_to_name(int EventCode, char *out)
long long PAPI_get_real_usec(void)
int PAPI_unregister_thread(void)
int tests_quiet(int argc, char **argv)
void test_fail(const char *file, int line, const char *call, int retval)
long long PAPI_get_real_cyc(void)
int PAPI_start(int EventSet)
const PAPI_hw_info_t * PAPI_get_hardware_info(void)
static long long values[NUM_EVENTS]
long long ** allocate_test_space(int num_tests, int num_events)
int remove_test_events(int *EventSet, int mask)