#include #include #include #include #include #include "global.h" #include "mpi.h" #define MAX_PROCS 8 using namespace std; double f1(int worksize, int myid, int halfNproc) { TAU_PROFILE("f1()", "", TAU_DEFAULT); // for half of the nodes, sleep twice as long if (myid >= halfNproc) { worksize += worksize; } int numprocs = halfNproc * 2; // for strong scaling, increase thework with the number of processors. int n = 10000000 * worksize * numprocs; // for weak scaling, keep the work constant. //int n = 100000000 * worksize; cout< MAX_PROCS) { cout << "Too many processors. Please recompile and increase MAX_PROCS" << endl; MPI_Abort(MPI_COMM_WORLD, 1); } bool loadBalance = (atoi(argv[1]) == 1) ? true : false; bool useDecay = (atoi(argv[2]) == 1) ? true : false; int decay = atoi(argv[3]); TAU_PROFILE_SET_NODE(myid); // initialize the runtime global view int viewID = 0; TAU_REGISTER_VIEW("f1()",&viewID); // initialize the first runtime global communicator int firstCommID = 0; int members[nproc]; for (int i = 0 ; i < nproc ; i++) { members[i] = i; } TAU_REGISTER_COMMUNICATOR(members, nproc, &firstCommID); // initialize the work size uniformly int worksize = MAX_PROCS/2; double lastTime[nproc]; double circularBuffer[decay][nproc]; if (myid == 0) { for (int i=0; i avg) { data[i] = data[i] - 1; } } } else { for (int i=0; i avg) { data[i] = data[i] - 1; } } } } // redistrubite the workloads MPI_Scatter(data, 1, MPI_INT, &worksize, 1, MPI_INT, 0, MPI_COMM_WORLD); } //TAU_PHASE_STOP(phase); } MPI_Finalize(); }