PAPI 7.1.0.0
Loading...
Searching...
No Matches
zero_shmem.c
Go to the documentation of this file.
1/* This code attempts to test that SHMEM works with PAPI */
2/* SHMEM was developed by Cray and supported by various */
3/* other vendors. */
4
5#include <stdio.h>
6#include <stdlib.h>
7#include <unistd.h>
8#include <errno.h>
9#include <sys/types.h>
10#include <memory.h>
11#include <malloc.h>
12#include <pthread.h>
13
14#include "papi.h"
15#include "papi_test.h"
16
17#include "do_loops.h"
18
19void
20Thread( int n )
21{
22 int retval, num_tests = 1;
23 int EventSet1 = PAPI_NULL;
24 int mask1 = 0x5;
25 int num_events1;
26 long long **values;
27 long long elapsed_us, elapsed_cyc;
28
30
31 /* num_events1 is greater than num_events2 so don't worry. */
32
34
36
38
40
41 /* we should indicate failure somehow, not just exit */
42 if ( retval != PAPI_OK )
43 exit( 1 );
44
45 do_flops( n );
46
48 if ( retval != PAPI_OK )
49 exit( 1 );
50
52
54
56
57 printf( "Thread %#x PAPI_FP_INS : \t%lld\n", n / 1000000,
58 ( values[0] )[0] );
59 printf( "Thread %#x PAPI_TOT_CYC: \t%lld\n", n / 1000000,
60 ( values[0] )[1] );
61 printf( "Thread %#x Real usec : \t%lld\n", n / 1000000,
62 elapsed_us );
63 printf( "Thread %#x Real cycles : \t%lld\n", n / 1000000,
65
67}
68
69int
70main( int argc, char **argv )
71{
72 int quiet;
73 long long elapsed_us, elapsed_cyc;
74
75 /* Set TESTS_QUIET variable */
76 quiet=tests_quiet( argc, argv );
77
79
81
82#ifdef HAVE_OPENSHMEM
83 /* Start 2 processing elements (SHMEM call) */
84 start_pes( 2 );
85 Thread( 1000000 * ( _my_pe( ) + 1 ) );
86#else
87 if (!quiet) {
88 printf("No OpenSHMEM support\n");
89 }
90 test_skip( __FILE__, __LINE__, "OpenSHMEM support not found, skipping.", 0);
91#endif
92
94
96
97 printf( "Master real usec : \t%lld\n", elapsed_us );
98 printf( "Master real cycles : \t%lld\n", elapsed_cyc );
99
100 return 0;
101}
get real time counter value in clock cycles Returns the total real time passed since some arbitrary s...
get real time counter value in microseconds
Start counting hardware events in an event set.
Stop counting hardware events in an event set.
#define PAPI_OK
Definition: f90papi.h:73
#define PAPI_NULL
Definition: f90papi.h:78
static long long values[NUM_EVENTS]
Definition: init_fini.c:10
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
int add_test_events(int *number, int *mask, int allow_derived)
Definition: test_utils.c:152
void free_test_space(long long **values, int num_tests)
Definition: test_utils.c:70
long long ** allocate_test_space(int num_tests, int num_events)
Definition: test_utils.c:46
void PAPI_NORETURN test_skip(const char *file, int line, const char *call, int retval)
Definition: test_utils.c:584
int remove_test_events(int *EventSet, int mask)
Definition: test_utils.c:201
int main()
Definition: pernode.c:20
int quiet
Definition: rapl_overflow.c:19
int EventSet1
Definition: zero_fork.c:47
int num_events1
Definition: zero_fork.c:49
int mask1
Definition: zero_fork.c:48
long long elapsed_cyc
Definition: zero_fork.c:50
long long elapsed_us
Definition: zero_fork.c:50
int num_tests
Definition: zero_fork.c:53
int retval
Definition: zero_fork.c:53
void Thread(int n)
Definition: zero_shmem.c:20