root/ompi/mca/io/romio321/romio/adio/ad_pvfs/ad_pvfs_hints.c

/* [<][>][^][v][top][bottom][index][help] */

DEFINITIONS

This source file includes following definitions.
  1. ADIOI_PVFS_SetInfo

   1 /* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */
   2 /* 
   3  *
   4  *   Copyright (C) 1997 University of Chicago. 
   5  *   See COPYRIGHT notice in top-level directory.
   6  */
   7 
   8 #include "ad_pvfs.h"
   9 
  10 void ADIOI_PVFS_SetInfo(ADIO_File fd, MPI_Info users_info, int *error_code)
  11 {
  12     char *value;
  13     int flag, tmp_val, str_factor=-1, str_unit=-1, start_iodev=-1; 
  14     static char myname[] = "ADIOI_PVFS_SETINFO";
  15 
  16     if ((fd->info) == MPI_INFO_NULL) {
  17         /* This must be part of the open call. can set striping parameters 
  18            if necessary. */ 
  19         MPI_Info_create(&(fd->info));
  20         ADIOI_Info_set(fd->info, "romio_pvfs_listio_read", "disable");
  21         ADIOI_Info_set(fd->info, "romio_pvfs_listio_write", "disable");
  22         fd->hints->fs_hints.pvfs.listio_read = ADIOI_HINT_DISABLE;
  23         fd->hints->fs_hints.pvfs.listio_write = ADIOI_HINT_DISABLE;
  24         
  25         /* has user specified any pvfs-specific hints (striping params, listio)
  26            and do they have the same value on all processes? */
  27         if (users_info != MPI_INFO_NULL) {
  28             value = (char *) ADIOI_Malloc((MPI_MAX_INFO_VAL+1)*sizeof(char));
  29 
  30             ADIOI_Info_get(users_info, "striping_factor", MPI_MAX_INFO_VAL, 
  31                          value, &flag);
  32             if (flag) {
  33                 str_factor=atoi(value);
  34                 tmp_val = str_factor;
  35                 MPI_Bcast(&tmp_val, 1, MPI_INT, 0, fd->comm);
  36                 if (tmp_val != str_factor) {
  37                     /* --BEGIN ERROR HANDLING-- */
  38                     MPIO_ERR_CREATE_CODE_INFO_NOT_SAME(myname,
  39                                                        "striping_factor",
  40                                                        error_code);
  41                     return;
  42                     /* --END ERROR HANDLING-- */
  43                 }
  44                 else ADIOI_Info_set(fd->info, "striping_factor", value);
  45             }
  46 
  47             ADIOI_Info_get(users_info, "striping_unit", MPI_MAX_INFO_VAL, 
  48                          value, &flag);
  49             if (flag) {
  50                 str_unit=atoi(value);
  51                 tmp_val = str_unit;
  52                 MPI_Bcast(&tmp_val, 1, MPI_INT, 0, fd->comm);
  53                 if (tmp_val != str_unit) {
  54                     /* --BEGIN ERROR HANDLING-- */
  55                     MPIO_ERR_CREATE_CODE_INFO_NOT_SAME(myname,
  56                                                        "striping_unit",
  57                                                        error_code);
  58                     return;
  59                     /* --END ERROR HANDLING-- */
  60                 }
  61                 else ADIOI_Info_set(fd->info, "striping_unit", value);
  62             }
  63 
  64             ADIOI_Info_get(users_info, "start_iodevice", MPI_MAX_INFO_VAL, 
  65                          value, &flag);
  66             if (flag) {
  67                 start_iodev=atoi(value);
  68                 tmp_val = start_iodev;
  69                 MPI_Bcast(&tmp_val, 1, MPI_INT, 0, fd->comm);
  70                 if (tmp_val != start_iodev) {
  71                     /* --BEGIN ERROR HANDLING-- */
  72                     MPIO_ERR_CREATE_CODE_INFO_NOT_SAME(myname,
  73                                                        "start_iodevice",
  74                                                        error_code);
  75                     return;
  76                     /* --END ERROR HANDLING-- */
  77                 }
  78                 else ADIOI_Info_set(fd->info, "start_iodevice", value);
  79             }
  80 
  81             ADIOI_Info_get(users_info, "romio_pvfs_listio_read",
  82                          MPI_MAX_INFO_VAL,
  83                          value, &flag);
  84             if (flag) {
  85                 if ( !strcmp(value, "enable") || !strcmp(value, "ENABLE")) 
  86                 {
  87                     ADIOI_Info_set(fd->info, "romio_pvfs_listio_read", value);
  88                     fd->hints->fs_hints.pvfs.listio_read = ADIOI_HINT_ENABLE;
  89                 } else if ( !strcmp(value, "disable") || !strcmp(value, "DISABLE")) 
  90                 {
  91                     ADIOI_Info_set(fd->info , "romio_pvfs_listio_read", value);
  92                     fd->hints->fs_hints.pvfs.listio_read = ADIOI_HINT_DISABLE;
  93                 }
  94                 else if ( !strcmp(value, "automatic") || !strcmp(value, "AUTOMATIC")) 
  95                 {
  96                     ADIOI_Info_set(fd->info, "romio_pvfs_listio_read", value);
  97                     fd->hints->fs_hints.pvfs.listio_read = ADIOI_HINT_AUTO;
  98                 }
  99                 tmp_val = fd->hints->fs_hints.pvfs.listio_read;
 100                 MPI_Bcast(&tmp_val, 1, MPI_INT, 0, fd->comm);
 101                 if (tmp_val != fd->hints->fs_hints.pvfs.listio_read) {
 102                     /* --BEGIN ERROR HANDLING-- */
 103                     MPIO_ERR_CREATE_CODE_INFO_NOT_SAME(myname,
 104                                                        "romio_pvfs_listio_read",
 105                                                        error_code);
 106                     return;
 107                     /* --END ERROR HANDLING-- */
 108                 }
 109             }
 110             ADIOI_Info_get(users_info, "romio_pvfs_listio_write", MPI_MAX_INFO_VAL,
 111                          value, &flag);
 112             if (flag) {
 113                 if ( !strcmp(value, "enable") || !strcmp(value, "ENABLE")) 
 114                 {
 115                     ADIOI_Info_set(fd->info, "romio_pvfs_listio_write", value);
 116                     fd->hints->fs_hints.pvfs.listio_write = ADIOI_HINT_ENABLE;
 117                 } else if ( !strcmp(value, "disable") || !strcmp(value, "DISABLE")) 
 118                 {
 119                     ADIOI_Info_set(fd->info, "romio_pvfs_listio_write", value);
 120                     fd->hints->fs_hints.pvfs.listio_write = ADIOI_HINT_DISABLE;
 121                 }
 122                 else if ( !strcmp(value, "automatic") || !strcmp(value, "AUTOMATIC")) 
 123                 {
 124                     ADIOI_Info_set(fd->info, "romio_pvfs_listio_write", value);
 125                     fd->hints->fs_hints.pvfs.listio_write = ADIOI_HINT_AUTO;
 126                 }
 127                 tmp_val = fd->hints->fs_hints.pvfs.listio_write;
 128                 MPI_Bcast(&tmp_val, 1, MPI_INT, 0, fd->comm);
 129                 if (tmp_val != fd->hints->fs_hints.pvfs.listio_write) {
 130                     /* --BEGIN ERROR HANDLING-- */
 131                     MPIO_ERR_CREATE_CODE_INFO_NOT_SAME(myname,
 132                                                        "romio_pvfs_listio_write",
 133                                                        error_code);
 134                     return;
 135                     /* --END ERROR HANDLING-- */
 136                 }
 137             }               
 138             ADIOI_Free(value);
 139         }
 140     }   
 141 
 142     /* set the values for collective I/O and data sieving parameters */
 143     ADIOI_GEN_SetInfo(fd, users_info, error_code);
 144 
 145     *error_code = MPI_SUCCESS;
 146 }

/* [<][>][^][v][top][bottom][index][help] */