PAPI 7.1.0.0
Loading...
Searching...
No Matches
pthread_hl.c File Reference
Include dependency graph for pthread_hl.c:

Go to the source code of this file.

Data Structures

struct  papi_args_t
 

Macros

#define NUM_THREADS   4
 

Functions

void * CallMatMul (void *args)
 
int main (int argc, char **argv)
 

Macro Definition Documentation

◆ NUM_THREADS

#define NUM_THREADS   4

Definition at line 9 of file pthread_hl.c.

Function Documentation

◆ CallMatMul()

void * CallMatMul ( void *  args)

Definition at line 17 of file pthread_hl.c.

18{
19 long tid;
20 int retval, quiet;
21 char* region_name;
22
23 papi_args_t* papi_args = (papi_args_t*)args;
24 tid = (*papi_args).tid;
25 quiet = (*papi_args).quiet;
26 region_name = "do_flops";
27
28 if ( !quiet ) {
29 printf("\nThread %ld: instrument flops\n", tid);
30 }
31
32 retval = PAPI_hl_region_begin(region_name);
33 if ( retval != PAPI_OK ) {
34 test_fail( __FILE__, __LINE__, "PAPI_hl_region_begin", retval );
35 }
36
38
39 retval = PAPI_hl_region_end(region_name);
40 if ( retval != PAPI_OK ) {
41 test_fail( __FILE__, __LINE__, "PAPI_hl_region_end", retval );
42 }
43
44 pthread_exit(NULL);
45}
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
void PAPI_NORETURN test_fail(const char *file, int line, const char *call, int retval)
Definition: test_utils.c:491
int quiet
Definition: rapl_overflow.c:19
#define NUM_FLOPS
Definition: sdsc-mpx.c:24
int retval
Definition: zero_fork.c:53
Here is the call graph for this function:
Here is the caller graph for this function:

◆ main()

int main ( int  argc,
char **  argv 
)

Definition at line 47 of file pthread_hl.c.

48{
49 pthread_t threads[NUM_THREADS];
51 int rc;
52 long t;
53 int quiet = 0;
54
55 /* Set TESTS_QUIET variable */
56 quiet = tests_quiet( argc, argv );
57
58 for( t = 0; t < NUM_THREADS; t++) {
59 args[t].tid = t;
60 args[t].quiet = quiet;
61 rc = pthread_create(&threads[t], NULL, CallMatMul, (void *)&args[t]);
62 if (rc) {
63 printf("ERROR; return code from pthread_create() is %d\n", rc);
64 exit(-1);
65 }
66 }
67
68 for( t = 0; t < NUM_THREADS; t++) {
69 pthread_join(threads[t], NULL);
70 }
71
72
73 for( t = 0; t < NUM_THREADS; t++) {
74 args[t].tid = t;
75 args[t].quiet = quiet;
76 rc = pthread_create(&threads[t], NULL, CallMatMul, (void *)&args[t]);
77 if (rc) {
78 printf("ERROR; return code from pthread_create() is %d\n", rc);
79 exit(-1);
80 }
81 }
82
83 for( t = 0; t < NUM_THREADS; t++) {
84 pthread_join(threads[t], NULL);
85 }
86
87 test_hl_pass( __FILE__ );
88
89 return 0;
90}
unsigned long int pthread_t
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
rc
Definition: pscanf.h:23
void * CallMatMul(void *args)
Definition: pthread_hl.c:17
#define NUM_THREADS
Definition: pthread_hl.c:9
Here is the call graph for this function: