by victoria1986 » Wed Sep 05, 2012 1:17 pm
Hello everyone.
I decided to post my questionin the same thread.
When I run flops.c example, it's fine, i get the values.
But when I try to paste all papi directive and functions I get flps and mlops=0. May be someone had that issue already?
here is my code
//PAPI initialization
float real_time, proc_time, mflops;
long long flpins;
int retval, fip=0;
retval = PAPI_library_init( PAPI_VER_CURRENT );
if ( retval != PAPI_VER_CURRENT )
fprintf(stderr,"PAPI library version mismatch!\n");
if ( PAPI_query_event( PAPI_FP_INS ) == PAPI_OK )
fip = 1;
else if ( PAPI_query_event( PAPI_FP_OPS ) == PAPI_OK )
fip = 2;
else {
printf( "PAPI_FP_INS and PAPI_FP_OPS are not defined for this platform.\n" );
}
PAPI_shutdown( );
if ( fip > 0 )
{
if ( fip == 1 ) {
if ( ( retval = PAPI_flips( &real_time, &proc_time, &flpins, &mflops ) ) < PAPI_OK )
fprintf(stderr,"Problem reading flips\n");}
else {
if ( ( retval = PAPI_flops( &real_time, &proc_time, &flpins, &mflops ) ) < PAPI_OK )
fprintf(stderr,"Problem reading flops\n");
}
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 ( fip == 1 )
{
if ( ( retval = PAPI_flips( &real_time, &proc_time, &flpins, &mflops ) ) < PAPI_OK )
fprintf(stderr,"Problem reading flips2\n");
}
else {
if ( ( retval =PAPI_flops( &real_time, &proc_time, &flpins,&mflops ) ) < PAPI_OK )
fprintf(stderr,"Problem reading flops2\n");
}
if ( fip == 1 )
{
printf( "Real_time: %f Proc_time: %f Total flpins: ", real_time,proc_time );
}
else {
printf( "Real_time: %f Proc_time: %f Total flpops: ", real_time,proc_time );
}
printf("Flops: %lld ",flpins);
printf( " MFLOPS: %f\n", mflops );
}
I will appreciate any suggestion, thank you