00001
00002
00003
00004
00005
00006
00007
00008 #include "ad_pvfs.h"
00009
00010 void ADIOI_PVFS_SetInfo(ADIO_File fd, MPI_Info users_info, int *error_code)
00011 {
00012 char *value;
00013 int flag, tmp_val, str_factor=-1, str_unit=-1, start_iodev=-1;
00014 static char myname[] = "ADIOI_PVFS_SETINFO";
00015
00016 if ((fd->info) == MPI_INFO_NULL) {
00017
00018
00019 MPI_Info_create(&(fd->info));
00020 ADIOI_Info_set(fd->info, "romio_pvfs_listio_read", "disable");
00021 ADIOI_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 ADIOI_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
00038 MPIO_ERR_CREATE_CODE_INFO_NOT_SAME(myname,
00039 "striping_factor",
00040 error_code);
00041 return;
00042
00043 }
00044 else ADIOI_Info_set(fd->info, "striping_factor", value);
00045 }
00046
00047 ADIOI_Info_get(users_info, "striping_unit", MPI_MAX_INFO_VAL,
00048 value, &flag);
00049 if (flag) {
00050 str_unit=atoi(value);
00051 tmp_val = str_unit;
00052 MPI_Bcast(&tmp_val, 1, MPI_INT, 0, fd->comm);
00053 if (tmp_val != str_unit) {
00054
00055 MPIO_ERR_CREATE_CODE_INFO_NOT_SAME(myname,
00056 "striping_unit",
00057 error_code);
00058 return;
00059
00060 }
00061 else ADIOI_Info_set(fd->info, "striping_unit", value);
00062 }
00063
00064 ADIOI_Info_get(users_info, "start_iodevice", MPI_MAX_INFO_VAL,
00065 value, &flag);
00066 if (flag) {
00067 start_iodev=atoi(value);
00068 tmp_val = start_iodev;
00069 MPI_Bcast(&tmp_val, 1, MPI_INT, 0, fd->comm);
00070 if (tmp_val != start_iodev) {
00071
00072 MPIO_ERR_CREATE_CODE_INFO_NOT_SAME(myname,
00073 "start_iodevice",
00074 error_code);
00075 return;
00076
00077 }
00078 else ADIOI_Info_set(fd->info, "start_iodevice", value);
00079 }
00080
00081 ADIOI_Info_get(users_info, "romio_pvfs_listio_read",
00082 MPI_MAX_INFO_VAL,
00083 value, &flag);
00084 if (flag) {
00085 if ( !strcmp(value, "enable") || !strcmp(value, "ENABLE"))
00086 {
00087 ADIOI_Info_set(fd->info, "romio_pvfs_listio_read", value);
00088 fd->hints->fs_hints.pvfs.listio_read = ADIOI_HINT_ENABLE;
00089 } else if ( !strcmp(value, "disable") || !strcmp(value, "DISABLE"))
00090 {
00091 ADIOI_Info_set(fd->info , "romio_pvfs_listio_read", value);
00092 fd->hints->fs_hints.pvfs.listio_read = ADIOI_HINT_DISABLE;
00093 }
00094 else if ( !strcmp(value, "automatic") || !strcmp(value, "AUTOMATIC"))
00095 {
00096 ADIOI_Info_set(fd->info, "romio_pvfs_listio_read", value);
00097 fd->hints->fs_hints.pvfs.listio_read = ADIOI_HINT_AUTO;
00098 }
00099 tmp_val = fd->hints->fs_hints.pvfs.listio_read;
00100 MPI_Bcast(&tmp_val, 1, MPI_INT, 0, fd->comm);
00101 if (tmp_val != fd->hints->fs_hints.pvfs.listio_read) {
00102
00103 MPIO_ERR_CREATE_CODE_INFO_NOT_SAME(myname,
00104 "romio_pvfs_listio_read",
00105 error_code);
00106 return;
00107
00108 }
00109 }
00110 ADIOI_Info_get(users_info, "romio_pvfs_listio_write", MPI_MAX_INFO_VAL,
00111 value, &flag);
00112 if (flag) {
00113 if ( !strcmp(value, "enable") || !strcmp(value, "ENABLE"))
00114 {
00115 ADIOI_Info_set(fd->info, "romio_pvfs_listio_write", value);
00116 fd->hints->fs_hints.pvfs.listio_write = ADIOI_HINT_ENABLE;
00117 } else if ( !strcmp(value, "disable") || !strcmp(value, "DISABLE"))
00118 {
00119 ADIOI_Info_set(fd->info, "romio_pvfs_listio_write", value);
00120 fd->hints->fs_hints.pvfs.listio_write = ADIOI_HINT_DISABLE;
00121 }
00122 else if ( !strcmp(value, "automatic") || !strcmp(value, "AUTOMATIC"))
00123 {
00124 ADIOI_Info_set(fd->info, "romio_pvfs_listio_write", value);
00125 fd->hints->fs_hints.pvfs.listio_write = ADIOI_HINT_AUTO;
00126 }
00127 tmp_val = fd->hints->fs_hints.pvfs.listio_write;
00128 MPI_Bcast(&tmp_val, 1, MPI_INT, 0, fd->comm);
00129 if (tmp_val != fd->hints->fs_hints.pvfs.listio_write) {
00130
00131 MPIO_ERR_CREATE_CODE_INFO_NOT_SAME(myname,
00132 "romio_pvfs_listio_write",
00133 error_code);
00134 return;
00135
00136 }
00137 }
00138 ADIOI_Free(value);
00139 }
00140 }
00141
00142
00143 ADIOI_GEN_SetInfo(fd, users_info, error_code);
00144
00145 *error_code = MPI_SUCCESS;
00146 }