PAPI 7.1.0.0
Loading...
Searching...
No Matches
omp_hl.c
Go to the documentation of this file.
1#include <stdio.h>
2#include <stdlib.h>
3#include <time.h>
4#include <omp.h>
5#include "papi.h"
6#include "papi_test.h"
7#include "do_loops.h"
8
9int main( int argc, char **argv )
10{
11 int retval, i;
12 int quiet = 0;
13 char* region_name;
14
15 /* Set TESTS_QUIET variable */
16 quiet = tests_quiet( argc, argv );
17
18 region_name = "do_flops";
19
20 #pragma omp parallel
21 #pragma omp for
22 for ( i = 1; i <= 4; ++i ) {
23 int tid;
24 tid = omp_get_thread_num();
25
26 if ( !quiet ) {
27 printf("\nThread %d: instrument flops\n", tid);
28 }
29
30 retval = PAPI_hl_region_begin(region_name);
31 if ( retval != PAPI_OK ) {
32 test_fail( __FILE__, __LINE__, "PAPI_hl_region_begin", retval );
33 }
34
36
37 retval = PAPI_hl_region_end(region_name);
38 if ( retval != PAPI_OK ) {
39 test_fail( __FILE__, __LINE__, "PAPI_hl_region_end", retval );
40 }
41
42 }
43
44 region_name = "do_flops_2";
45 #pragma omp parallel
46 #pragma omp for
47 for ( i = 1; i <= 4; ++i ) {
48 int tid;
49 tid = omp_get_thread_num();
50
51 if ( !quiet ) {
52 printf("\nThread %d: instrument flops_2\n", tid);
53 }
54
55 retval = PAPI_hl_region_begin(region_name);
56 if ( retval != PAPI_OK ) {
57 test_fail( __FILE__, __LINE__, "PAPI_hl_region_begin", retval );
58 }
59
61
62 retval = PAPI_hl_region_end(region_name);
63 if ( retval != PAPI_OK ) {
64 test_fail( __FILE__, __LINE__, "PAPI_hl_region_end", retval );
65 }
66 }
67
68 test_hl_pass( __FILE__ );
69
70 return 0;
71}
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