root/ompi/mca/io/romio321/romio/adio/ad_lustre/ad_lustre_hints.c

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

DEFINITIONS

This source file includes following definitions.
  1. ADIOI_LUSTRE_SetInfo

   1 /* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */
   2 /*
   3  *   Copyright (C) 1997 University of Chicago.
   4  *   See COPYRIGHT notice in top-level directory.
   5  *
   6  *   Copyright (C) 2007 Oak Ridge National Laboratory
   7  *
   8  *   Copyright (C) 2008 Sun Microsystems, Lustre group
   9  */
  10 
  11 #include "ad_lustre.h"
  12 #include "adio_extern.h"
  13 #include "hint_fns.h"
  14 #ifdef HAVE_LIMITS_H
  15 #include <limits.h>
  16 #endif
  17 
  18 void ADIOI_LUSTRE_SetInfo(ADIO_File fd, MPI_Info users_info, int *error_code)
  19 {
  20     char *value;
  21     int flag;
  22     ADIO_Offset stripe_val[3], str_factor = -1, str_unit=0, start_iodev=-1;
  23     int myrank;
  24     static char myname[] = "ADIOI_LUSTRE_SETINFO";
  25 
  26     value = (char *) ADIOI_Malloc((MPI_MAX_INFO_VAL+1)*sizeof(char));
  27     if ( (fd->info) == MPI_INFO_NULL) {
  28         /* This must be part of the open call. can set striping parameters
  29            if necessary. */
  30         MPI_Info_create(&(fd->info));
  31 
  32         ADIOI_Info_set(fd->info, "direct_read", "false");
  33         ADIOI_Info_set(fd->info, "direct_write", "false");
  34         fd->direct_read = fd->direct_write = 0;
  35         /* initialize lustre hints */
  36         ADIOI_Info_set(fd->info, "romio_lustre_co_ratio", "1");
  37         fd->hints->fs_hints.lustre.co_ratio = 1;
  38         ADIOI_Info_set(fd->info, "romio_lustre_coll_threshold", "0");
  39         fd->hints->fs_hints.lustre.coll_threshold = 0;
  40         ADIOI_Info_set(fd->info, "romio_lustre_ds_in_coll", "enable");
  41         fd->hints->fs_hints.lustre.ds_in_coll = ADIOI_HINT_ENABLE;
  42 
  43         /* has user specified striping or server buffering parameters
  44            and do they have the same value on all processes? */
  45         if (users_info != MPI_INFO_NULL) {
  46             /* striping information */
  47             ADIOI_Info_get(users_info, "striping_unit", MPI_MAX_INFO_VAL,
  48                          value, &flag);
  49             if (flag) {
  50                 ADIOI_Info_set(fd->info, "striping_unit", value);
  51                 str_unit=atoll(value);
  52             }
  53 
  54             ADIOI_Info_get(users_info, "striping_factor", MPI_MAX_INFO_VAL,
  55                          value, &flag);
  56             if (flag) {
  57                 ADIOI_Info_set(fd->info, "striping_factor", value);
  58                 str_factor=atoll(value);
  59             }
  60 
  61             ADIOI_Info_get(users_info, "romio_lustre_start_iodevice",
  62                          MPI_MAX_INFO_VAL, value, &flag);
  63             if (flag) {
  64                 ADIOI_Info_set(fd->info, "romio_lustre_start_iodevice", value);
  65                 start_iodev=atoll(value);
  66             }
  67 
  68 
  69             /* direct read and write */
  70             ADIOI_Info_get(users_info, "direct_read", MPI_MAX_INFO_VAL,
  71                          value, &flag);
  72             if (flag && (!strcmp(value, "true") || !strcmp(value, "TRUE"))) {
  73                 ADIOI_Info_set(fd->info, "direct_read", "true");
  74                 fd->direct_read = 1;
  75             }
  76             ADIOI_Info_get(users_info, "direct_write", MPI_MAX_INFO_VAL,
  77                              value, &flag);
  78             if (flag && (!strcmp(value, "true") || !strcmp(value, "TRUE"))) {
  79                 ADIOI_Info_set(fd->info, "direct_write", "true");
  80                 fd->direct_write = 1;
  81             }
  82         }
  83 
  84         /* set striping information with ioctl */
  85         MPI_Comm_rank(fd->comm, &myrank);
  86         if (myrank == 0) {
  87             stripe_val[0] = str_factor;
  88             stripe_val[1] = str_unit;
  89             stripe_val[2] = start_iodev;
  90         }
  91         MPI_Bcast(stripe_val, 3, MPI_OFFSET, 0, fd->comm);
  92 
  93         /* do not open file in hint processing.   Open file in open routines,
  94          * where we can better deal with EXCL flag .  Continue to check the
  95          * "all processors set a value" condition holds.  */
  96         if (stripe_val[0] != str_factor
  97                 || stripe_val[1] != str_unit
  98                 || stripe_val[2] != start_iodev) {
  99                    MPIO_ERR_CREATE_CODE_INFO_NOT_SAME("ADIOI_LUSTRE_SetInfo",
 100                                                "str_factor or str_unit or start_iodev",
 101                                                error_code);
 102                    ADIOI_Free(value);
 103                    return;
 104         }
 105     }
 106 
 107     /* get other hint */
 108     if (users_info != MPI_INFO_NULL) {
 109         /* CO: IO Clients/OST,
 110          * to keep the load balancing between clients and OSTs */
 111         ADIOI_Info_check_and_install_int(fd, users_info, "romio_lustre_co_ratio", 
 112                 &(fd->hints->fs_hints.lustre.co_ratio), myname, error_code );
 113 
 114         /* coll_threshold:
 115          * if the req size is bigger than this, collective IO may not be performed.
 116          */
 117         ADIOI_Info_check_and_install_int(fd, users_info, "romio_lustre_coll_threshold",
 118                 &(fd->hints->fs_hints.lustre.coll_threshold), myname, error_code );
 119 
 120         /* ds_in_coll: disable data sieving in collective IO */
 121         ADIOI_Info_check_and_install_enabled(fd, users_info, "romio_lustre_ds_in_coll",
 122                 &(fd->hints->fs_hints.lustre.ds_in_coll), myname, error_code );
 123 
 124     }
 125     /* set the values for collective I/O and data sieving parameters */
 126     ADIOI_GEN_SetInfo(fd, users_info, error_code);
 127 
 128     /* generic hints might step on striping_unit */
 129     if (users_info != MPI_INFO_NULL) {
 130         ADIOI_Info_check_and_install_int(fd, users_info, "striping_unit",
 131                 NULL, myname, error_code);
 132     }
 133 
 134     if (ADIOI_Direct_read) fd->direct_read = 1;
 135     if (ADIOI_Direct_write) fd->direct_write = 1;
 136 
 137     ADIOI_Free(value);
 138 
 139     *error_code = MPI_SUCCESS;
 140 }

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