diff --git a/src/ior.c b/src/ior.c index 8a349a0..f30594a 100755 --- a/src/ior.c +++ b/src/ior.c @@ -1008,7 +1008,7 @@ static void InitTests(IOR_test_t *tests, MPI_Comm com) tests = tests->next; } - init_clock(); + init_clock(com); } /* @@ -1415,7 +1415,7 @@ static void TestIoSys(IOR_test_t *test) if ((params->readFile || params->checkRead ) && !test_time_elapsed(params, startTime)) { /* check for stonewall */ if(params->stoneWallingStatusFile){ - params->stoneWallingWearOutIterations = ReadStoneWallingIterations(params->stoneWallingStatusFile); + params->stoneWallingWearOutIterations = ReadStoneWallingIterations(params->stoneWallingStatusFile, params->testComm); if(params->stoneWallingWearOutIterations == -1 && rank == 0){ WARN("Could not read back the stonewalling status from the file!"); params->stoneWallingWearOutIterations = 0; diff --git a/src/md-workbench.c b/src/md-workbench.c index 7c130b1..b9b1b23 100644 --- a/src/md-workbench.c +++ b/src/md-workbench.c @@ -853,8 +853,8 @@ mdworkbench_results_t* md_workbench_run(int argc, char ** argv, MPI_Comm world_c int ret; int printhelp = 0; char * limit_memory_P = NULL; - init_options(); + init_clock(world_com); o.com = world_com; o.logfile = out_logfile; @@ -935,8 +935,8 @@ mdworkbench_results_t* md_workbench_run(int argc, char ** argv, MPI_Comm world_c // MPI_Abort(o.com, 1); //} - double bench_start; - bench_start = GetTimeStamp(); + double t_bench_start; + t_bench_start = GetTimeStamp(); phase_stat_t phase_stats; size_t result_count = (2 + o.iterations) * (o.adaptive_waiting_mode ? 7 : 1); o.results = malloc(sizeof(mdworkbench_results_t) + sizeof(mdworkbench_result_t) * result_count); @@ -1006,7 +1006,7 @@ mdworkbench_results_t* md_workbench_run(int argc, char ** argv, MPI_Comm world_c store_position(current_index); } - double t_all = GetTimeStamp(); + double t_all = GetTimeStamp() - t_bench_start; if(o.backend->finalize){ o.backend->finalize(o.backend_options); } diff --git a/src/mdtest.c b/src/mdtest.c index 6d610df..5386739 100644 --- a/src/mdtest.c +++ b/src/mdtest.c @@ -1118,7 +1118,7 @@ void file_test(const int iteration, const int ntasks, const char *path, rank_pro if (o.stoneWallingStatusFile){ int64_t expected_items; /* The number of items depends on the stonewalling file */ - expected_items = ReadStoneWallingIterations(o.stoneWallingStatusFile); + expected_items = ReadStoneWallingIterations(o.stoneWallingStatusFile, testComm); if(expected_items >= 0){ if(o.directory_loops > 1){ o.directory_loops = expected_items / o.items_per_dir; @@ -1946,7 +1946,7 @@ mdtest_results_t * mdtest_run(int argc, char **argv, MPI_Comm world_com, FILE * out_resultfile = world_out; mpi_comm_world = world_com; - init_clock(); + init_clock(world_com); mdtest_init_args(); int i, j; diff --git a/src/utilities.c b/src/utilities.c index 0ec2390..cb2deae 100755 --- a/src/utilities.c +++ b/src/utilities.c @@ -706,34 +706,34 @@ double GetTimeStamp(void) /* * Determine any spread (range) between node times. */ -static double TimeDeviation(void) +static double TimeDeviation(MPI_Comm com) { double timestamp; double min = 0; double max = 0; double roottimestamp; - MPI_CHECK(MPI_Barrier(mpi_comm_world), "barrier error"); + MPI_CHECK(MPI_Barrier(com), "barrier error"); timestamp = GetTimeStamp(); MPI_CHECK(MPI_Reduce(×tamp, &min, 1, MPI_DOUBLE, - MPI_MIN, 0, mpi_comm_world), + MPI_MIN, 0, com), "cannot reduce tasks' times"); MPI_CHECK(MPI_Reduce(×tamp, &max, 1, MPI_DOUBLE, - MPI_MAX, 0, mpi_comm_world), + MPI_MAX, 0, com), "cannot reduce tasks' times"); /* delta between individual nodes' time and root node's time */ roottimestamp = timestamp; - MPI_CHECK(MPI_Bcast(&roottimestamp, 1, MPI_DOUBLE, 0, mpi_comm_world), + MPI_CHECK(MPI_Bcast(&roottimestamp, 1, MPI_DOUBLE, 0, com), "cannot broadcast root's time"); wall_clock_delta = timestamp - roottimestamp; return max - min; } -void init_clock(){ +void init_clock(MPI_Comm com){ /* check for skew between tasks' start times */ - wall_clock_deviation = TimeDeviation(); + wall_clock_deviation = TimeDeviation(com); } char * PrintTimestamp() { @@ -751,16 +751,16 @@ char * PrintTimestamp() { return datestring; } -int64_t ReadStoneWallingIterations(char * const filename){ +int64_t ReadStoneWallingIterations(char * const filename, MPI_Comm com){ long long data; if(rank != 0){ - MPI_Bcast( & data, 1, MPI_LONG_LONG_INT, 0, mpi_comm_world); + MPI_Bcast( & data, 1, MPI_LONG_LONG_INT, 0, com); return data; }else{ FILE * out = fopen(filename, "r"); if (out == NULL){ data = -1; - MPI_Bcast( & data, 1, MPI_LONG_LONG_INT, 0, mpi_comm_world); + MPI_Bcast( & data, 1, MPI_LONG_LONG_INT, 0, com); return data; } int ret = fscanf(out, "%lld", & data); @@ -768,7 +768,7 @@ int64_t ReadStoneWallingIterations(char * const filename){ return -1; } fclose(out); - MPI_Bcast( & data, 1, MPI_LONG_LONG_INT, 0, mpi_comm_world); + MPI_Bcast( & data, 1, MPI_LONG_LONG_INT, 0, com); return data; } } diff --git a/src/utilities.h b/src/utilities.h index 83563c5..dd6d16f 100755 --- a/src/utilities.h +++ b/src/utilities.h @@ -52,10 +52,10 @@ void updateParsedOptions(IOR_param_t * options, options_all_t * global_options); size_t NodeMemoryStringToBytes(char *size_str); /* Returns -1, if cannot be read */ -int64_t ReadStoneWallingIterations(char * const filename); +int64_t ReadStoneWallingIterations(char * const filename, MPI_Comm com); void StoreStoneWallingIterations(char * const filename, int64_t count); -void init_clock(void); +void init_clock(MPI_Comm com); double GetTimeStamp(void); char * PrintTimestamp(); // TODO remove this function unsigned long GetProcessorAndCore(int *chip, int *core);