PAPI thread support

PAPI thread support

Postby victoria1986 » Sun Sep 16, 2012 11:36 pm

Hello everyone.
I'm new to papi so please help with some basic steps.
I have an openmp parallelized loop and I want to measure some events (they are compatible, I checked). The problem is that i get some horrible huge numbers.
Here is my code:
int private_event_set=PAPI_NULL;
#define NUM_EVENTS 5
#define NUM_THREADS 2
long long values[NUM_EVENTS];
int group1[NUM_EVENTS]
for(loop_counter=0;loop_counter<NUM_EVENTS;loop_counter++)

{
group1[loop_counter]=PAPI_L1_DCM;
group1[loop_counter]=PAPI_L1_ICM;
group1[loop_counter]=PAPI_L2_DCM;
group1[loop_counter]=PAPI_L2_ICM;
group1[loop_counter]=PAPI_L1_TCM;
}

# pragma omp parallel \
shared ( n, x, z ) \
private ( i, z0, z1 ,nthreads,private_event_set,retval,values,loop_counter) \
firstprivate(group1)

{
nthreads=omp_get_thread_num();
private_event_set=PAPI_NULL;

if ( ( retval = PAPI_create_eventset( &private_event_set) ) != PAPI_OK )
fprintf(stderr,"tid %d PAPI_create_eventset!\n",nthreads);


if ( ( retval = PAPI_add_events( private_event_set, ( int * ) group1,NUM_EVENTS) ) < PAPI_OK )
fprintf(stderr,"tid %d PAPI_add_events!\n",nthreads);

if ( ( retval = PAPI_start( private_event_set ) ) != PAPI_OK )
fprintf(stderr,"tid %d PAPI_start!\n",nthreads);



# pragma omp for

for ( i = 0; i < 2 * n; i = i + 2 )
{
z0 = 0.0;
z1 = 0.0;
x[i] = z0;
z[i] = z0;
x[i+1] = z1;
z[i+1] = z1;


}

if ( ( retval = PAPI_stop( private_event_set, values ) ) != PAPI_OK )
fprintf(stderr,"PAPI_stop!\n");

for(loop_counter=0;loop_counter<NUM_EVENTS;loop_counter++)

{

printf("TID: %d values[%d]= %lld \n", nthreads,loop_counter,values[loop_counter]);
}


}
the output for 2 threads and 5 events:
TID: 0 values[0]= 8392036
TID: 0 values[1]= 140522924818768
TID: 0 values[2]= 140736394947808
TID: 0 values[3]= 1568
TID: 0 values[4]= 2
TID: 1 values[0]= 8392067
TID: 1 values[1]= 4614256656130388420
TID: 1 values[2]= 2147483647
TID: 1 values[3]= 4202236
TID: 1 values[4]= 140736394947760
I use papi 4.2.0
don't know the machine configuration (shark cluster node)
I would appreciate any hint, thank you
victoria1986
 
Posts: 2
Joined: Wed Sep 05, 2012 1:11 pm

Return to Classic PAPI

Who is online

Users browsing this forum: No registered users and 0 guests