root/ompi/mca/sharedfp/individual/sharedfp_individual.c

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

DEFINITIONS

This source file includes following definitions.
  1. mca_sharedfp_individual_component_init_query
  2. mca_sharedfp_individual_component_file_query
  3. mca_sharedfp_individual_component_file_unquery
  4. mca_sharedfp_individual_module_init
  5. mca_sharedfp_individual_module_finalize

   1 /*
   2  * Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
   3  *                         University Research and Technology
   4  *                         Corporation.  All rights reserved.
   5  * Copyright (c) 2004-2006 The University of Tennessee and The University
   6  *                         of Tennessee Research Foundation.  All rights
   7  *                         reserved.
   8  * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
   9  *                         University of Stuttgart.  All rights reserved.
  10  * Copyright (c) 2004-2005 The Regents of the University of California.
  11  *                         All rights reserved.
  12  * Copyright (c) 2013-2015 University of Houston. All rights reserved.
  13  * Copyright (c) 2016-2017 IBM Corporation. All rights reserved.
  14  * Copyright (c) 2018      Research Organization for Information Science
  15  *                         and Technology (RIST). All rights reserved.
  16  * $COPYRIGHT$
  17  *
  18  * Additional copyrights may follow
  19  *
  20  * $HEADER$
  21  *
  22  * These symbols are in a file by themselves to provide nice linker
  23  * semantics. Since linkers generally pull in symbols by object fules,
  24  * keeping these symbols as the only symbols in this file prevents
  25  * utility programs such as "ompi_info" from having to import entire
  26  * modules just to query their version and parameters
  27  */
  28 
  29 #include "ompi_config.h"
  30 #include "mpi.h"
  31 #include "ompi/mca/sharedfp/sharedfp.h"
  32 #include "ompi/mca/sharedfp/base/base.h"
  33 #include "ompi/mca/sharedfp/individual/sharedfp_individual.h"
  34 
  35 /*
  36  * *******************************************************************
  37  * ************************ actions structure ************************
  38  * *******************************************************************
  39  */
  40  /* IMPORTANT: Update here when adding sharedfp component interface functions*/
  41 static mca_sharedfp_base_module_1_0_0_t individual =  {
  42     mca_sharedfp_individual_module_init, /* initalise after being selected */
  43     mca_sharedfp_individual_module_finalize, /* close a module on a communicator */
  44     mca_sharedfp_individual_seek,
  45     mca_sharedfp_individual_get_position,
  46     mca_sharedfp_individual_read,
  47     mca_sharedfp_individual_read_ordered,
  48     mca_sharedfp_individual_read_ordered_begin,
  49     mca_sharedfp_individual_read_ordered_end,
  50     mca_sharedfp_individual_iread,
  51     mca_sharedfp_individual_write,
  52     mca_sharedfp_individual_write_ordered,
  53     mca_sharedfp_individual_write_ordered_begin,
  54     mca_sharedfp_individual_write_ordered_end,
  55     mca_sharedfp_individual_iwrite,
  56     mca_sharedfp_individual_file_open,
  57     mca_sharedfp_individual_file_close
  58 };
  59 /*
  60  * *******************************************************************
  61  * ************************* structure ends **************************
  62  * *******************************************************************
  63  */
  64 
  65 int mca_sharedfp_individual_component_init_query(bool enable_progress_threads,
  66                                             bool enable_mpi_threads)
  67 {
  68     /* Nothing to do */
  69 
  70    return OMPI_SUCCESS;
  71 }
  72 
  73 struct mca_sharedfp_base_module_1_0_0_t * mca_sharedfp_individual_component_file_query (ompio_file_t *fh, int *priority) {
  74 
  75     int amode;
  76     bool wronly_flag=false;
  77     bool relaxed_order_flag=false;
  78     opal_info_t *info;
  79     int flag;
  80     int valuelen;
  81     char value[MPI_MAX_INFO_VAL+1];
  82     *priority = 0;
  83 
  84     /*test, and update priority*/
  85     /*---------------------------------------------------------*/
  86     /* 1. Is the file write only? check amode for MPI_MODE_WRONLY */
  87     amode = fh->f_amode;
  88     if ( amode & MPI_MODE_WRONLY || amode & MPI_MODE_RDWR ) {
  89         wronly_flag=true;
  90         if ( mca_sharedfp_individual_verbose ) {
  91             opal_output(ompi_sharedfp_base_framework.framework_output,
  92                         "mca_sharedfp_individual_component_file_query: "
  93                         "MPI_MODE_WRONLY[true=%d,false=%d]=%d\n",true,false,wronly_flag);
  94         }
  95     } else {
  96         wronly_flag=false;
  97         if ( mca_sharedfp_individual_verbose ) {
  98             opal_output(ompi_sharedfp_base_framework.framework_output,
  99                         "mca_sharedfp_individual_component_file_query: Can not run!, "
 100                         "MPI_MODE_WRONLY[true=%d,false=%d]=%d\n",true,false,wronly_flag);
 101         }
 102     }
 103 
 104     /*---------------------------------------------------------*/
 105     /* 2. Did the user specify MPI_INFO relaxed ordering flag? */
 106     info = fh->f_info;
 107     if ( info != &(MPI_INFO_NULL->super) ){
 108         valuelen = MPI_MAX_INFO_VAL;
 109         opal_info_get ( info,"OMPIO_SHAREDFP_RELAXED_ORDERING", valuelen, value, &flag);
 110         if ( flag ) {
 111            if ( mca_sharedfp_individual_verbose ) {
 112                 opal_output(ompi_sharedfp_base_framework.framework_output,
 113                         "mca_sharedfp_individual_component_file_query: "
 114                         "OMPIO_SHAREDFP_RELAXED_ORDERING=%s\n",value);
 115             }
 116             /* flag - Returns true if key defined, false if not (boolean). */
 117             relaxed_order_flag=true;
 118         }
 119         else {
 120             if ( mca_sharedfp_individual_verbose ) {
 121                opal_output(ompi_sharedfp_base_framework.framework_output,
 122                         "mca_sharedfp_individual_component_file_query: "
 123                         "OMPIO_SHAREDFP_RELAXED_ORDERING MPI_Info key not set. "
 124                         "Set this key in order to increase this component's priority value.\n");
 125             }
 126         }
 127     }
 128     else {
 129         if ( mca_sharedfp_individual_verbose ) {
 130             opal_output(ompi_sharedfp_base_framework.framework_output,
 131                  "mca_sharedfp_individual_component_file_query: "
 132                  "OMPIO_SHAREDFP_RELAXED_ORDERING MPI_Info key not set, "
 133                  "got MPI_INFO_NULL. Set this key in order to increase "
 134                  "this component's priority value.\n");
 135         }
 136     }
 137 
 138     /*For now, this algorithm will not run if the file is not opened write only.
 139      *Setting the OMPIO_SHAREDFP_RELAXED_ORDERING gives this module a higher priority
 140      *otherwise it gets a priority of zero. This means that this module will
 141      *run only if no other module can run
 142      */
 143     if ( wronly_flag && relaxed_order_flag){
 144         *priority=mca_sharedfp_individual_priority;
 145     }
 146     else {
 147         *priority=1;
 148     }
 149 
 150     if ( wronly_flag ){
 151         return &individual;
 152     }
 153 
 154     return NULL;
 155 }
 156 
 157 int mca_sharedfp_individual_component_file_unquery (ompio_file_t *file)
 158 {
 159    /* This function might be needed for some purposes later. for now it
 160     * does not have anything to do since there are no steps which need
 161     * to be undone if this module is not selected */
 162 
 163    return OMPI_SUCCESS;
 164 }
 165 
 166 int mca_sharedfp_individual_module_init (ompio_file_t *file)
 167 {
 168     return OMPI_SUCCESS;
 169 }
 170 
 171 
 172 int mca_sharedfp_individual_module_finalize (ompio_file_t *file)
 173 {
 174     return OMPI_SUCCESS;
 175 }

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