OpenMP writing example
#include <stdlib.h>
#include <stdio.h>
#include <inttypes.h>
get_time( void )
{
static uint64_t sequence;
#pragma omp threadprivate(sequence)
return sequence++;
}
pre_flush( void* userData,
void* callerData,
bool final )
{
}
post_flush( void* userData,
{
return get_time();
}
{
.otf2_post_flush = post_flush
};
int
main( int argc,
char** argv )
{
"ArchiveName",
1024 * 1024 ,
4 * 1024 * 1024 ,
int number_of_threads;
#pragma omp parallel shared(archive)
{
#pragma omp master
number_of_threads = omp_get_num_threads();
omp_get_thread_num() );
printf( "%p\n", evt_writer );
NULL,
get_time(),
0 );
NULL,
get_time(),
0 );
}
1 ,
0 ,
2 );
0 ,
3 ,
4 ,
5 ,
0 ,
0 ,
0 );
0 ,
6 ,
7 ,
0 ,
1 ,
0 );
for ( int i = 0; i < number_of_threads; i++ )
{
if ( i > 0 )
{
name = 7 + i;
char name_buf[ 32 ];
sprintf( name_buf, "OpenMP Thread %d", i );
}
i ,
name,
2 ,
0 );
}
return EXIT_SUCCESS;
}