20 {
"LO_RX_PACKETS",
"LO_TX_PACKETS",
"ETH0_RX_PACKETS",
"ETH0_TX_PACKETS" };
25 return ( 4.0 / ( 1.0 +
a *
a ) );
29main(
int argc,
char **argv )
34 long long g1[2], g2[2];
36 int done = 0, n,
myid, numprocs;
37 double PI25DT = 3.141592653589793238462643;
38 double mypi, pi, h, sum,
x;
39 double startwtime = 0.0, endwtime;
41 char processor_name[MPI_MAX_PROCESSOR_NAME];
97 MPI_Init( &argc, &argv );
99 MPI_Comm_size( MPI_COMM_WORLD, &numprocs );
100 MPI_Comm_rank( MPI_COMM_WORLD, &
myid );
101 MPI_Get_processor_name( processor_name, &namelen );
103 fprintf(
stdout,
"Process %d of %d on %s\n",
104 myid, numprocs, processor_name );
121 startwtime = MPI_Wtime( );
123 MPI_Bcast( &n, 1, MPI_INT, 0, MPI_COMM_WORLD );
127 h = 1.0 / ( double ) n;
130 for (
i =
myid + 1;
i <= n;
i += numprocs ) {
131 x = h * ( ( double )
i - 0.5 );
136 MPI_Reduce( &mypi, &pi, 1, MPI_DOUBLE, MPI_SUM, 0, MPI_COMM_WORLD );
139 printf(
"pi is approximately %.16f, Error is %.16f\n",
140 pi, fabs( pi - PI25DT ) );
141 endwtime = MPI_Wtime( );
142 printf(
"wall clock time = %f\n", endwtime - startwtime );
157 printf(
"ETH0_RX_BYTES: %lld ETH0_TX_BYTES: %lld\n", g2[0], g2[1] );
159 printf(
"PAPI_TOT_CYC : %lld\n", g1[0] );
160 }
else if ( ins == 1 ) {
161 printf(
"PAPI_FP_INS : %lld PAPI_TOT_CYC : %lld\n", g1[0], g1[1] );
162 }
else if ( ins == 2 ) {
163 printf(
"PAPI_FP_OPS : %lld PAPI_TOT_CYC : %lld\n", g1[0], g1[1] );
add PAPI preset or native hardware event to an event set
Create a new empty PAPI EventSet.
Convert a name to a numeric hardware event code.
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.
static pthread_t myid[NUM_THREADS]
static double a[MATRIX_SIZE][MATRIX_SIZE]
int tests_quiet(int argc, char **argv)
void PAPI_NORETURN test_fail(const char *file, int line, const char *call, int retval)
void PAPI_NORETURN test_pass(const char *filename)