diff --git a/src/md-workbench.c b/src/md-workbench.c index e7213b9..672a73a 100644 --- a/src/md-workbench.c +++ b/src/md-workbench.c @@ -116,6 +116,7 @@ struct benchmark_options{ int rank; int size; int verify_read; + int random_buffer_offset; float relative_waiting_factor; int adaptive_waiting_mode; @@ -134,16 +135,17 @@ static void def_obj_name(char * out_name, int n, int d, int i){ } void init_options(){ - memset(& o, 0, sizeof(o)); - o.interface = "POSIX"; - o.prefix = "./out"; - o.num = 1000; - o.precreate = 3000; - o.dset_count = 10; - o.offset = 1; - o.iterations = 3; - o.file_size = 3901; - o.run_info_file = "md-workbench.status"; + o = (struct benchmark_options){ + .interface = "POSIX", + .prefix = "./out", + .num = 1000, + .random_buffer_offset = -1, + .precreate = 3000, + .dset_count = 10, + .offset = 1, + .iterations = 3, + .file_size = 3901, + .run_info_file = "md-workbench.status"}; } static void mdw_wait(double runtime){ @@ -550,7 +552,7 @@ void run_precreate(phase_stat_t * s, int current_index){ } char * buf = malloc(o.file_size); - generate_memory_pattern(buf, o.file_size, 0, o.rank); + generate_memory_pattern(buf, o.file_size, o.random_buffer_offset, o.rank); double op_timer; // timer for individual operations size_t pos = -1; // position inside the individual measurement array double op_time; @@ -566,7 +568,7 @@ void run_precreate(phase_stat_t * s, int current_index){ if (NULL == aiori_fh){ FAIL("Unable to open file %s", obj_name); } - update_write_memory_pattern(f * o.dset_count + d, buf, o.file_size, 0, o.rank); + update_write_memory_pattern(f * o.dset_count + d, buf, o.file_size, o.random_buffer_offset, o.rank); if ( o.file_size == (int) o.backend->xfer(WRITE, aiori_fh, (IOR_size_t *) buf, o.file_size, 0, o.backend_options)) { s->obj_create.suc++; }else{ @@ -647,7 +649,7 @@ void run_benchmark(phase_stat_t * s, int * current_index_p){ } if ( o.file_size == (int) o.backend->xfer(READ, aiori_fh, (IOR_size_t *) buf, o.file_size, 0, o.backend_options) ) { if(o.verify_read){ - if(verify_memory_pattern(f * o.dset_count + d, buf, o.file_size, 0, readRank) == 0){ + if(verify_memory_pattern(f * o.dset_count + d, buf, o.file_size, o.random_buffer_offset, readRank) == 0){ s->obj_read.suc++; }else{ s->obj_read.err++; @@ -801,6 +803,7 @@ static option_help options [] = { {0, "latency-all", "Keep the latency files from all ranks.", OPTION_FLAG, 'd', & o.latency_keep_all}, {'P', "precreate-per-set", "Number of object to precreate per data set.", OPTION_OPTIONAL_ARGUMENT, 'd', & o.precreate}, {'D', "data-sets", "Number of data sets covered per process and iteration.", OPTION_OPTIONAL_ARGUMENT, 'd', & o.dset_count}, + {'G', NULL, "Offset for the data in the read/write buffer, if not set, a random value is used", OPTION_OPTIONAL_ARGUMENT, 'd', & o.random_buffer_offset}, {'o', NULL, "Output directory", OPTION_OPTIONAL_ARGUMENT, 's', & o.prefix}, {'q', "quiet", "Avoid irrelevant printing.", OPTION_FLAG, 'd', & o.quiet_output}, //{'m', "lim-free-mem", "Allocate memory until this limit (in MiB) is reached.", OPTION_OPTIONAL_ARGUMENT, 'd', & o.limit_memory}, @@ -906,6 +909,10 @@ mdworkbench_results_t* md_workbench_run(int argc, char ** argv, MPI_Comm world_c ERR("Invalid options, if running only the benchmark phase using -2 with stonewall option then use stonewall wear-out"); exit(1); } + if( o.random_buffer_offset == -1 ){ + o.random_buffer_offset = time(NULL); + MPI_Bcast(& o.random_buffer_offset, 1, MPI_INT, 0, o.com); + } if(o.backend->xfer_hints){ o.backend->xfer_hints(& o.hints);