00001
00002
00003
00009
00010
00011
00012
00013
00014
00015 #include "adio.h"
00016 #include "adio_extern.h"
00017
00018 #include "ad_bgl.h"
00019 #include "ad_bgl_pset.h"
00020 #include "ad_bgl_aggrs.h"
00021
00022 #define ADIOI_BGL_CB_BUFFER_SIZE_DFLT "16777216"
00023 #define ADIOI_BGL_IND_RD_BUFFER_SIZE_DFLT "4194304"
00024 #define ADIOI_BGL_IND_WR_BUFFER_SIZE_DFLT "4194304"
00025 #define ADIOI_BGL_NAGG_IN_PSET_HINT_NAME "bgl_nodes_pset"
00026
00045
00046 extern int
00047 ADIOI_BGL_gen_agg_ranklist(ADIO_File fd, int n_proxy_per_pset);
00048
00049 void ADIOI_BGL_SetInfo(ADIO_File fd, MPI_Info users_info, int *error_code)
00050 {
00051
00052
00053
00054
00055
00056
00057 MPI_Info info;
00058 char *value;
00059 int flag, intval, tmp_val, nprocs=0, nprocs_is_valid = 0;
00060 static char myname[] = "ADIOI_BGL_SETINFO";
00061
00062 int did_anything = 0;
00063
00064 if (fd->info == MPI_INFO_NULL) MPI_Info_create(&(fd->info));
00065 info = fd->info;
00066
00067
00068
00069
00070
00071 value = (char *) ADIOI_Malloc((MPI_MAX_INFO_VAL+1)*sizeof(char));
00072 AD_BGL_assert ((value != NULL));
00073
00074
00075
00076
00077 if (!fd->hints->initialized) {
00078
00079 did_anything = 1;
00080
00081
00082 ADIOI_Info_set(info, "cb_buffer_size", ADIOI_BGL_CB_BUFFER_SIZE_DFLT);
00083 fd->hints->cb_buffer_size = atoi(ADIOI_BGL_CB_BUFFER_SIZE_DFLT);
00084
00085
00086
00087
00088 ADIOI_Info_set(info, "romio_cb_read", "enable");
00089 fd->hints->cb_read = ADIOI_HINT_ENABLE;
00090 ADIOI_Info_set(info, "romio_cb_write", "enable");
00091 fd->hints->cb_write = ADIOI_HINT_ENABLE;
00092
00093 if ( fd->hints->cb_config_list != NULL ) ADIOI_Free (fd->hints->cb_config_list);
00094 fd->hints->cb_config_list = NULL;
00095
00096
00097 MPI_Comm_size(fd->comm, &nprocs);
00098 nprocs_is_valid = 1;
00099 ADIOI_Snprintf(value, MPI_MAX_INFO_VAL+1, "%d", nprocs);
00100 ADIOI_Info_set(info, "cb_nodes", value);
00101 fd->hints->cb_nodes = -1;
00102
00103
00104 ADIOI_Info_set(info, "romio_no_indep_rw", "false");
00105 fd->hints->no_indep_rw = 0;
00106
00107
00108
00109
00110 ADIOI_Info_set(info, "romio_cb_pfr", "disable");
00111 fd->hints->cb_pfr = ADIOI_HINT_DISABLE;
00112
00113
00114 ADIOI_Info_set(info, "romio_cb_fr_types", "aar");
00115 fd->hints->cb_fr_type = ADIOI_FR_AAR;
00116
00117
00118 ADIOI_Info_set(info, "romio_cb_fr_alignment", "1");
00119 fd->hints->cb_fr_alignment = 1;
00120
00121
00122
00123 ADIOI_Info_set(info, "romio_cb_ds_threshold", "0");
00124 fd->hints->cb_ds_threshold = 0;
00125
00126
00127 ADIOI_Info_set(info, "romio_cb_alltoall", "automatic");
00128 fd->hints->cb_alltoall = ADIOI_HINT_AUTO;
00129
00130
00131 fd->hints->deferred_open = 0;
00132
00133
00134 ADIOI_Info_set(info, "ind_rd_buffer_size", ADIOI_BGL_IND_RD_BUFFER_SIZE_DFLT);
00135 fd->hints->ind_rd_buffer_size = atoi(ADIOI_BGL_IND_RD_BUFFER_SIZE_DFLT);
00136
00137
00138 ADIOI_Info_set(info, "ind_wr_buffer_size", ADIOI_BGL_IND_WR_BUFFER_SIZE_DFLT);
00139 fd->hints->ind_wr_buffer_size = atoi(ADIOI_BGL_IND_WR_BUFFER_SIZE_DFLT);
00140
00141 if(fd->file_system == ADIO_UFS)
00142 {
00143
00144 ADIOI_Info_set(info, "romio_ds_read", "disable");
00145 fd->hints->ds_read = ADIOI_HINT_DISABLE;
00146 ADIOI_Info_set(info, "romio_ds_write", "disable");
00147 fd->hints->ds_write = ADIOI_HINT_DISABLE;
00148 }
00149 else
00150 {
00151
00152
00153
00154 ADIOI_Info_set(info, "romio_ds_read", "automatic");
00155 fd->hints->ds_read = ADIOI_HINT_AUTO;
00156 ADIOI_Info_set(info, "romio_ds_write", "automatic");
00157 fd->hints->ds_write = ADIOI_HINT_AUTO;
00158 }
00159
00160
00161
00162 fd->hints->min_fdomain_size = 0;
00163 fd->hints->striping_unit = 0;
00164
00165 fd->hints->initialized = 1;
00166 }
00167
00168
00169 if (users_info != MPI_INFO_NULL) {
00170 ADIOI_Info_get(users_info, "cb_buffer_size", MPI_MAX_INFO_VAL,
00171 value, &flag);
00172 if (flag && ((intval=atoi(value)) > 0)) {
00173 tmp_val = intval;
00174
00175 MPI_Bcast(&tmp_val, 1, MPI_INT, 0, fd->comm);
00176
00177 if (tmp_val != intval) {
00178 MPIO_ERR_CREATE_CODE_INFO_NOT_SAME(myname,
00179 "cb_buffer_size",
00180 error_code);
00181 return;
00182 }
00183
00184
00185 ADIOI_Info_set(info, "cb_buffer_size", value);
00186 fd->hints->cb_buffer_size = intval;
00187
00188 }
00189 #if 0
00190
00191
00192
00193 ADIOI_Info_get(users_info, "romio_cb_fr_alignment", MPI_MAX_INFO_VAL,
00194 value, &flag);
00195 if (flag && ((intval=atoi(value)) > 0)) {
00196 tmp_val = intval;
00197
00198 MPI_Bcast(&tmp_val, 1, MPI_INT, 0, fd->comm);
00199
00200 if (tmp_val != intval) {
00201 MPIO_ERR_CREATE_CODE_INFO_NOT_SAME(myname,
00202 "romio_cb_fr_alignment",
00203 error_code);
00204 return;
00205 }
00206
00207
00208 ADIOI_Info_set(info, "romio_cb_fr_alignment", value);
00209 fd->hints->cb_fr_alignment = intval;
00210
00211 }
00212
00213
00214
00215
00216 ADIOI_Info_get(users_info, "romio_cb_ds_threshold", MPI_MAX_INFO_VAL,
00217 value, &flag);
00218 if (flag && ((intval=atoi(value)) > 0)) {
00219 tmp_val = intval;
00220
00221 MPI_Bcast(&tmp_val, 1, MPI_INT, 0, fd->comm);
00222
00223 if (tmp_val != intval) {
00224 MPIO_ERR_CREATE_CODE_INFO_NOT_SAME(myname,
00225 "romio_cb_ds_threshold",
00226 error_code);
00227 return;
00228 }
00229
00230
00231 ADIOI_Info_set(info, "romio_cb_ds_threshold", value);
00232 fd->hints->cb_ds_threshold = intval;
00233
00234 }
00235 ADIOI_Info_get(users_info, "romio_cb_alltoall", MPI_MAX_INFO_VAL, value,
00236 &flag);
00237 if (flag) {
00238 if (!strcmp(value, "enable") || !strcmp(value, "ENABLE")) {
00239 ADIOI_Info_set(info, "romio_cb_alltoall", value);
00240 fd->hints->cb_read = ADIOI_HINT_ENABLE;
00241 }
00242 else if (!strcmp(value, "disable") || !strcmp(value, "DISABLE")) {
00243 ADIOI_Info_set(info, "romio_cb_alltoall", value);
00244 fd->hints->cb_read = ADIOI_HINT_DISABLE;
00245 }
00246 else if (!strcmp(value, "automatic") || !strcmp(value, "AUTOMATIC"))
00247 {
00248 ADIOI_Info_set(info, "romio_cb_alltoall", value);
00249 fd->hints->cb_read = ADIOI_HINT_AUTO;
00250 }
00251
00252 tmp_val = fd->hints->cb_alltoall;
00253
00254 MPI_Bcast(&tmp_val, 1, MPI_INT, 0, fd->comm);
00255
00256 if (tmp_val != fd->hints->cb_alltoall) {
00257 MPIO_ERR_CREATE_CODE_INFO_NOT_SAME(myname,
00258 "romio_cb_alltoall",
00259 error_code);
00260 return;
00261 }
00262
00263 }
00264 #endif
00265
00266
00267
00268 ADIOI_Info_get(users_info, "romio_cb_read", MPI_MAX_INFO_VAL, value,
00269 &flag);
00270 if (flag) {
00271 if (!strcmp(value, "enable") || !strcmp(value, "ENABLE")) {
00272 ADIOI_Info_set(info, "romio_cb_read", value);
00273 fd->hints->cb_read = ADIOI_HINT_ENABLE;
00274 }
00275 else if (!strcmp(value, "disable") || !strcmp(value, "DISABLE")) {
00276
00277 ADIOI_Info_set(info, "romio_cb_read", value);
00278 ADIOI_Info_set(info, "romio_no_indep_rw", "false");
00279 fd->hints->cb_read = ADIOI_HINT_DISABLE;
00280 fd->hints->no_indep_rw = ADIOI_HINT_DISABLE;
00281 }
00282 else if (!strcmp(value, "automatic") || !strcmp(value, "AUTOMATIC"))
00283 {
00284 ADIOI_Info_set(info, "romio_cb_read", value);
00285 fd->hints->cb_read = ADIOI_HINT_AUTO;
00286 }
00287
00288 tmp_val = fd->hints->cb_read;
00289
00290 MPI_Bcast(&tmp_val, 1, MPI_INT, 0, fd->comm);
00291
00292 if (tmp_val != fd->hints->cb_read) {
00293 MPIO_ERR_CREATE_CODE_INFO_NOT_SAME(myname,
00294 "romio_cb_read",
00295 error_code);
00296 return;
00297 }
00298
00299 }
00300 ADIOI_Info_get(users_info, "romio_cb_write", MPI_MAX_INFO_VAL, value,
00301 &flag);
00302 if (flag) {
00303 if (!strcmp(value, "enable") || !strcmp(value, "ENABLE")) {
00304 ADIOI_Info_set(info, "romio_cb_write", value);
00305 fd->hints->cb_write = ADIOI_HINT_ENABLE;
00306 }
00307 else if (!strcmp(value, "disable") || !strcmp(value, "DISABLE"))
00308 {
00309
00310 ADIOI_Info_set(info, "romio_cb_write", value);
00311 ADIOI_Info_set(info, "romio_no_indep_rw", "false");
00312 fd->hints->cb_write = ADIOI_HINT_DISABLE;
00313 fd->hints->no_indep_rw = ADIOI_HINT_DISABLE;
00314 }
00315 else if (!strcmp(value, "automatic") ||
00316 !strcmp(value, "AUTOMATIC"))
00317 {
00318 ADIOI_Info_set(info, "romio_cb_write", value);
00319 fd->hints->cb_write = ADIOI_HINT_AUTO;
00320 }
00321
00322 tmp_val = fd->hints->cb_write;
00323
00324 MPI_Bcast(&tmp_val, 1, MPI_INT, 0, fd->comm);
00325
00326 if (tmp_val != fd->hints->cb_write) {
00327 MPIO_ERR_CREATE_CODE_INFO_NOT_SAME(myname,
00328 "romio_cb_write",
00329 error_code);
00330 return;
00331 }
00332
00333 }
00334
00335 #if 0
00336
00337
00338
00339 ADIOI_Info_get(users_info, "romio_cb_pfr", MPI_MAX_INFO_VAL, value,
00340 &flag);
00341 if (flag) {
00342 if (!strcmp(value, "enable") || !strcmp(value, "ENABLE")) {
00343 ADIOI_Info_set(info, "romio_cb_pfr", value);
00344 fd->hints->cb_pfr = ADIOI_HINT_ENABLE;
00345 }
00346 else if (!strcmp(value, "disable") || !strcmp(value, "DISABLE")) {
00347 ADIOI_Info_set(info, "romio_cb_pfr", value);
00348 fd->hints->cb_pfr = ADIOI_HINT_DISABLE;
00349 }
00350 else if (!strcmp(value, "automatic") || !strcmp(value, "AUTOMATIC"))
00351 {
00352 ADIOI_Info_set(info, "romio_cb_pfr", value);
00353 fd->hints->cb_pfr = ADIOI_HINT_AUTO;
00354 }
00355
00356 tmp_val = fd->hints->cb_pfr;
00357
00358 MPI_Bcast(&tmp_val, 1, MPI_INT, 0, fd->comm);
00359
00360 if (tmp_val != fd->hints->cb_pfr) {
00361 MPIO_ERR_CREATE_CODE_INFO_NOT_SAME(myname,
00362 "romio_cb_pfr",
00363 error_code);
00364 return;
00365 }
00366
00367 }
00368
00369
00370
00371
00372 ADIOI_Info_get(users_info, "romio_cb_fr_type", MPI_MAX_INFO_VAL,
00373 value, &flag);
00374 if (flag && ((intval=atoi(value)) >= -2)) {
00375 tmp_val = intval;
00376
00377 MPI_Bcast(&tmp_val, 1, MPI_INT, 0, fd->comm);
00378
00379 if (tmp_val != intval) {
00380 MPIO_ERR_CREATE_CODE_INFO_NOT_SAME(myname,
00381 "romio_cb_fr_type",
00382 error_code);
00383 return;
00384 }
00385
00386
00387 ADIOI_Info_set(info, "romio_cb_fr_type", value);
00388 fd->hints->cb_fr_type = intval;
00389
00390 }
00391 #endif
00392
00393 ADIOI_Info_get(users_info, "romio_no_indep_rw", MPI_MAX_INFO_VAL, value,
00394 &flag);
00395 if (flag) {
00396 if (!strcmp(value, "true") || !strcmp(value, "TRUE")) {
00397
00398
00399
00400 ADIOI_Info_set(info, "romio_no_indep_rw", value);
00401 ADIOI_Info_set(info, "romio_cb_write", "enable");
00402 ADIOI_Info_set(info, "romio_cb_read", "enable");
00403 fd->hints->no_indep_rw = 1;
00404 fd->hints->cb_read = 1;
00405 fd->hints->cb_write = 1;
00406 tmp_val = 1;
00407 }
00408 else if (!strcmp(value, "false") || !strcmp(value, "FALSE")) {
00409 ADIOI_Info_set(info, "romio_no_indep_rw", value);
00410 fd->hints->no_indep_rw = 0;
00411 tmp_val = 0;
00412 }
00413 else {
00414
00415 tmp_val = 0;
00416 }
00417
00418 MPI_Bcast(&tmp_val, 1, MPI_INT, 0, fd->comm);
00419
00420 if (tmp_val != fd->hints->no_indep_rw) {
00421 MPIO_ERR_CREATE_CODE_INFO_NOT_SAME(myname,
00422 "romio_no_indep_rw",
00423 error_code);
00424 return;
00425 }
00426
00427 }
00428
00429
00430
00431 ADIOI_Info_get(users_info, "romio_ds_read", MPI_MAX_INFO_VAL, value,
00432 &flag);
00433 if (flag) {
00434 if (!strcmp(value, "enable") || !strcmp(value, "ENABLE")) {
00435 ADIOI_Info_set(info, "romio_ds_read", value);
00436 fd->hints->ds_read = ADIOI_HINT_ENABLE;
00437 }
00438 else if (!strcmp(value, "disable") || !strcmp(value, "DISABLE")) {
00439 ADIOI_Info_set(info, "romio_ds_read", value);
00440 fd->hints->ds_read = ADIOI_HINT_DISABLE;
00441 }
00442 else if (!strcmp(value, "automatic") || !strcmp(value, "AUTOMATIC"))
00443 {
00444 ADIOI_Info_set(info, "romio_ds_read", value);
00445 fd->hints->ds_read = ADIOI_HINT_AUTO;
00446 }
00447
00448 }
00449 ADIOI_Info_get(users_info, "romio_ds_write", MPI_MAX_INFO_VAL, value,
00450 &flag);
00451 if (flag) {
00452 if (!strcmp(value, "enable") || !strcmp(value, "ENABLE")) {
00453 ADIOI_Info_set(info, "romio_ds_write", value);
00454 fd->hints->ds_write = ADIOI_HINT_ENABLE;
00455 }
00456 else if (!strcmp(value, "disable") || !strcmp(value, "DISABLE")) {
00457 ADIOI_Info_set(info, "romio_ds_write", value);
00458 fd->hints->ds_write = ADIOI_HINT_DISABLE;
00459 }
00460 else if (!strcmp(value, "automatic") || !strcmp(value, "AUTOMATIC"))
00461 {
00462 ADIOI_Info_set(info, "romio_ds_write", value);
00463 fd->hints->ds_write = ADIOI_HINT_AUTO;
00464 }
00465
00466 }
00467
00468 ADIOI_Info_get(users_info, "ind_wr_buffer_size", MPI_MAX_INFO_VAL,
00469 value, &flag);
00470 if (flag && ((intval = atoi(value)) > 0)) {
00471 ADIOI_Info_set(info, "ind_wr_buffer_size", value);
00472 fd->hints->ind_wr_buffer_size = intval;
00473 }
00474
00475 ADIOI_Info_get(users_info, "ind_rd_buffer_size", MPI_MAX_INFO_VAL,
00476 value, &flag);
00477 if (flag && ((intval = atoi(value)) > 0)) {
00478 ADIOI_Info_set(info, "ind_rd_buffer_size", value);
00479 fd->hints->ind_rd_buffer_size = intval;
00480 }
00481
00482 memset( value, 0, MPI_MAX_INFO_VAL+1 );
00483 ADIOI_Info_get(users_info, "romio_min_fdomain_size", MPI_MAX_INFO_VAL,
00484 value, &flag);
00485 if ( flag && ((intval = atoi(value)) > 0) ) {
00486 ADIOI_Info_set(info, "romio_min_fdomain_size", value);
00487 fd->hints->min_fdomain_size = intval;
00488 }
00489
00490
00491 ADIOI_Info_get(users_info, "striping_unit", MPI_MAX_INFO_VAL,
00492 value, &flag);
00493 if ( flag && ((intval = atoi(value)) > 0) ) {
00494 ADIOI_Info_set(info, "striping_unit", value);
00495 fd->hints->striping_unit = intval;
00496 }
00497
00498 memset( value, 0, MPI_MAX_INFO_VAL+1 );
00499 ADIOI_Info_get(users_info, ADIOI_BGL_NAGG_IN_PSET_HINT_NAME, MPI_MAX_INFO_VAL,
00500 value, &flag);
00501 if (flag && ((intval = atoi(value)) > 0)) {
00502
00503 did_anything = 1;
00504 ADIOI_Info_set(info, ADIOI_BGL_NAGG_IN_PSET_HINT_NAME, value);
00505 fd->hints->cb_nodes = intval;
00506 }
00507 }
00508
00509
00510 if (did_anything) {
00511 ADIOI_BGL_gen_agg_ranklist(fd, fd->hints->cb_nodes);
00512 }
00513
00514
00515
00516 ADIOI_Info_set(info, "romio_no_indep_rw", "false");
00517 fd->hints->no_indep_rw = 0;
00518 fd->hints->deferred_open = 0;
00519
00520
00521
00522
00523 if (ADIO_Feature(fd, ADIO_DATA_SIEVING_WRITES) == 0) {
00524
00525
00526 ADIOI_Info_get(info, "ind_wr_buffer_size", MPI_MAX_INFO_VAL,
00527 value, &flag);
00528 if (flag) {
00529
00530 ADIOI_Info_delete(info, "ind_wr_buffer_size");
00531 }
00532
00533
00534
00535 ADIOI_Info_set(info, "romio_ds_write", "disable");
00536 fd->hints->ds_write = ADIOI_HINT_DISABLE;
00537 }
00538
00539 ADIOI_Free(value);
00540
00541 *error_code = MPI_SUCCESS;
00542 }