00001
00002
00003
00004
00005
00006
00007
00008
00009
00010 #include "mpi.h"
00011 #include <stdio.h>
00012 #include <string.h>
00013 #include <stdlib.h>
00014
00015
00016
00017
00018
00019 # define DFLT_CB_BUFFER_SIZE 16777216
00020 # define DFLT_IND_RD_BUFFER_SIZE 4194304
00021 # define DFLT_IND_WR_BUFFER_SIZE 524288
00022 # define DFLT_ROMIO_CB_READ "automatic"
00023 # define DFLT_ROMIO_CB_WRITE "automatic"
00024
00025
00026
00027
00028
00029
00030
00031
00032 int main(int argc, char **argv)
00033 {
00034 int verbose = 0;
00035 int i, len, nkeys, flag, mynod, default_striping_factor=0, nprocs, errs = 0;
00036 MPI_File fh;
00037 MPI_Info info, info_used;
00038 char *filename, key[MPI_MAX_INFO_KEY], value[MPI_MAX_INFO_VAL];
00039
00040 MPI_Init(&argc,&argv);
00041
00042 MPI_Comm_rank(MPI_COMM_WORLD, &mynod);
00043 MPI_Comm_size(MPI_COMM_WORLD, &nprocs);
00044
00045
00046
00047 if (!mynod) {
00048 i = 1;
00049 while ((i < argc) && strcmp("-fname", *argv)) {
00050 if (!strcmp("-v", *argv)) verbose = 1;
00051 i++;
00052 argv++;
00053 }
00054 if (i >= argc) {
00055 fprintf(stderr, "\n*# Usage: file_info [-v] -fname filename\n\n");
00056 MPI_Abort(MPI_COMM_WORLD, 1);
00057 }
00058 argv++;
00059 len = strlen(*argv);
00060 filename = (char *) malloc(len+1);
00061 strcpy(filename, *argv);
00062 MPI_Bcast(&len, 1, MPI_INT, 0, MPI_COMM_WORLD);
00063 MPI_Bcast(filename, len+1, MPI_CHAR, 0, MPI_COMM_WORLD);
00064 MPI_Bcast(&verbose, 1, MPI_INT, 0, MPI_COMM_WORLD);
00065 }
00066 else {
00067 MPI_Bcast(&len, 1, MPI_INT, 0, MPI_COMM_WORLD);
00068 filename = (char *) malloc(len+1);
00069 MPI_Bcast(filename, len+1, MPI_CHAR, 0, MPI_COMM_WORLD);
00070 MPI_Bcast(&verbose, 1, MPI_INT, 0, MPI_COMM_WORLD);
00071 }
00072
00073
00074 MPI_File_open(MPI_COMM_WORLD, filename, MPI_MODE_CREATE | MPI_MODE_RDWR,
00075 MPI_INFO_NULL, &fh);
00076
00077
00078 MPI_File_get_info(fh, &info_used);
00079 MPI_Info_get_nkeys(info_used, &nkeys);
00080
00081 for (i=0; i<nkeys; i++) {
00082 MPI_Info_get_nthkey(info_used, i, key);
00083 MPI_Info_get(info_used, key, MPI_MAX_INFO_VAL-1, value, &flag);
00084 #ifdef INFO_DEBUG
00085 if (!mynod)
00086 fprintf(stderr, "Process %d, Default: key = %s, value = %s\n", mynod,
00087 key, value);
00088 #endif
00089 if (!strcmp("striping_factor", key)) {
00090 default_striping_factor = atoi(value);
00091
00092 }
00093 else if (!strcmp("cb_buffer_size", key)) {
00094 if (atoi(value) != DFLT_CB_BUFFER_SIZE) {
00095 errs++;
00096 if (verbose) fprintf(stderr, "cb_buffer_size is %d; should be %d\n",
00097 atoi(value), DFLT_CB_BUFFER_SIZE);
00098 }
00099 }
00100 else if (!strcmp("romio_cb_read", key)) {
00101 if (strcmp(DFLT_ROMIO_CB_READ, value)) {
00102 errs++;
00103 if (verbose) fprintf(stderr, "romio_cb_read is set to %s; should be %s\n",
00104 value, DFLT_ROMIO_CB_READ);
00105 }
00106 }
00107 else if (!strcmp("romio_cb_write", key)) {
00108 if (strcmp(DFLT_ROMIO_CB_WRITE, value)) {
00109 errs++;
00110 if (verbose) fprintf(stderr, "romio_cb_write is set to %s; should be %s\n",
00111 value, DFLT_ROMIO_CB_WRITE);
00112 }
00113 }
00114 else if (!strcmp("cb_nodes", key)) {
00115
00116 }
00117 else if (!strcmp("romio_no_indep_rw", key)) {
00118 if (strcmp("false", value)) {
00119 errs++;
00120 if (verbose) fprintf(stderr, "romio_no_indep_rw is set to %s; should be %s\n",
00121 value, "false");
00122 }
00123 }
00124 else if (!strcmp("ind_rd_buffer_size", key)) {
00125 if (atoi(value) != DFLT_IND_RD_BUFFER_SIZE) {
00126 errs++;
00127 if (verbose) fprintf(stderr, "ind_rd_buffer_size is %d; should be %d\n",
00128 atoi(value), DFLT_IND_RD_BUFFER_SIZE);
00129 }
00130 }
00131 else if (!strcmp("ind_wr_buffer_size", key)) {
00132 if (atoi(value) != DFLT_IND_WR_BUFFER_SIZE) {
00133 errs++;
00134 if (verbose) fprintf(stderr, "ind_wr_buffer_size is %d; should be %d\n",
00135 atoi(value), DFLT_IND_WR_BUFFER_SIZE);
00136 }
00137 }
00138 else if (!strcmp("romio_ds_read", key)) {
00139 if (strcmp("automatic", value)) {
00140 errs++;
00141 if (verbose) fprintf(stderr, "romio_ds_read is set to %s; should be %s\n",
00142 value, "automatic");
00143 }
00144 }
00145 else if (!strcmp("romio_ds_write", key)) {
00146
00147 }
00148 else if (!strcmp("cb_config_list", key)) {
00149 #ifndef SKIP_CB_CONFIG_LIST_TEST
00150 if (strcmp("*:1", value)) {
00151 errs++;
00152 if (verbose) fprintf(stderr, "cb_config_list is set to %s; should be %s\n",
00153 value, "*:1");
00154 }
00155 #endif
00156 }
00157
00158 else if (!strcmp("romio_cb_pfr", key)) {
00159 }
00160 else if (!strcmp("romio_cb_fr_types", key)) {
00161 }
00162 else if (!strcmp("romio_cb_fr_alignment", key)) {
00163 }
00164 else if (!strcmp("romio_cb_ds_threshold", key)) {
00165 }
00166 else if (!strcmp("romio_cb_alltoall", key)) {
00167 }
00168 else {
00169 if (verbose) fprintf(stderr, "unexpected key %s (not counted as an error)\n", key);
00170 }
00171 }
00172 MPI_Info_free(&info_used);
00173
00174 MPI_File_close(&fh);
00175
00176
00177 if (!mynod) MPI_File_delete(filename, MPI_INFO_NULL);
00178 MPI_Barrier(MPI_COMM_WORLD);
00179
00180
00181
00182 MPI_Info_create(&info);
00183
00184
00185
00186
00187
00188 MPI_Info_set(info, "cb_buffer_size", "8388608");
00189
00190
00191 sprintf(value, "%d", nprocs/2);
00192 MPI_Info_set(info, "cb_nodes", value);
00193
00194
00195 MPI_Info_set(info, "ind_rd_buffer_size", "2097152");
00196
00197
00198 MPI_Info_set(info, "ind_wr_buffer_size", "1048576");
00199
00200
00201
00202
00203
00204
00205
00206
00207
00208
00209 if (default_striping_factor - 1 > 0) {
00210 sprintf(value, "%d", default_striping_factor-1);
00211 MPI_Info_set(info, "striping_factor", value);
00212 }
00213 else {
00214 sprintf(value, "%d", default_striping_factor);
00215 MPI_Info_set(info, "striping_factor", value);
00216 }
00217
00218
00219 MPI_Info_set(info, "striping_unit", "131072");
00220
00221 #ifndef SKIP_CB_CONFIG_LIST_TEST
00222
00223 MPI_Info_set(info, "cb_config_list", "*:*");
00224 #endif
00225
00226
00227
00228
00229 sprintf(value, "%d", default_striping_factor-2);
00230 MPI_Info_set(info, "start_iodevice", value);
00231
00232
00233
00234
00235 MPI_Info_set(info, "pfs_svr_buf", "true");
00236
00237
00238 MPI_File_open(MPI_COMM_WORLD, filename, MPI_MODE_CREATE | MPI_MODE_RDWR,
00239 info, &fh);
00240
00241
00242 MPI_File_get_info(fh, &info_used);
00243 MPI_Info_get_nkeys(info_used, &nkeys);
00244
00245 for (i=0; i<nkeys; i++) {
00246 MPI_Info_get_nthkey(info_used, i, key);
00247 MPI_Info_get(info_used, key, MPI_MAX_INFO_VAL-1, value, &flag);
00248 #ifdef INFO_DEBUG
00249 if (!mynod) fprintf(stderr, "Process %d, key = %s, value = %s\n", mynod,
00250 key, value);
00251 #endif
00252 if (!strcmp("striping_factor", key)) {
00253 if ((default_striping_factor - 1 > 0) && (atoi(value) != default_striping_factor-1)) {
00254 errs++;
00255 if (verbose) fprintf(stderr, "striping_factor is %d; should be %d\n",
00256 atoi(value), default_striping_factor-1);
00257 }
00258 else if (atoi(value) != default_striping_factor) {
00259 errs++;
00260 if (verbose) fprintf(stderr, "striping_factor is %d; should be %d\n",
00261 atoi(value), default_striping_factor);
00262 }
00263 }
00264 else if (!strcmp("cb_buffer_size", key)) {
00265 if (atoi(value) != 8388608) {
00266 errs++;
00267 if (verbose) fprintf(stderr, "cb_buffer_size is %d; should be %d\n",
00268 atoi(value), 8388608);
00269 }
00270 }
00271 else if (!strcmp("romio_cb_read", key)) {
00272 if (strcmp(DFLT_ROMIO_CB_READ, value)) {
00273 errs++;
00274 if (verbose) fprintf(stderr, "romio_cb_read is set to %s; should be %s\n",
00275 value, DFLT_ROMIO_CB_READ);
00276 }
00277 }
00278 else if (!strcmp("romio_cb_write", key)) {
00279 if (strcmp(DFLT_ROMIO_CB_WRITE, value)) {
00280 errs++;
00281 if (verbose) fprintf(stderr, "romio_cb_write is set to %s; should be %s\n",
00282 value, DFLT_ROMIO_CB_WRITE);
00283 }
00284 }
00285 else if (!strcmp("cb_nodes", key)) {
00286 if (atoi(value) != (nprocs/2)) {
00287 errs++;
00288 if (verbose) fprintf(stderr, "cb_nodes is %d; should be %d\n", atoi(value),
00289 nprocs/2);
00290 }
00291 }
00292 else if (!strcmp("romio_no_indep_rw", key)) {
00293 if (strcmp("false", value)) {
00294 errs++;
00295 if (verbose) fprintf(stderr, "romio_no_indep_rw is set to %s; should be %s\n",
00296 value, "false");
00297 }
00298 }
00299 else if (!strcmp("ind_rd_buffer_size", key)) {
00300 if (atoi(value) != 2097152) {
00301 errs++;
00302 if (verbose) fprintf(stderr, "ind_rd_buffer_size is %d; should be %d\n",
00303 atoi(value), 2097152);
00304 }
00305 }
00306 else if (!strcmp("ind_wr_buffer_size", key)) {
00307 if (atoi(value) != 1048576) {
00308 errs++;
00309 if (verbose) fprintf(stderr, "ind_wr_buffer_size is %d; should be %d\n",
00310 atoi(value), 1048576);
00311 }
00312 }
00313 else if (!strcmp("romio_ds_read", key)) {
00314 if (strcmp("automatic", value)) {
00315 errs++;
00316 if (verbose) fprintf(stderr, "romio_ds_read is set to %s; should be %s\n",
00317 value, "automatic");
00318 }
00319 }
00320 else if (!strcmp("romio_ds_write", key)) {
00321
00322 }
00323 else if (!strcmp("cb_config_list", key)) {
00324 #ifndef SKIP_CB_CONFIG_LIST_TEST
00325 if (strcmp("*:*", value)) {
00326 errs++;
00327 if (verbose) fprintf(stderr, "cb_config_list is set to %s; should be %s\n",
00328 value, "*:*");
00329 }
00330 #endif
00331 }
00332 else if (!strcmp("romio_cb_pfr", key)) {
00333 if(strcmp("disable", value)) {
00334 errs++;
00335 if (verbose) fprintf(stderr, "romio_cb_pfr is set to %s; should be %s\n",
00336 value, "automatic");
00337 }
00338 }
00339 else if (!strcmp("romio_cb_fr_types", key)) {
00340 if(strcmp("aar", value)) {
00341 errs++;
00342 if (verbose) fprintf(stderr, "romio_cb_fr_types is set to %s; should be %s\n",
00343 value, "aar");
00344 }
00345 }
00346 else if (!strcmp("romio_cb_fr_alignment", key)) {
00347 if(strcmp("1", value)) {
00348 errs++;
00349 if (verbose) fprintf(stderr, "romio_cb_fr_alignment is set to %s; should be %s\n",
00350 value, "1");
00351 }
00352 }
00353 else if (!strcmp("romio_cb_ds_threshold", key)) {
00354 if(strcmp("0", value)) {
00355 errs++;
00356 if (verbose) fprintf(stderr, "romio_cb_ds_threshold is set to %s; should be %s\n",
00357 value, "0");
00358 }
00359 }
00360 else if (!strcmp("romio_cb_alltoall", key)) {
00361 if(strcmp("automatic", value)) {
00362 errs++;
00363 if (verbose) fprintf(stderr, "romio_cb_alltoall is set to %s; should be %s\n",
00364 value, "automatic");
00365 }
00366 }
00367
00368 else {
00369 if (verbose) fprintf(stderr, "unexpected key %s (not counted as an error)\n", key);
00370 }
00371 }
00372
00373
00374 if (!mynod) {
00375 if (errs) fprintf(stderr, "Found %d errors.\n", errs);
00376 else printf(" No Errors\n");
00377 }
00378
00379 MPI_File_close(&fh);
00380 free(filename);
00381 MPI_Info_free(&info_used);
00382 MPI_Info_free(&info);
00383 MPI_Finalize();
00384 return 0;
00385 }