MD-Worbench: add -G option to set parameter.

master
Julian M. Kunkel 2021-01-22 14:38:36 +00:00
parent 7061b60ed8
commit 0a066d8285
1 changed files with 20 additions and 13 deletions

View File

@ -116,6 +116,7 @@ struct benchmark_options{
int rank; int rank;
int size; int size;
int verify_read; int verify_read;
int random_buffer_offset;
float relative_waiting_factor; float relative_waiting_factor;
int adaptive_waiting_mode; 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(){ void init_options(){
memset(& o, 0, sizeof(o)); o = (struct benchmark_options){
o.interface = "POSIX"; .interface = "POSIX",
o.prefix = "./out"; .prefix = "./out",
o.num = 1000; .num = 1000,
o.precreate = 3000; .random_buffer_offset = -1,
o.dset_count = 10; .precreate = 3000,
o.offset = 1; .dset_count = 10,
o.iterations = 3; .offset = 1,
o.file_size = 3901; .iterations = 3,
o.run_info_file = "md-workbench.status"; .file_size = 3901,
.run_info_file = "md-workbench.status"};
} }
static void mdw_wait(double runtime){ 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); 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 double op_timer; // timer for individual operations
size_t pos = -1; // position inside the individual measurement array size_t pos = -1; // position inside the individual measurement array
double op_time; double op_time;
@ -566,7 +568,7 @@ void run_precreate(phase_stat_t * s, int current_index){
if (NULL == aiori_fh){ if (NULL == aiori_fh){
FAIL("Unable to open file %s", obj_name); 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)) { 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++; s->obj_create.suc++;
}else{ }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.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(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++; s->obj_read.suc++;
}else{ }else{
s->obj_read.err++; 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}, {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}, {'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}, {'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}, {'o', NULL, "Output directory", OPTION_OPTIONAL_ARGUMENT, 's', & o.prefix},
{'q', "quiet", "Avoid irrelevant printing.", OPTION_FLAG, 'd', & o.quiet_output}, {'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}, //{'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"); ERR("Invalid options, if running only the benchmark phase using -2 with stonewall option then use stonewall wear-out");
exit(1); 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){ if(o.backend->xfer_hints){
o.backend->xfer_hints(& o.hints); o.backend->xfer_hints(& o.hints);