int main(int argc, char** argv) { int problemToSolve = 2; int initializationValue = 1; int numberOfAlterations = 5; initializeMPI(); if (argc >= 4) { problemToSolve = atoi (argv[1]); initializationValue = atoi (argv[2]); numberOfAlterations = atoi (argv[3]); } else if (procRank == 0) { printf("No valid arguments, default values used.\n\n"); } struct timespec begin = {0,0}, end = {0,0}; clock_gettime(CLOCK_REALTIME, &begin); if (problemToSolve == 1) solveProblem1(numberOfAlterations, initializationValue); else if (problemToSolve == 2) solveProblem2(numberOfAlterations, initializationValue); clock_gettime(CLOCK_REALTIME, &end); if (procRank == 0) printf ("\nExecution time: %.0f ms\n", (((double)end.tv_sec + 1.0e-9*end.tv_nsec) - ((double)begin.tv_sec + 1.0e-9*begin.tv_nsec)) * 1000.0); finalizeMPI(); return 0; }
MPIManager::~MPIManager() { finalizeMPI(); }