root/ompi/mca/io/romio321/src/io_romio321_module.c

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

DEFINITIONS

This source file includes following definitions.
  1. MPIR_Status_set_bytes
  2. ADIOI_Datatype_iscontig

   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-2008 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) 2008      Sun Microsystems, Inc.  All rights reserved.
  13  * Copyright (c) 2008      Cisco Systems, Inc.  All rights reserved.
  14  * Copyright (c) 2017      IBM Corporation.  All rights reserved.
  15  * Copyright (c) 2017      Research Organization for Information Science
  16  *                         and Technology (RIST). All rights reserved.
  17  * $COPYRIGHT$
  18  *
  19  * Additional copyrights may follow
  20  *
  21  * $HEADER$
  22  */
  23 #include "ompi_config.h"
  24 
  25 #include "mpi.h"
  26 #include "ompi/datatype/ompi_datatype.h"
  27 #include "ompi/mca/io/io.h"
  28 #include "io_romio321.h"
  29 
  30 
  31 /*
  32  * Global functions that do not need to be prototyped in a header
  33  * because ROMIO just expects these functions to exist.
  34  */
  35 int MPIR_Status_set_bytes(ompi_status_public_t *status,
  36                           struct ompi_datatype_t *datatype, int size);
  37 void ADIOI_Datatype_iscontig(MPI_Datatype datatype, int *flag);
  38 
  39 
  40 /*
  41  * The ROMIO module operations
  42  */
  43 mca_io_base_module_2_0_0_t mca_io_romio321_module = {
  44     /* Back end to MPI API calls (pretty much a 1-to-1 mapping) */
  45 
  46     mca_io_romio321_file_open,
  47     mca_io_romio321_file_close,
  48 
  49     mca_io_romio321_file_set_size,
  50     mca_io_romio321_file_preallocate,
  51     mca_io_romio321_file_get_size,
  52     mca_io_romio321_file_get_amode,
  53     mca_io_romio321_file_set_view,
  54     mca_io_romio321_file_get_view,
  55 
  56     /* Index IO operations */
  57     mca_io_romio321_file_read_at,
  58     mca_io_romio321_file_read_at_all,
  59     mca_io_romio321_file_write_at,
  60     mca_io_romio321_file_write_at_all,
  61     mca_io_romio321_file_iread_at,
  62     mca_io_romio321_file_iwrite_at,
  63     mca_io_romio321_file_iread_at_all,
  64     mca_io_romio321_file_iwrite_at_all,
  65 
  66     /* non-indexed IO operations */
  67     mca_io_romio321_file_read,
  68     mca_io_romio321_file_read_all,
  69     mca_io_romio321_file_write,
  70     mca_io_romio321_file_write_all,
  71     mca_io_romio321_file_iread,
  72     mca_io_romio321_file_iwrite,
  73     mca_io_romio321_file_iread_all,
  74     mca_io_romio321_file_iwrite_all,
  75 
  76     mca_io_romio321_file_seek,
  77     mca_io_romio321_file_get_position,
  78     mca_io_romio321_file_get_byte_offset,
  79 
  80     mca_io_romio321_file_read_shared,
  81     mca_io_romio321_file_write_shared,
  82     mca_io_romio321_file_iread_shared,
  83     mca_io_romio321_file_iwrite_shared,
  84     mca_io_romio321_file_read_ordered,
  85     mca_io_romio321_file_write_ordered,
  86     mca_io_romio321_file_seek_shared,
  87     mca_io_romio321_file_get_position_shared,
  88 
  89     /* Split IO operations */
  90     mca_io_romio321_file_read_at_all_begin,
  91     mca_io_romio321_file_read_at_all_end,
  92     mca_io_romio321_file_write_at_all_begin,
  93     mca_io_romio321_file_write_at_all_end,
  94     mca_io_romio321_file_read_all_begin,
  95     mca_io_romio321_file_read_all_end,
  96     mca_io_romio321_file_write_all_begin,
  97     mca_io_romio321_file_write_all_end,
  98     mca_io_romio321_file_read_ordered_begin,
  99     mca_io_romio321_file_read_ordered_end,
 100     mca_io_romio321_file_write_ordered_begin,
 101     mca_io_romio321_file_write_ordered_end,
 102 
 103     mca_io_romio321_file_get_type_extent,
 104 
 105     /* Sync/atomic IO operations */
 106     mca_io_romio321_file_set_atomicity,
 107     mca_io_romio321_file_get_atomicity,
 108     mca_io_romio321_file_sync
 109 };
 110 
 111 
 112 /*
 113  * This function is required by ROMIO to set information on an Open
 114  * MPI status.  Conveniently, it maps directly to
 115  * MPI_Status_set_elements (almost like they planned that... hmmm...).
 116  */
 117 int MPIR_Status_set_bytes(ompi_status_public_t *status,
 118                           struct ompi_datatype_t *datatype, int nbytes)
 119 {
 120     /* Note that ROMIO is going to give a number of *bytes* here, but
 121        MPI_STATUS_SET_ELEMENTS requires a number of *elements*.  So
 122        rather than try to do a conversion up here, just set the number
 123        of bytes with MPI_CHAR as the datatype.  If someone does a
 124        GET_STATUS later, they have to supply their own datatype, and
 125        we do the right calculations there.  This prevents roundoff
 126        errors here, potentially "losing" bytes in the process. */
 127 
 128     MPI_Status_set_elements(status, MPI_CHAR, nbytes);
 129     return MPI_SUCCESS;
 130 }
 131 
 132 
 133 void ADIOI_Datatype_iscontig(MPI_Datatype datatype, int *flag)
 134 {
 135     /*
 136      * Open MPI contiguous check return true for datatype with
 137      * gaps in the beginning and at the end. We have to provide
 138      * a count of 2 in order to get these gaps taken into acount.
 139      * In addition, if the data is contiguous but true_lb differes
 140      * from zero, ROMIO will ignore the displacement. Thus, lie!
 141      */
 142     *flag = ompi_datatype_is_contiguous_memory_layout(datatype, 2);
 143     if (*flag) {
 144         MPI_Aint true_extent, true_lb;
 145 
 146         ompi_datatype_get_true_extent(datatype, &true_lb, &true_extent);
 147 
 148         if (true_lb > 0)
 149             *flag = 0;
 150     }
 151 }

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