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