New option -Y to invoke the sync command.

master
Julian M. Kunkel 2019-08-26 18:57:14 +01:00
parent a4068be551
commit 4df051bf28
3 changed files with 35 additions and 30 deletions

View File

@ -148,6 +148,7 @@ static size_t write_bytes;
static int stone_wall_timer_seconds;
static size_t read_bytes;
static int sync_file;
static int call_sync;
static int path_count;
static int nstride; /* neighbor stride */
static int make_node = 0;
@ -263,6 +264,16 @@ static void prep_testdir(int j, int dir_iter){
pos += sprintf(& testdir[pos], ".%d-%d", j, dir_iter);
}
static void phase_end(){
if (call_sync){
call_sync_cmd();
}
if (barriers) {
MPI_Barrier(testComm);
}
}
/*
* This function copies the unique directory name for a given option to
* the "to" parameter. Some memory must be allocated to the "to" parameter.
@ -836,9 +847,7 @@ void directory_test(const int iteration, const int ntasks, const char *path, ran
}
}
if (barriers) {
MPI_Barrier(testComm);
}
phase_end();
t[1] = GetTimeStamp();
/* stat phase */
@ -864,10 +873,7 @@ void directory_test(const int iteration, const int ntasks, const char *path, ran
}
}
}
if (barriers) {
MPI_Barrier(testComm);
}
phase_end();
t[2] = GetTimeStamp();
/* read phase */
@ -894,9 +900,7 @@ void directory_test(const int iteration, const int ntasks, const char *path, ran
}
}
if (barriers) {
MPI_Barrier(testComm);
}
phase_end();
t[3] = GetTimeStamp();
if (remove_only) {
@ -924,9 +928,7 @@ void directory_test(const int iteration, const int ntasks, const char *path, ran
}
}
if (barriers) {
MPI_Barrier(testComm);
}
phase_end();
t[4] = GetTimeStamp();
if (remove_only) {
@ -1082,9 +1084,7 @@ void file_test(const int iteration, const int ntasks, const char *path, rank_pro
}
}
if (barriers) {
MPI_Barrier(testComm);
}
phase_end();
t[1] = GetTimeStamp();
/* stat phase */
@ -1107,9 +1107,7 @@ void file_test(const int iteration, const int ntasks, const char *path, rank_pro
}
}
if (barriers) {
MPI_Barrier(testComm);
}
phase_end();
t[2] = GetTimeStamp();
/* read phase */
@ -1136,9 +1134,7 @@ void file_test(const int iteration, const int ntasks, const char *path, rank_pro
}
}
if (barriers) {
MPI_Barrier(testComm);
}
phase_end();
t[3] = GetTimeStamp();
if (remove_only) {
@ -1168,9 +1164,7 @@ void file_test(const int iteration, const int ntasks, const char *path, rank_pro
}
}
if (barriers) {
MPI_Barrier(testComm);
}
phase_end();
t[4] = GetTimeStamp();
if (remove_only) {
if (unique_dir_per_task) {
@ -1853,6 +1847,7 @@ void mdtest_init_args(){
stone_wall_timer_seconds = 0;
read_bytes = 0;
sync_file = 0;
call_sync = 0;
path_count = 0;
nstride = 0;
make_node = 0;
@ -1925,6 +1920,7 @@ mdtest_results_t * mdtest_run(int argc, char **argv, MPI_Comm world_com, FILE *
{'x', NULL, "StoneWallingStatusFile; contains the number of iterations of the creation phase, can be used to split phases across runs", OPTION_OPTIONAL_ARGUMENT, 's', & stoneWallingStatusFile},
{'X', "verify-read", "Verify the data read", OPTION_FLAG, 'd', & verify_read},
{'y', NULL, "sync file after writing", OPTION_FLAG, 'd', & sync_file},
{'Y', NULL, "call the sync command after each phase (included in the timing; note it causes all IO to be flushed from your node)", OPTION_FLAG, 'd', & call_sync},
{'z', NULL, "depth of hierarchical directory structure", OPTION_OPTIONAL_ARGUMENT, 'd', & depth},
{'Z', NULL, "print time instead of rate", OPTION_FLAG, 'd', & print_time},
LAST_OPTION
@ -2008,6 +2004,7 @@ mdtest_results_t * mdtest_run(int argc, char **argv, MPI_Comm world_com, FILE *
VERBOSE(1,-1, "unique_dir_per_task : %s", ( unique_dir_per_task ? "True" : "False" ));
VERBOSE(1,-1, "write_bytes : "LLU"", write_bytes );
VERBOSE(1,-1, "sync_file : %s", ( sync_file ? "True" : "False" ));
VERBOSE(1,-1, "call_sync : %s", ( call_sync ? "True" : "False" ));
VERBOSE(1,-1, "depth : %d", depth );
VERBOSE(1,-1, "make_node : %d", make_node );

View File

@ -77,15 +77,15 @@ void* safeMalloc(uint64_t size){
}
void FailMessage(int rank, const char *location, char *format, ...) {
char msg[4096];
char msg[4096];
va_list args;
va_start(args, format);
vsnprintf(msg, 4096, format, args);
va_end(args);
fprintf(out_logfile, "%s: Process %d: FAILED in %s, %s: %s\n",
PrintTimestamp(), rank, location, msg, strerror(errno));
fflush(out_logfile);
MPI_Abort(testComm, 1);
fprintf(out_logfile, "%s: Process %d: FAILED in %s, %s: %s\n",
PrintTimestamp(), rank, location, msg, strerror(errno));
fflush(out_logfile);
MPI_Abort(testComm, 1);
}
size_t NodeMemoryStringToBytes(char *size_str)
@ -809,3 +809,10 @@ char *HumanReadable(IOR_offset_t value, int base)
}
return valueStr;
}
void call_sync_cmd(){
int ret = system("sync");
if (ret != 0){
FAIL("Error executing the sync command, ensure it exists.");
}
}

View File

@ -60,6 +60,7 @@ int QueryNodeMapping(MPI_Comm comm, int print_nodemap);
void DelaySecs(int delay);
void updateParsedOptions(IOR_param_t * options, options_all_t * global_options);
size_t NodeMemoryStringToBytes(char *size_str);
void call_sync_cmd();
/* Returns -1, if cannot be read */
int64_t ReadStoneWallingIterations(char * const filename);