diff --git a/ompi/mca/common/ompio/common_ompio.h b/ompi/mca/common/ompio/common_ompio.h index 82abd089fb..2b16862616 100644 --- a/ompi/mca/common/ompio/common_ompio.h +++ b/ompi/mca/common/ompio/common_ompio.h @@ -45,6 +45,12 @@ #define OMPIO_MAX(a, b) (((a) < (b)) ? (b) : (a)) #define OMPIO_MCA_GET(fh, name) ((fh)->f_get_mca_parameter_value(#name, strlen(#name)+1)) +#define OMPIO_MCA_PRINT_INFO(_fh,_infostr,_infoval, _msg ) { \ + int _verbose = _fh->f_get_mca_parameter_value("verbose_info_parsing", strlen("verbose_info_parsing")); \ + if ( 1==_verbose && 0==_fh->f_rank ) printf("File: %s info: %s value %s %s\n", _fh->f_filename, _infostr, _infoval, _msg); \ + if ( 2==_verbose ) printf("File: %s info: %s value %s %s\n", _fh->f_filename, _infostr, _infoval, _msg); \ + } + /* * Flags diff --git a/ompi/mca/common/ompio/common_ompio_file_open.c b/ompi/mca/common/ompio/common_ompio_file_open.c index f86a7ed7db..c1c61636b3 100644 --- a/ompi/mca/common/ompio/common_ompio_file_open.c +++ b/ompi/mca/common/ompio/common_ompio_file_open.c @@ -97,8 +97,8 @@ int mca_common_ompio_file_open (ompi_communicator_t *comm, ompio_fh->f_generate_current_file_view=generate_current_file_view_fn; ompio_fh->f_get_mca_parameter_value=get_mca_parameter_value_fn; - mca_common_ompio_set_file_defaults (ompio_fh); ompio_fh->f_filename = filename; + mca_common_ompio_set_file_defaults (ompio_fh); ompio_fh->f_split_coll_req = NULL; ompio_fh->f_split_coll_in_use = false; @@ -400,70 +400,79 @@ int mca_common_ompio_set_file_defaults (ompio_file_t *fh) { if (NULL != fh) { - ompi_datatype_t *types[2]; - int blocklen[2] = {1, 1}; - ptrdiff_t d[2], base; - int i; + char char_stripe[MPI_MAX_INFO_VAL]; + ompi_datatype_t *types[2]; + int blocklen[2] = {1, 1}; + ptrdiff_t d[2], base; + int i, flag; + + fh->f_io_array = NULL; + fh->f_perm = OMPIO_PERM_NULL; + fh->f_flags = 0; + + fh->f_bytes_per_agg = OMPIO_MCA_GET(fh, bytes_per_agg); + opal_info_get (fh->f_info, "cb_buffer_size", MPI_MAX_INFO_VAL, char_stripe, &flag); + if ( flag ) { + /* Info object trumps mca parameter value */ + sscanf ( char_stripe, "%d", &fh->f_bytes_per_agg ); + OMPIO_MCA_PRINT_INFO(fh, "cb_buffer_size", char_stripe, ""); + } - fh->f_io_array = NULL; - fh->f_perm = OMPIO_PERM_NULL; - fh->f_flags = 0; - fh->f_bytes_per_agg = OMPIO_MCA_GET(fh, bytes_per_agg); - fh->f_atomicity = 0; - fh->f_fs_block_size = 4096; - - fh->f_offset = 0; - fh->f_disp = 0; - fh->f_position_in_file_view = 0; - fh->f_index_in_file_view = 0; - fh->f_total_bytes = 0; - - fh->f_init_procs_per_group = -1; - fh->f_init_procs_in_group = NULL; - - fh->f_procs_per_group = -1; - fh->f_procs_in_group = NULL; - - fh->f_init_num_aggrs = -1; - fh->f_init_aggr_list = NULL; - - fh->f_num_aggrs = -1; - fh->f_aggr_list = NULL; - - /* Default file View */ - fh->f_iov_type = MPI_DATATYPE_NULL; - fh->f_stripe_size = 0; - /*Decoded iovec of the file-view*/ - fh->f_decoded_iov = NULL; - fh->f_etype = MPI_DATATYPE_NULL; - fh->f_filetype = MPI_DATATYPE_NULL; - fh->f_orig_filetype = MPI_DATATYPE_NULL; - fh->f_datarep = NULL; - - /*Create a derived datatype for the created iovec */ - types[0] = &ompi_mpi_long.dt; - types[1] = &ompi_mpi_long.dt; - - d[0] = (ptrdiff_t) fh->f_decoded_iov; - d[1] = (ptrdiff_t) &fh->f_decoded_iov[0].iov_len; - - base = d[0]; - for (i=0 ; i<2 ; i++) { - d[i] -= base; - } - - ompi_datatype_create_struct (2, - blocklen, - d, - types, - &fh->f_iov_type); - ompi_datatype_commit (&fh->f_iov_type); - - return OMPI_SUCCESS; - } - else { - return OMPI_ERROR; - } + fh->f_atomicity = 0; + fh->f_fs_block_size = 4096; + + fh->f_offset = 0; + fh->f_disp = 0; + fh->f_position_in_file_view = 0; + fh->f_index_in_file_view = 0; + fh->f_total_bytes = 0; + + fh->f_init_procs_per_group = -1; + fh->f_init_procs_in_group = NULL; + + fh->f_procs_per_group = -1; + fh->f_procs_in_group = NULL; + + fh->f_init_num_aggrs = -1; + fh->f_init_aggr_list = NULL; + + fh->f_num_aggrs = -1; + fh->f_aggr_list = NULL; + + /* Default file View */ + fh->f_iov_type = MPI_DATATYPE_NULL; + fh->f_stripe_size = 0; + /*Decoded iovec of the file-view*/ + fh->f_decoded_iov = NULL; + fh->f_etype = MPI_DATATYPE_NULL; + fh->f_filetype = MPI_DATATYPE_NULL; + fh->f_orig_filetype = MPI_DATATYPE_NULL; + fh->f_datarep = NULL; + + /*Create a derived datatype for the created iovec */ + types[0] = &ompi_mpi_long.dt; + types[1] = &ompi_mpi_long.dt; + + d[0] = (ptrdiff_t) fh->f_decoded_iov; + d[1] = (ptrdiff_t) &fh->f_decoded_iov[0].iov_len; + + base = d[0]; + for (i=0 ; i<2 ; i++) { + d[i] -= base; + } + + ompi_datatype_create_struct (2, + blocklen, + d, + types, + &fh->f_iov_type); + ompi_datatype_commit (&fh->f_iov_type); + + return OMPI_SUCCESS; + } + else { + return OMPI_ERROR; + } } diff --git a/ompi/mca/common/ompio/common_ompio_file_view.c b/ompi/mca/common/ompio/common_ompio_file_view.c index db2475d3fa..71ba14ba02 100644 --- a/ompi/mca/common/ompio/common_ompio_file_view.c +++ b/ompi/mca/common/ompio/common_ompio_file_view.c @@ -174,17 +174,19 @@ int mca_common_ompio_set_view (ompio_file_t *fh, } } - char char_stripe[MPI_MAX_INFO_KEY]; + char char_stripe[MPI_MAX_INFO_VAL]; /* Check the info object set during File_open */ opal_info_get (fh->f_info, "cb_nodes", MPI_MAX_INFO_VAL, char_stripe, &flag); if ( flag ) { sscanf ( char_stripe, "%d", &num_cb_nodes ); + OMPIO_MCA_PRINT_INFO(fh, "cb_nodes", char_stripe, ""); } else { /* Check the info object set during file_set_view */ opal_info_get (info, "cb_nodes", MPI_MAX_INFO_VAL, char_stripe, &flag); if ( flag ) { sscanf ( char_stripe, "%d", &num_cb_nodes ); + OMPIO_MCA_PRINT_INFO(fh, "cb_nodes", char_stripe, ""); } } @@ -274,13 +276,39 @@ int mca_common_ompio_set_view (ompio_file_t *fh, ompi_datatype_destroy ( &newfiletype ); } + bool info_is_set=false; + opal_info_get (fh->f_info, "collective_buffering", MPI_MAX_INFO_VAL, char_stripe, &flag); + if ( flag ) { + if ( strncmp ( char_stripe, "false", sizeof("true") )){ + info_is_set = true; + OMPIO_MCA_PRINT_INFO(fh, "collective_buffering", char_stripe, "enforcing using individual fcoll component"); + } else { + OMPIO_MCA_PRINT_INFO(fh, "collective_buffering", char_stripe, ""); + } + } else { + opal_info_get (info, "collective_buffering", MPI_MAX_INFO_VAL, char_stripe, &flag); + if ( flag ) { + if ( strncmp ( char_stripe, "false", sizeof("true") )){ + info_is_set = true; + OMPIO_MCA_PRINT_INFO(fh, "collective_buffering", char_stripe, "enforcing using individual fcoll component"); + } else { + OMPIO_MCA_PRINT_INFO(fh, "collective_buffering", char_stripe, ""); + } + } + } - ret = mca_fcoll_base_file_select (fh, NULL); + mca_fcoll_base_component_t *preferred =NULL; + if ( info_is_set ) { + /* user requested using an info object to disable collective buffering. */ + preferred = mca_fcoll_base_component_lookup ("individual"); + } + ret = mca_fcoll_base_file_select (fh, (mca_base_component_t *)preferred); if ( OMPI_SUCCESS != ret ) { opal_output(1, "mca_common_ompio_set_view: mca_fcoll_base_file_select() failed\n"); goto exit; } + if ( NULL != fh->f_sharedfp ) { ret = fh->f_sharedfp->sharedfp_seek( fh, 0, MPI_SEEK_SET); } diff --git a/ompi/mca/fcoll/base/base.h b/ompi/mca/fcoll/base/base.h index 7cebd093a2..353c062a59 100644 --- a/ompi/mca/fcoll/base/base.h +++ b/ompi/mca/fcoll/base/base.h @@ -53,6 +53,8 @@ OMPI_DECLSPEC int mca_fcoll_base_init_file (struct ompio_file_t *file); OMPI_DECLSPEC int mca_fcoll_base_get_param (struct ompio_file_t *file, int keyval); OMPI_DECLSPEC int ompi_fcoll_base_sort_iovec (struct iovec *iov, int num_entries, int *sorted); +OMPI_DECLSPEC mca_fcoll_base_component_t* mca_fcoll_base_component_lookup(const char* name); + /* * Globals */ diff --git a/ompi/mca/fcoll/base/fcoll_base_frame.c b/ompi/mca/fcoll/base/fcoll_base_frame.c index d4520cfd89..c3162bcbc2 100644 --- a/ompi/mca/fcoll/base/fcoll_base_frame.c +++ b/ompi/mca/fcoll/base/fcoll_base_frame.c @@ -44,3 +44,27 @@ MCA_BASE_FRAMEWORK_DECLARE(ompi, fcoll, NULL, NULL, NULL, NULL, mca_fcoll_base_static_components, 0); + +/** + * Traverses through the list of available components, calling their init + * functions until it finds the component that has the specified name. It + * then returns the found component. + * + * @param name the name of the component that is being searched for. + * @retval mca_fcoll_base_component_t* pointer to the requested component + * @retval NULL if the requested component is not found + */ +mca_fcoll_base_component_t* mca_fcoll_base_component_lookup(const char* name) +{ + /* Traverse the list of available components; call their init functions. */ + mca_base_component_list_item_t *cli; + OPAL_LIST_FOREACH(cli, &ompi_fcoll_base_framework.framework_components, mca_base_component_list_item_t) { + mca_fcoll_base_component_t* component = (mca_fcoll_base_component_t *) cli->cli_component; + if(strcmp(component->fcollm_version.mca_component_name, + name) == 0) { + return component; + } + } + return NULL; +} + diff --git a/ompi/mca/io/ompio/io_ompio.c b/ompi/mca/io/ompio/io_ompio.c index 3a58872d69..8a806861db 100644 --- a/ompi/mca/io/ompio/io_ompio.c +++ b/ompi/mca/io/ompio/io_ompio.c @@ -521,7 +521,10 @@ int ompi_io_ompio_sort_offlen (mca_io_ompio_offlen_array_t *io_array, int mca_io_ompio_get_mca_parameter_value ( char *mca_parameter_name, int name_length ) { - if ( !strncmp ( mca_parameter_name, "num_aggregators", name_length )) { + if ( !strncmp ( mca_parameter_name, "verbose_info_parsing", name_length )) { + return mca_io_ompio_verbose_info_parsing; + } + else if ( !strncmp ( mca_parameter_name, "num_aggregators", name_length )) { return mca_io_ompio_num_aggregators; } else if ( !strncmp ( mca_parameter_name, "bytes_per_agg", name_length )) { diff --git a/ompi/mca/io/ompio/io_ompio.h b/ompi/mca/io/ompio/io_ompio.h index e78cfb7ec4..218c8a4ada 100644 --- a/ompi/mca/io/ompio/io_ompio.h +++ b/ompi/mca/io/ompio/io_ompio.h @@ -52,6 +52,7 @@ extern int mca_io_ompio_grouping_option; extern int mca_io_ompio_max_aggregators_ratio; extern int mca_io_ompio_aggregators_cutoff_threshold; extern int mca_io_ompio_overwrite_amode; +extern int mca_io_ompio_verbose_info_parsing; OMPI_DECLSPEC extern int mca_io_ompio_coll_timing_info; diff --git a/ompi/mca/io/ompio/io_ompio_component.c b/ompi/mca/io/ompio/io_ompio_component.c index 318f7f0f6d..d2e600f39c 100644 --- a/ompi/mca/io/ompio/io_ompio_component.c +++ b/ompi/mca/io/ompio/io_ompio_component.c @@ -42,6 +42,7 @@ int mca_io_ompio_coll_timing_info = 0; int mca_io_ompio_max_aggregators_ratio=8; int mca_io_ompio_aggregators_cutoff_threshold=3; int mca_io_ompio_overwrite_amode = 1; +int mca_io_ompio_verbose_info_parsing = 0; int mca_io_ompio_grouping_option=5; @@ -240,6 +241,18 @@ static int register_component(void) MCA_BASE_VAR_SCOPE_READONLY, &mca_io_ompio_overwrite_amode); + mca_io_ompio_verbose_info_parsing = 0; + (void) mca_base_component_var_register(&mca_io_ompio_component.io_version, + "verbose_info_parsing", + "Provide visual output when parsing info objects " + "0: no verbose output (default) " + "1: verbose output by rank 0 " + "2: verbose output by all ranks ", + MCA_BASE_VAR_TYPE_INT, NULL, 0, 0, + OPAL_INFO_LVL_9, + MCA_BASE_VAR_SCOPE_READONLY, + &mca_io_ompio_verbose_info_parsing); + return OMPI_SUCCESS; }