00001
00002
00003
00004
00005
00006
00007
00008
00009 #include "ad_pvfs.h"
00010
00011 void ADIOI_PVFS_SetInfo(ADIO_File fd, MPI_Info users_info, int *error_code)
00012 {
00013 char *value;
00014 int flag, tmp_val, str_factor=-1, str_unit=-1, start_iodev=-1;
00015
00016 if (!(fd->info)) {
00017
00018
00019 MPI_Info_create(&(fd->info));
00020 MPI_Info_set(fd->info, "romio_pvfs_listio_read", "disable");
00021 MPI_Info_set(fd->info, "romio_pvfs_listio_write", "disable");
00022 fd->hints->fs_hints.pvfs.listio_read = ADIOI_HINT_DISABLE;
00023 fd->hints->fs_hints.pvfs.listio_write = ADIOI_HINT_DISABLE;
00024
00025
00026
00027 if (users_info != MPI_INFO_NULL) {
00028 value = (char *) ADIOI_Malloc((MPI_MAX_INFO_VAL+1)*sizeof(char));
00029
00030 MPI_Info_get(users_info, "striping_factor", MPI_MAX_INFO_VAL,
00031 value, &flag);
00032 if (flag) {
00033 str_factor=atoi(value);
00034 tmp_val = str_factor;
00035 MPI_Bcast(&tmp_val, 1, MPI_INT, 0, fd->comm);
00036 if (tmp_val != str_factor) {
00037 FPRINTF(stderr, "ADIOI_PVFS_SetInfo: the value for key \"striping_factor\" must be the same on all processes\n");
00038 MPI_Abort(MPI_COMM_WORLD, 1);
00039 }
00040 else MPI_Info_set(fd->info, "striping_factor", value);
00041 }
00042
00043 MPI_Info_get(users_info, "striping_unit", MPI_MAX_INFO_VAL,
00044 value, &flag);
00045 if (flag) {
00046 str_unit=atoi(value);
00047 tmp_val = str_unit;
00048 MPI_Bcast(&tmp_val, 1, MPI_INT, 0, fd->comm);
00049 if (tmp_val != str_unit) {
00050 FPRINTF(stderr, "ADIOI_PVFS_SetInfo: the value for key \"striping_unit\" must be the same on all processes\n");
00051 MPI_Abort(MPI_COMM_WORLD, 1);
00052 }
00053 else MPI_Info_set(fd->info, "striping_unit", value);
00054 }
00055
00056 MPI_Info_get(users_info, "start_iodevice", MPI_MAX_INFO_VAL,
00057 value, &flag);
00058 if (flag) {
00059 start_iodev=atoi(value);
00060 tmp_val = start_iodev;
00061 MPI_Bcast(&tmp_val, 1, MPI_INT, 0, fd->comm);
00062 if (tmp_val != start_iodev) {
00063 FPRINTF(stderr, "ADIOI_PVFS_SetInfo: the value for key \"start_iodevice\" must be the same on all processes\n");
00064 MPI_Abort(MPI_COMM_WORLD, 1);
00065 }
00066 else MPI_Info_set(fd->info, "start_iodevice", value);
00067 }
00068
00069 MPI_Info_get(users_info, "romio_pvfs_listio_read", MPI_MAX_INFO_VAL,
00070 value, &flag);
00071 if (flag) {
00072 if ( !strcmp(value, "enable") || !strcmp(value, "ENABLE"))
00073 {
00074 MPI_Info_set(fd->info, "romio_pvfs_listio_read", value);
00075 fd->hints->fs_hints.pvfs.listio_read = ADIOI_HINT_ENABLE;
00076 } else if ( !strcmp(value, "disable") || !strcmp(value, "DISABLE"))
00077 {
00078 MPI_Info_set(fd->info , "romio_pvfs_listio_read", value);
00079 fd->hints->fs_hints.pvfs.listio_read = ADIOI_HINT_DISABLE;
00080 }
00081 else if ( !strcmp(value, "automatic") || !strcmp(value, "AUTOMATIC"))
00082 {
00083 MPI_Info_set(fd->info, "romio_pvfs_listio_read", value);
00084 fd->hints->fs_hints.pvfs.listio_read = ADIOI_HINT_AUTO;
00085 }
00086 tmp_val = fd->hints->fs_hints.pvfs.listio_read;
00087 MPI_Bcast(&tmp_val, 1, MPI_INT, 0, fd->comm);
00088 if (tmp_val != fd->hints->fs_hints.pvfs.listio_read) {
00089 FPRINTF(stderr, "ADIOI_PVFS_SetInfo: the value for key \"romio_pvfs_listio_read\" must be the same on all processes\n");
00090 MPI_Abort(MPI_COMM_WORLD, 1);
00091 }
00092 }
00093 MPI_Info_get(users_info, "romio_pvfs_listio_write", MPI_MAX_INFO_VAL,
00094 value, &flag);
00095 if (flag) {
00096 if ( !strcmp(value, "enable") || !strcmp(value, "ENABLE"))
00097 {
00098 MPI_Info_set(fd->info, "romio_pvfs_listio_write", value);
00099 fd->hints->fs_hints.pvfs.listio_write = ADIOI_HINT_ENABLE;
00100 } else if ( !strcmp(value, "disable") || !strcmp(value, "DISABLE"))
00101 {
00102 MPI_Info_set(fd->info, "romio_pvfs_listio_write", value);
00103 fd->hints->fs_hints.pvfs.listio_write = ADIOI_HINT_DISABLE;
00104 }
00105 else if ( !strcmp(value, "automatic") || !strcmp(value, "AUTOMATIC"))
00106 {
00107 MPI_Info_set(fd->info, "romio_pvfs_listio_write", value);
00108 fd->hints->fs_hints.pvfs.listio_write = ADIOI_HINT_AUTO;
00109 }
00110 tmp_val = fd->hints->fs_hints.pvfs.listio_write;
00111 MPI_Bcast(&tmp_val, 1, MPI_INT, 0, fd->comm);
00112 if (tmp_val != fd->hints->fs_hints.pvfs.listio_write) {
00113 FPRINTF(stderr, "ADIOI_PVFS_SetInfo: the value for key \"romio_pvfs_listio_write\" must be the same on all processes\n");
00114 MPI_Abort(MPI_COMM_WORLD, 1);
00115 }
00116 }
00117 ADIOI_Free(value);
00118 }
00119 }
00120
00121
00122 ADIOI_GEN_SetInfo(fd, users_info, error_code);
00123
00124 *error_code = MPI_SUCCESS;
00125 }