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

Go to the source code of this file.

Functions

int main (int argc, char **argv)
 

Variables

int TESTS_QUIET
 

Function Documentation

◆ main()

int main ( int  argc,
char **  argv 
)

Definition at line 23 of file nineth.c.

24{
25 int retval, num_tests = 2, tmp;
26 int EventSet1 = PAPI_NULL;
27 int EventSet2 = PAPI_NULL;
28 int mask1 = 0x80001; /* FP_OPS and TOT_CYC */
29 int mask2 = 0x8; /* FLOPS */
30 int num_events1;
31 int num_events2;
32 long long **values;
33 int clockrate;
34 double test_flops;
35
36
37 tests_quiet( argc, argv ); /* Set TESTS_QUIET variable */
38
40 if ( retval != PAPI_VER_CURRENT )
41 test_fail( __FILE__, __LINE__, "PAPI_library_init", retval );
42
43 /* gotta count flops to run this test */
45 test_skip( __FILE__, __LINE__, "PAPI_query_event", retval );
46
48/* EventSet2 = add_test_events(&num_events2, &mask2); */
49
50 if ( num_events1 == 0 || num_events2 == 0 )
51 test_skip( __FILE__, __LINE__, "add_test_events", PAPI_ENOEVNT );
52
53 /* num_events1 is greater than num_events2 so don't worry. */
54
56
57 clockrate = PAPI_get_opt( PAPI_CLOCKRATE, NULL );
58 if ( clockrate < 1 )
59 test_fail( __FILE__, __LINE__, "PAPI_get_opt", retval );
60
62 if ( retval != PAPI_OK )
63 test_fail( __FILE__, __LINE__, "PAPI_start", retval );
64
66
68 if ( retval != PAPI_OK )
69 test_fail( __FILE__, __LINE__, "PAPI_stop", retval );
70/*
71 retval = PAPI_start(EventSet2);
72 if (retval != PAPI_OK)
73 test_fail(__FILE__, __LINE__, "PAPI_start", retval);
74
75 do_flops(NUM_FLOPS);
76
77 retval = PAPI_stop(EventSet2, values[1]);
78 if (retval != PAPI_OK)
79 test_fail(__FILE__, __LINE__, "PAPI_stop", retval);
80*/
82/* remove_test_events(&EventSet2, mask2); */
83
84 test_flops =
85 ( double ) ( values[0] )[0] *
86 ( double ) clockrate *( double ) 1000000.0;
87 test_flops = test_flops / ( double ) ( values[0] )[1];
88
89 if ( !TESTS_QUIET ) {
90 printf( "Test case 9: start, stop for derived event PAPI_FLOPS.\n" );
91 printf( "------------------------------------------------------\n" );
92 tmp = PAPI_get_opt( PAPI_DEFDOM, NULL );
93 printf( "Default domain is: %d (%s)\n", tmp,
95 tmp = PAPI_get_opt( PAPI_DEFGRN, NULL );
96 printf( "Default granularity is: %d (%s)\n", tmp,
98 printf( "Using %d iterations of c += a*b\n", NUM_FLOPS );
99 printf
100 ( "-------------------------------------------------------------------------\n" );
101
102 printf( "Test type : %12s%12s\n", "1", "2" );
103 printf( TAB2, "PAPI_FP_OPS : ", ( values[0] )[0], ( long long ) 0 );
104 printf( TAB2, "PAPI_TOT_CYC: ", ( values[0] )[1], ( long long ) 0 );
105 printf( TAB2, "PAPI_FLOPS : ", ( long long ) 0, ( values[1] )[0] );
106 printf
107 ( "-------------------------------------------------------------------------\n" );
108
109 printf( "Verification:\n" );
110 printf( "Last number in row 3 approximately equals %f\n", test_flops );
111 printf( "This test is no longer valid: PAPI_FLOPS is deprecated.\n" );
112 }
113/* {
114 double min, max;
115 min = values[1][0] * .9;
116 max = values[1][0] * 1.1;
117 if (test_flops > max || test_flops < min)
118 test_fail(__FILE__, __LINE__, "PAPI_FLOPS", 1);
119 }
120*/
121 test_pass( __FILE__, values, num_tests );
122 exit( 1 );
123}
double tmp
Get PAPI library or event set options.
initialize the PAPI library.
Query if PAPI event exists.
Start counting hardware events in an event set.
Stop counting hardware events in an event set.
#define PAPI_VER_CURRENT
Definition: f90papi.h:54
#define PAPI_OK
Definition: f90papi.h:73
#define PAPI_CLOCKRATE
Definition: f90papi.h:110
#define PAPI_NULL
Definition: f90papi.h:78
#define PAPI_DEFGRN
Definition: f90papi.h:26
#define PAPI_ENOEVNT
Definition: f90papi.h:139
#define PAPI_FP_OPS
Definition: f90papi.h:319
#define PAPI_DEFDOM
Definition: f90papi.h:188
static long long values[NUM_EVENTS]
Definition: init_fini.c:10
void do_flops(int n)
Definition: multiplex.c:23
int TESTS_QUIET
Definition: test_utils.c:18
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
char * stringify_all_domains(int domains)
Definition: test_utils.c:293
char * stringify_granularity(int granularity)
Definition: test_utils.c:353
#define TAB2
Definition: papi_test.h:99
void PAPI_NORETURN test_fail(const char *file, int line, const char *call, int retval)
Definition: test_utils.c:491
long long ** allocate_test_space(int num_tests, int num_events)
Definition: test_utils.c:46
void PAPI_NORETURN test_pass(const char *filename)
Definition: test_utils.c:432
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 EventSet2
Definition: rapl_overflow.c:17
#define NUM_FLOPS
Definition: sdsc-mpx.c:24
int EventSet1
Definition: zero_fork.c:47
int num_events1
Definition: zero_fork.c:49
int mask1
Definition: zero_fork.c:48
int num_tests
Definition: zero_fork.c:53
int retval
Definition: zero_fork.c:53
Here is the call graph for this function:

Variable Documentation

◆ TESTS_QUIET

int TESTS_QUIET
extern

Definition at line 18 of file test_utils.c.