PAPI  5.6.0.0
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
zero_shmem.c File Reference
Include dependency graph for zero_shmem.c:

Go to the source code of this file.

Functions

void Thread (int n)
 
int main (int argc, char **argv)
 

Function Documentation

int main ( int  argc,
char **  argv 
)

Definition at line 70 of file zero_shmem.c.

71 {
72  int quiet;
73  long long elapsed_us, elapsed_cyc;
74 
75  /* Set TESTS_QUIET variable */
76  quiet=tests_quiet( argc, argv );
77 
78  elapsed_us = PAPI_get_real_usec( );
79 
80  elapsed_cyc = PAPI_get_real_cyc( );
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 
93  elapsed_cyc = PAPI_get_real_cyc( ) - elapsed_cyc;
94 
95  elapsed_us = PAPI_get_real_usec( ) - elapsed_us;
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 }
int int argc
Definition: iozone.c:1609
void test_skip(const char *file, int line, const char *call, int retval)
Definition: test_utils.c:559
char ** argv
Definition: iozone.c:1610
int quiet
Definition: rapl_overflow.c:18
long long elapsed_cyc
Definition: zero_fork.c:50
long long PAPI_get_real_usec(void)
Definition: papi.c:6264
printf("\tTry: -i 0 -i 1 \n\n")
int tests_quiet(int argc, char **argv)
Definition: test_utils.c:376
static void * Thread(void *arg)
long long PAPI_get_real_cyc(void)
Definition: papi.c:6217
long long elapsed_us
Definition: zero_fork.c:50

Here is the call graph for this function:

void Thread ( int  n)

Definition at line 20 of file zero_shmem.c.

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 
29  EventSet1 = add_test_events( &num_events1, &mask1, 1 );
30 
31  /* num_events1 is greater than num_events2 so don't worry. */
32 
33  values = allocate_test_space( num_tests, num_events1 );
34 
35  elapsed_us = PAPI_get_real_usec( );
36 
37  elapsed_cyc = PAPI_get_real_cyc( );
38 
39  retval = PAPI_start( EventSet1 );
40 
41  /* we should indicate failure somehow, not just exit */
42  if ( retval != PAPI_OK )
43  exit( 1 );
44 
45  do_flops( n );
46 
47  retval = PAPI_stop( EventSet1, values[0] );
48  if ( retval != PAPI_OK )
49  exit( 1 );
50 
51  elapsed_us = PAPI_get_real_usec( ) - elapsed_us;
52 
53  elapsed_cyc = PAPI_get_real_cyc( ) - elapsed_cyc;
54 
55  remove_test_events( &EventSet1, mask1 );
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,
64  elapsed_cyc );
65 
66  free_test_space( values, num_tests );
67 }
int PAPI_stop(int EventSet, long long *values)
Definition: papi.c:2314
int mask1
Definition: zero_fork.c:48
#define PAPI_NULL
Definition: papi.h:292
int num_events1
Definition: zero_fork.c:49
return PAPI_OK
Definition: linux-nvml.c:497
long long elapsed_cyc
Definition: zero_fork.c:50
void free_test_space(long long **values, int num_tests)
Definition: test_utils.c:70
int num_tests
Definition: zero_fork.c:53
void do_flops(int n)
Definition: multiplex.c:23
long long PAPI_get_real_usec(void)
Definition: papi.c:6264
printf("\tTry: -i 0 -i 1 \n\n")
long long PAPI_get_real_cyc(void)
Definition: papi.c:6217
int PAPI_start(int EventSet)
Definition: papi.c:2096
static long long values[NUM_EVENTS]
Definition: init_fini.c:10
ssize_t retval
Definition: libasync.c:338
long long elapsed_us
Definition: zero_fork.c:50
long long ** allocate_test_space(int num_tests, int num_events)
Definition: test_utils.c:46
void exit()
int remove_test_events(int *EventSet, int mask)
Definition: test_utils.c:201
int add_test_events(int *number, int *mask, int allow_derived)
Definition: test_utils.c:152
int EventSet1
Definition: zero_fork.c:47

Here is the call graph for this function: