root/ompi/mca/io/romio321/romio/adio/ad_gpfs/ad_gpfs_hints.c

/* [<][>][^][v][top][bottom][index][help] */

DEFINITIONS

This source file includes following definitions.
  1. ADIOI_GPFS_SetInfo

   1 /* ---------------------------------------------------------------- */
   2 /* (C)Copyright IBM Corp.  2007, 2008                               */
   3 /* ---------------------------------------------------------------- */
   4 /**
   5  * \file ad_gpfs_hints.c
   6  * \brief GPFS hint processing - for now, only used for BlueGene and PE platforms
   7  */
   8 
   9 /* -*- Mode: C; c-basic-offset:4 ; -*- */
  10 /*
  11  *   Copyright (C) 1997 University of Chicago.
  12  *   See COPYRIGHT notice in top-level directory.
  13  */
  14 
  15 #include "adio.h"
  16 #include "adio_extern.h"
  17 #include "hint_fns.h"
  18 
  19 #include "ad_gpfs.h"
  20 
  21 #define   ADIOI_GPFS_CB_BUFFER_SIZE_DFLT        "16777216"
  22 #define   ADIOI_GPFS_IND_RD_BUFFER_SIZE_DFLT    "4194304"
  23 #define   ADIOI_GPFS_IND_WR_BUFFER_SIZE_DFLT    "4194304"
  24 
  25 #ifdef BGQPLATFORM
  26 #define   ADIOI_BG_NAGG_IN_PSET_HINT_NAME       "bg_nodes_pset"
  27 #endif
  28 
  29 /** \page mpiio_vars MPIIO Configuration
  30  *
  31  * GPFS MPIIO configuration and performance tuning. Used by ad_gpfs ADIO.
  32  *
  33  * Used for BlueGene and PE platforms, which each have their own aggregator selection
  34  * algorithms that ignore user provided cb_config_list.
  35  *
  36  * \section hint_sec Hints
  37  * - bg_nodes_pset - BlueGene only - specify how many aggregators to use per pset.
  38  *   This hint will override the cb_nodes hint based on BlueGene psets.
  39  *   - N - Use N nodes per pset as aggregators.
  40  *   - Default is based on partition configuration and cb_nodes.
  41  *
  42  *   The following default key/value pairs may differ from other platform defaults.
  43  *
  44  *     - key = cb_buffer_size     value = 16777216
  45  *     - key = romio_cb_read      value = enable
  46  *     - key = romio_cb_write     value = enable
  47  *     - key = ind_rd_buffer_size value = 4194304
  48  *     - key = ind_wr_buffer_size value = 4194304
  49  */
  50 
  51 #ifdef BGQPLATFORM
  52 /* Compute the aggregator-related parameters that are required in 2-phase collective IO of ADIO. */
  53 extern int
  54 ADIOI_BG_gen_agg_ranklist(ADIO_File fd, int n_proxy_per_pset);
  55 #elif PEPLATFORM
  56 extern int
  57 ADIOI_PE_gen_agg_ranklist(ADIO_File fd);
  58 #endif
  59 
  60 void ADIOI_GPFS_SetInfo(ADIO_File fd, MPI_Info users_info, int *error_code)
  61 {
  62 /* if fd->info is null, create a new info object.
  63    Initialize fd->info to default values.
  64    Initialize fd->hints to default values.
  65    Examine the info object passed by the user. If it contains values that
  66    ROMIO understands, override the default. */
  67 
  68     MPI_Info info;
  69     char *value;
  70     int flag, intval, nprocs=0, nprocs_is_valid = 0;
  71     static char myname[] = "ADIOI_GPFS_SETINFO";
  72 
  73     int did_anything = 0;
  74 
  75     if (fd->info == MPI_INFO_NULL) MPI_Info_create(&(fd->info));
  76     info = fd->info;
  77 
  78     /* Note that fd->hints is allocated at file open time; thus it is
  79      * not necessary to allocate it, or check for allocation, here.
  80      */
  81 
  82     value = (char *) ADIOI_Malloc((MPI_MAX_INFO_VAL+1)*sizeof(char));
  83     ADIOI_Assert ((value != NULL));
  84 
  85     /* initialize info and hints to default values if they haven't been
  86      * previously initialized
  87      */
  88     if (!fd->hints->initialized) {
  89 
  90         ad_gpfs_get_env_vars();
  91         did_anything = 1;
  92 
  93         /* buffer size for collective I/O */
  94         ADIOI_Info_set(info, "cb_buffer_size", ADIOI_GPFS_CB_BUFFER_SIZE_DFLT);
  95         fd->hints->cb_buffer_size = atoi(ADIOI_GPFS_CB_BUFFER_SIZE_DFLT);
  96 
  97         /* default is to let romio automatically decide when to use
  98          * collective buffering
  99          */
 100         ADIOI_Info_set(info, "romio_cb_read", "enable");
 101         fd->hints->cb_read = ADIOI_HINT_ENABLE;
 102         ADIOI_Info_set(info, "romio_cb_write", "enable");
 103         fd->hints->cb_write = ADIOI_HINT_ENABLE;
 104 
 105         if ( fd->hints->cb_config_list != NULL ) ADIOI_Free (fd->hints->cb_config_list);
 106         fd->hints->cb_config_list = NULL;
 107 
 108         /* number of processes that perform I/O in collective I/O */
 109         MPI_Comm_size(fd->comm, &nprocs);
 110         nprocs_is_valid = 1;
 111         ADIOI_Snprintf(value, MPI_MAX_INFO_VAL+1, "%d", nprocs);
 112         ADIOI_Info_set(info, "cb_nodes", value);
 113         fd->hints->cb_nodes = -1;
 114 
 115         /* hint indicating that no indep. I/O will be performed on this file */
 116         ADIOI_Info_set(info, "romio_no_indep_rw", "false");
 117         fd->hints->no_indep_rw = 0;
 118 
 119         /* gpfs is not implementing file realms (ADIOI_IOStridedColl),
 120            initialize to disabled it.      */
 121         /* hint instructing the use of persistent file realms */
 122         ADIOI_Info_set(info, "romio_cb_pfr", "disable");
 123         fd->hints->cb_pfr = ADIOI_HINT_DISABLE;
 124 
 125         /* hint guiding the assignment of persistent file realms */
 126         ADIOI_Info_set(info, "romio_cb_fr_types", "aar");
 127         fd->hints->cb_fr_type = ADIOI_FR_AAR;
 128 
 129         /* hint to align file realms with a certain byte value */
 130         ADIOI_Info_set(info, "romio_cb_fr_alignment", "1");
 131         fd->hints->cb_fr_alignment = 1;
 132 
 133         /* hint to set a threshold percentage for a datatype's size/extent at
 134          * which data sieving should be done in collective I/O */
 135         ADIOI_Info_set(info, "romio_cb_ds_threshold", "0");
 136         fd->hints->cb_ds_threshold = 0;
 137 
 138         /* hint to switch between point-to-point or all-to-all for two-phase */
 139         ADIOI_Info_set(info, "romio_cb_alltoall", "automatic");
 140         fd->hints->cb_alltoall = ADIOI_HINT_AUTO;
 141 
 142          /* deferred_open derived from no_indep_rw and cb_{read,write} */
 143         fd->hints->deferred_open = 0;
 144 
 145         /* buffer size for data sieving in independent reads */
 146         ADIOI_Info_set(info, "ind_rd_buffer_size", ADIOI_GPFS_IND_RD_BUFFER_SIZE_DFLT);
 147         fd->hints->ind_rd_buffer_size = atoi(ADIOI_GPFS_IND_RD_BUFFER_SIZE_DFLT);
 148 
 149         /* buffer size for data sieving in independent writes */
 150         ADIOI_Info_set(info, "ind_wr_buffer_size", ADIOI_GPFS_IND_WR_BUFFER_SIZE_DFLT);
 151         fd->hints->ind_wr_buffer_size = atoi(ADIOI_GPFS_IND_WR_BUFFER_SIZE_DFLT);
 152 
 153 
 154     ADIOI_Info_set(info, "romio_ds_read", "automatic");
 155     fd->hints->ds_read = ADIOI_HINT_AUTO;
 156     ADIOI_Info_set(info, "romio_ds_write", "automatic");
 157     fd->hints->ds_write = ADIOI_HINT_AUTO;
 158 
 159     /* still to do: tune this a bit for a variety of file systems. there's
 160          * no good default value so just leave it unset */
 161     fd->hints->min_fdomain_size = 0;
 162     fd->hints->striping_unit = 0;
 163 
 164     fd->hints->initialized = 1;
 165     }
 166 
 167     /* add in user's info if supplied */
 168     if (users_info != MPI_INFO_NULL) {
 169         ADIOI_Info_check_and_install_int(fd, users_info, "cb_buffer_size",
 170                 &(fd->hints->cb_buffer_size), myname, error_code);
 171         /* new hints for enabling/disabling coll. buffering on
 172          * reads/writes
 173          */
 174         ADIOI_Info_check_and_install_enabled(fd, users_info, "romio_cb_read",
 175                 &(fd->hints->cb_read), myname, error_code);
 176         if (fd->hints->cb_read == ADIOI_HINT_DISABLE) {
 177             /* romio_cb_read overrides no_indep_rw */
 178             ADIOI_Info_set(info, "romio_no_indep_rw", "false");
 179             fd->hints->no_indep_rw = ADIOI_HINT_DISABLE;
 180         }
 181         ADIOI_Info_check_and_install_enabled(fd, users_info, "romio_cb_write",
 182                 &(fd->hints->cb_write), myname, error_code);
 183         if (fd->hints->cb_write == ADIOI_HINT_DISABLE) {
 184             /* romio_cb_write overrides no_indep_rw */
 185             ADIOI_Info_set(info, "romio_no_indep_rw", "false");
 186             fd->hints->no_indep_rw = ADIOI_HINT_DISABLE;
 187         }
 188         /* Has the user indicated all I/O will be done collectively? */
 189         ADIOI_Info_check_and_install_true(fd, users_info, "romio_no_indep_rw",
 190                 &(fd->hints->no_indep_rw), myname, error_code);
 191         if (fd->hints->no_indep_rw == 1) {
 192             /* if 'no_indep_rw' set, also hint that we will do
 193              * collective buffering: if we aren't doing independent io,
 194              * then we have to do collective  */
 195             ADIOI_Info_set(info, "romio_cb_write", "enable");
 196             ADIOI_Info_set(info, "romio_cb_read", "enable");
 197             fd->hints->cb_read = 1;
 198             fd->hints->cb_write = 1;
 199         }
 200 
 201         /* new hints for enabling/disabling data sieving on
 202          * reads/writes
 203          */
 204         ADIOI_Info_check_and_install_enabled(fd, users_info, "romio_ds_read",
 205                 &(fd->hints->ds_read), myname, error_code);
 206         ADIOI_Info_check_and_install_enabled(fd, users_info, "romio_ds_write",
 207                 &(fd->hints->ds_write), myname, error_code);
 208 
 209         ADIOI_Info_check_and_install_int(fd, users_info, "ind_wr_buffer_size",
 210                 &(fd->hints->ind_wr_buffer_size), myname, error_code);
 211         ADIOI_Info_check_and_install_int(fd, users_info, "ind_rd_buffer_size",
 212                 &(fd->hints->ind_rd_buffer_size), myname, error_code);
 213 
 214         memset( value, 0, MPI_MAX_INFO_VAL+1 );
 215         ADIOI_Info_get(users_info, "romio_min_fdomain_size", MPI_MAX_INFO_VAL,
 216                         value, &flag);
 217         if ( flag && ((intval = atoi(value)) > 0) ) {
 218                 ADIOI_Info_set(info, "romio_min_fdomain_size", value);
 219                 fd->hints->min_fdomain_size = intval;
 220         }
 221   /* Now we use striping unit in common code so we should
 222      process hints for it. */
 223         ADIOI_Info_check_and_install_int(fd, users_info, "striping_unit",
 224                 &(fd->hints->striping_unit), myname, error_code);
 225 
 226 #ifdef BGQPLATFORM
 227         memset( value, 0, MPI_MAX_INFO_VAL+1 );
 228         ADIOI_Info_get(users_info, ADIOI_BG_NAGG_IN_PSET_HINT_NAME, MPI_MAX_INFO_VAL,
 229                      value, &flag);
 230         if (flag && ((intval = atoi(value)) > 0)) {
 231 
 232             did_anything = 1;
 233             ADIOI_Info_set(info, ADIOI_BG_NAGG_IN_PSET_HINT_NAME, value);
 234             fd->hints->cb_nodes = intval;
 235         }
 236 #endif
 237     }
 238 
 239     /* special CB aggregator assignment */
 240     if (did_anything) {
 241 #ifdef BGQPLATFORM
 242         ADIOI_BG_gen_agg_ranklist(fd, fd->hints->cb_nodes);
 243 #elif PEPLATFORM
 244         ADIOI_PE_gen_agg_ranklist(fd);
 245 #endif
 246     }
 247 
 248     /* deferred_open won't be set by callers, but if the user doesn't
 249      * explicitly disable collecitve buffering (two-phase) and does hint that
 250      * io w/o independent io is going on, we'll set this internal hint as a
 251      * convenience */
 252     if ( ( (fd->hints->cb_read != ADIOI_HINT_DISABLE) \
 253                             && (fd->hints->cb_write != ADIOI_HINT_DISABLE)\
 254                             && fd->hints->no_indep_rw ) ) {
 255             fd->hints->deferred_open = 1;
 256     } else {
 257             /* setting romio_no_indep_rw enable and romio_cb_{read,write}
 258              * disable at the same time doesn't make sense. honor
 259              * romio_cb_{read,write} and force the no_indep_rw hint to
 260              * 'disable' */
 261             ADIOI_Info_set(info, "romio_no_indep_rw", "false");
 262             fd->hints->no_indep_rw = 0;
 263             fd->hints->deferred_open = 0;
 264     }
 265 
 266     /* BobC commented this out, but since hint processing runs on both bg and
 267      * bglockless, we need to keep DS writes enabled on gpfs and disabled on
 268      * PVFS */
 269     if (ADIO_Feature(fd, ADIO_DATA_SIEVING_WRITES) == 0) {
 270     /* disable data sieving for fs that do not
 271        support file locking */
 272         ADIOI_Info_get(info, "ind_wr_buffer_size", MPI_MAX_INFO_VAL,
 273                      value, &flag);
 274         if (flag) {
 275             /* get rid of this value if it is set */
 276             ADIOI_Info_delete(info, "ind_wr_buffer_size");
 277         }
 278         /* note: leave ind_wr_buffer_size alone; used for other cases
 279          * as well. -- Rob Ross, 04/22/2003
 280          */
 281         ADIOI_Info_set(info, "romio_ds_write", "disable");
 282         fd->hints->ds_write = ADIOI_HINT_DISABLE;
 283     }
 284 
 285     ADIOI_Free(value);
 286 
 287     *error_code = MPI_SUCCESS;
 288 }

/* [<][>][^][v][top][bottom][index][help] */