root/ompi/mca/io/romio321/romio/adio/ad_xfs/ad_xfs_hints.c

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

DEFINITIONS

This source file includes following definitions.
  1. ADIOI_XFS_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_xfs.h"
   9 #include "adio_extern.h"
  10 
  11 static unsigned xfs_direct_read_chunk_size;
  12 static unsigned xfs_direct_write_chunk_size;
  13 
  14 void ADIOI_XFS_SetInfo(ADIO_File fd, MPI_Info users_info, int *error_code)
  15 {
  16     char *value, * c;
  17     int flag;
  18     static char xfs_initialized = 0;
  19 
  20     if (fd->info == MPI_INFO_NULL) MPI_Info_create(&(fd->info));
  21 
  22     ADIOI_Info_set(fd->info, "direct_read", "false");
  23     ADIOI_Info_set(fd->info, "direct_write", "false");
  24     fd->direct_read = fd->direct_write = 0;
  25 
  26         if (!xfs_initialized) {
  27                 xfs_initialized = 1;
  28                 c = getenv("MPIO_DIRECT_READ_CHUNK_SIZE");
  29                 if (c) {
  30                         int io;
  31                         io = atoi(c);
  32                         if (io <= 0) {
  33                                 fprintf(stderr,
  34 "MPI: Ignoring an invalid setting for MPIO_DIRECT_READ_CHUNK_SIZE.\n"
  35 "     It must be set to a positive integer value.\n");
  36                         } else {
  37                                 xfs_direct_read_chunk_size = io;
  38                         }
  39                 } else {
  40                         xfs_direct_read_chunk_size = 0;
  41                 }
  42 
  43                 c = getenv("MPIO_DIRECT_WRITE_CHUNK_SIZE");
  44                 if (c) {
  45                         int io;
  46                         io = atoi(c);
  47                         if (io <= 0) {
  48                                 fprintf(stderr,
  49 "MPI: Ignoring an invalid setting for MPIO_DIRECT_WRITE_CHUNK_SIZE.\n"
  50 "     It must be set to a positive integer value.\n");
  51                         } else {
  52                                 xfs_direct_write_chunk_size = io;
  53                         }
  54                 } else {
  55                         xfs_direct_write_chunk_size = 0;
  56                 }
  57         }
  58 
  59         if (!fd->hints->initialized) {
  60                 fd->hints->fs_hints.xfs.read_chunk_sz =
  61                         xfs_direct_read_chunk_size;
  62                 fd->hints->fs_hints.xfs.write_chunk_sz =
  63                         xfs_direct_write_chunk_size;
  64         }
  65 
  66     /* has user specified values for keys "direct_read" and "direct write"? */
  67     if (users_info != MPI_INFO_NULL) {
  68         value = (char *) ADIOI_Malloc((MPI_MAX_INFO_VAL+1)*sizeof(char));
  69 
  70         ADIOI_Info_get(users_info, "direct_read", MPI_MAX_INFO_VAL, 
  71                          value, &flag);
  72         if (flag && !strcmp(value, "true")) {
  73             ADIOI_Info_set(fd->info, "direct_read", "true");
  74             fd->direct_read = 1;
  75         }
  76 
  77         ADIOI_Info_get(users_info, "direct_write", MPI_MAX_INFO_VAL, 
  78                          value, &flag);
  79         if (flag && !strcmp(value, "true")) {
  80             ADIOI_Info_set(fd->info, "direct_write", "true");
  81             fd->direct_write = 1;
  82         }
  83 
  84         ADIOI_Free(value);
  85     }
  86     
  87     /* set the values for collective I/O and data sieving parameters */
  88     ADIOI_GEN_SetInfo(fd, users_info, error_code);
  89 
  90     /* Environment variables override MPI_Info hints */
  91     if (ADIOI_Direct_read) fd->direct_read = 1;
  92     if (ADIOI_Direct_write) fd->direct_write = 1;
  93 
  94     /* environment variables checked in ADIO_Init */
  95 
  96     *error_code = MPI_SUCCESS;
  97 }

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