#include "mpi.h" #include #include #include #ifdef DO_LOG /* We don't really need the mpe.h file, and if we are combining this with -mpilog, we'll get the correct libraries */ /* #include "mpe.h" */ #else #define MPE_Log_event( a, b, c ) #define MPE_Describe_state(a,b,c,d) #endif void Compute( cnt, size, databuf ) int cnt, size; double *databuf; { int i,j; MPE_Log_event(1, 0, ""); for (j = 0; j < cnt; j++) { for (i = 0; i < size; i++) databuf[i] = sqrt(sqrt(databuf[i])); } MPE_Log_event(2, 0, ""); } int main( argc, argv ) int argc; char **argv; { int rank, size, left_nbr, right_nbr; int false = 0; int true = 1; int i, k, n, m, args[2]; double *rbuf, *sbuf, *databuf; MPI_Comm comm; MPI_Request r_recv, r_send, r[2]; MPI_Status status, statuses[2]; double t_comm, t_compute, t_both, t1; MPI_Init( &argc, &argv ); /* Get n and m */ MPI_Comm_rank( MPI_COMM_WORLD, &rank ); if (rank == 0) { /* Add a compute state */ MPE_Describe_state(1, 2, "Compute", "purple:vlines3"); /* Set the defaults */ args[0] = 20000; args[1] = 20000; for (i=0; i