PAPI 7.1.0.0
Loading...
Searching...
No Matches
mpi_omp_hl.c
Go to the documentation of this file.
1#include <stdio.h>
2#include <stdlib.h>
3#include <time.h>
4#include <mpi.h>
5#include <omp.h>
6#include "papi.h"
7#include "papi_test.h"
8#include "do_loops.h"
9
10int main( int argc, char **argv )
11{
12 int retval, i;
13 int quiet = 0;
14 char* region_name;
15 int world_size, world_rank;
16
17 /* Set TESTS_QUIET variable */
18 quiet = tests_quiet( argc, argv );
19
20 MPI_Init( &argc, &argv );
21 MPI_Comm_size(MPI_COMM_WORLD, &world_size);
22 MPI_Comm_rank(MPI_COMM_WORLD, &world_rank);
23
24 region_name = "do_flops";
25
26 #pragma omp parallel
27 #pragma omp for
28 for ( i = 1; i <= 2; ++i ) {
29 int tid;
30 tid = omp_get_thread_num();
31
32 if ( !quiet ) {
33 printf("\nRank %d, Thread %d: instrument flops\n", world_rank, tid);
34 }
35
36 retval = PAPI_hl_region_begin(region_name);
37 if ( retval != PAPI_OK ) {
38 test_fail( __FILE__, __LINE__, "PAPI_hl_region_begin", retval );
39 }
40
42
43 retval = PAPI_hl_region_end(region_name);
44 if ( retval != PAPI_OK ) {
45 test_fail( __FILE__, __LINE__, "PAPI_hl_region_end", retval );
46 }
47
48 }
49
50 MPI_Finalize();
51 test_hl_pass( __FILE__ );
52
53 return 0;
54}
int i
Read performance events at the beginning of a region.
Read performance events at the end of a region and store the difference to the corresponding beginnin...
#define PAPI_OK
Definition: f90papi.h:73
void do_flops(int n)
Definition: multiplex.c:23
Return codes and api definitions.
int tests_quiet(int argc, char **argv)
Definition: test_utils.c:376
void PAPI_NORETURN test_hl_pass(const char *filename)
Definition: test_utils.c:467
void PAPI_NORETURN test_fail(const char *file, int line, const char *call, int retval)
Definition: test_utils.c:491
int main()
Definition: pernode.c:20
int quiet
Definition: rapl_overflow.c:19
#define NUM_FLOPS
Definition: sdsc-mpx.c:24
int retval
Definition: zero_fork.c:53