Reduce the dependency to global MPI Communicator
parent
58fbefbd33
commit
e4120d600d
|
@ -1008,7 +1008,7 @@ static void InitTests(IOR_test_t *tests, MPI_Comm com)
|
||||||
tests = tests->next;
|
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)) {
|
if ((params->readFile || params->checkRead ) && !test_time_elapsed(params, startTime)) {
|
||||||
/* check for stonewall */
|
/* check for stonewall */
|
||||||
if(params->stoneWallingStatusFile){
|
if(params->stoneWallingStatusFile){
|
||||||
params->stoneWallingWearOutIterations = ReadStoneWallingIterations(params->stoneWallingStatusFile);
|
params->stoneWallingWearOutIterations = ReadStoneWallingIterations(params->stoneWallingStatusFile, params->testComm);
|
||||||
if(params->stoneWallingWearOutIterations == -1 && rank == 0){
|
if(params->stoneWallingWearOutIterations == -1 && rank == 0){
|
||||||
WARN("Could not read back the stonewalling status from the file!");
|
WARN("Could not read back the stonewalling status from the file!");
|
||||||
params->stoneWallingWearOutIterations = 0;
|
params->stoneWallingWearOutIterations = 0;
|
||||||
|
|
|
@ -853,8 +853,8 @@ mdworkbench_results_t* md_workbench_run(int argc, char ** argv, MPI_Comm world_c
|
||||||
int ret;
|
int ret;
|
||||||
int printhelp = 0;
|
int printhelp = 0;
|
||||||
char * limit_memory_P = NULL;
|
char * limit_memory_P = NULL;
|
||||||
|
|
||||||
init_options();
|
init_options();
|
||||||
|
init_clock(world_com);
|
||||||
|
|
||||||
o.com = world_com;
|
o.com = world_com;
|
||||||
o.logfile = out_logfile;
|
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);
|
// MPI_Abort(o.com, 1);
|
||||||
//}
|
//}
|
||||||
|
|
||||||
double bench_start;
|
double t_bench_start;
|
||||||
bench_start = GetTimeStamp();
|
t_bench_start = GetTimeStamp();
|
||||||
phase_stat_t phase_stats;
|
phase_stat_t phase_stats;
|
||||||
size_t result_count = (2 + o.iterations) * (o.adaptive_waiting_mode ? 7 : 1);
|
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);
|
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);
|
store_position(current_index);
|
||||||
}
|
}
|
||||||
|
|
||||||
double t_all = GetTimeStamp();
|
double t_all = GetTimeStamp() - t_bench_start;
|
||||||
if(o.backend->finalize){
|
if(o.backend->finalize){
|
||||||
o.backend->finalize(o.backend_options);
|
o.backend->finalize(o.backend_options);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1118,7 +1118,7 @@ void file_test(const int iteration, const int ntasks, const char *path, rank_pro
|
||||||
if (o.stoneWallingStatusFile){
|
if (o.stoneWallingStatusFile){
|
||||||
int64_t expected_items;
|
int64_t expected_items;
|
||||||
/* The number of items depends on the stonewalling file */
|
/* 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(expected_items >= 0){
|
||||||
if(o.directory_loops > 1){
|
if(o.directory_loops > 1){
|
||||||
o.directory_loops = expected_items / o.items_per_dir;
|
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;
|
out_resultfile = world_out;
|
||||||
mpi_comm_world = world_com;
|
mpi_comm_world = world_com;
|
||||||
|
|
||||||
init_clock();
|
init_clock(world_com);
|
||||||
|
|
||||||
mdtest_init_args();
|
mdtest_init_args();
|
||||||
int i, j;
|
int i, j;
|
||||||
|
|
|
@ -706,34 +706,34 @@ double GetTimeStamp(void)
|
||||||
/*
|
/*
|
||||||
* Determine any spread (range) between node times.
|
* Determine any spread (range) between node times.
|
||||||
*/
|
*/
|
||||||
static double TimeDeviation(void)
|
static double TimeDeviation(MPI_Comm com)
|
||||||
{
|
{
|
||||||
double timestamp;
|
double timestamp;
|
||||||
double min = 0;
|
double min = 0;
|
||||||
double max = 0;
|
double max = 0;
|
||||||
double roottimestamp;
|
double roottimestamp;
|
||||||
|
|
||||||
MPI_CHECK(MPI_Barrier(mpi_comm_world), "barrier error");
|
MPI_CHECK(MPI_Barrier(com), "barrier error");
|
||||||
timestamp = GetTimeStamp();
|
timestamp = GetTimeStamp();
|
||||||
MPI_CHECK(MPI_Reduce(×tamp, &min, 1, MPI_DOUBLE,
|
MPI_CHECK(MPI_Reduce(×tamp, &min, 1, MPI_DOUBLE,
|
||||||
MPI_MIN, 0, mpi_comm_world),
|
MPI_MIN, 0, com),
|
||||||
"cannot reduce tasks' times");
|
"cannot reduce tasks' times");
|
||||||
MPI_CHECK(MPI_Reduce(×tamp, &max, 1, MPI_DOUBLE,
|
MPI_CHECK(MPI_Reduce(×tamp, &max, 1, MPI_DOUBLE,
|
||||||
MPI_MAX, 0, mpi_comm_world),
|
MPI_MAX, 0, com),
|
||||||
"cannot reduce tasks' times");
|
"cannot reduce tasks' times");
|
||||||
|
|
||||||
/* delta between individual nodes' time and root node's time */
|
/* delta between individual nodes' time and root node's time */
|
||||||
roottimestamp = timestamp;
|
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");
|
"cannot broadcast root's time");
|
||||||
wall_clock_delta = timestamp - roottimestamp;
|
wall_clock_delta = timestamp - roottimestamp;
|
||||||
|
|
||||||
return max - min;
|
return max - min;
|
||||||
}
|
}
|
||||||
|
|
||||||
void init_clock(){
|
void init_clock(MPI_Comm com){
|
||||||
/* check for skew between tasks' start times */
|
/* check for skew between tasks' start times */
|
||||||
wall_clock_deviation = TimeDeviation();
|
wall_clock_deviation = TimeDeviation(com);
|
||||||
}
|
}
|
||||||
|
|
||||||
char * PrintTimestamp() {
|
char * PrintTimestamp() {
|
||||||
|
@ -751,16 +751,16 @@ char * PrintTimestamp() {
|
||||||
return datestring;
|
return datestring;
|
||||||
}
|
}
|
||||||
|
|
||||||
int64_t ReadStoneWallingIterations(char * const filename){
|
int64_t ReadStoneWallingIterations(char * const filename, MPI_Comm com){
|
||||||
long long data;
|
long long data;
|
||||||
if(rank != 0){
|
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;
|
return data;
|
||||||
}else{
|
}else{
|
||||||
FILE * out = fopen(filename, "r");
|
FILE * out = fopen(filename, "r");
|
||||||
if (out == NULL){
|
if (out == NULL){
|
||||||
data = -1;
|
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;
|
return data;
|
||||||
}
|
}
|
||||||
int ret = fscanf(out, "%lld", & data);
|
int ret = fscanf(out, "%lld", & data);
|
||||||
|
@ -768,7 +768,7 @@ int64_t ReadStoneWallingIterations(char * const filename){
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
fclose(out);
|
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;
|
return data;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -52,10 +52,10 @@ void updateParsedOptions(IOR_param_t * options, options_all_t * global_options);
|
||||||
size_t NodeMemoryStringToBytes(char *size_str);
|
size_t NodeMemoryStringToBytes(char *size_str);
|
||||||
|
|
||||||
/* Returns -1, if cannot be read */
|
/* 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 StoreStoneWallingIterations(char * const filename, int64_t count);
|
||||||
|
|
||||||
void init_clock(void);
|
void init_clock(MPI_Comm com);
|
||||||
double GetTimeStamp(void);
|
double GetTimeStamp(void);
|
||||||
char * PrintTimestamp(); // TODO remove this function
|
char * PrintTimestamp(); // TODO remove this function
|
||||||
unsigned long GetProcessorAndCore(int *chip, int *core);
|
unsigned long GetProcessorAndCore(int *chip, int *core);
|
||||||
|
|
Loading…
Reference in New Issue