root/ompi/mca/io/romio321/romio/mpi-io/write_allb.c

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

DEFINITIONS

This source file includes following definitions.
  1. MPI_File_write_all_begin
  2. MPIOI_File_write_all_begin

   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 "mpioimpl.h"
   9 
  10 #ifdef HAVE_WEAK_SYMBOLS
  11 
  12 #if defined(HAVE_PRAGMA_WEAK)
  13 #pragma weak MPI_File_write_all_begin = PMPI_File_write_all_begin
  14 #elif defined(HAVE_PRAGMA_HP_SEC_DEF)
  15 #pragma _HP_SECONDARY_DEF PMPI_File_write_all_begin MPI_File_write_all_begin
  16 #elif defined(HAVE_PRAGMA_CRI_DUP)
  17 #pragma _CRI duplicate MPI_File_write_all_begin as PMPI_File_write_all_begin
  18 /* end of weak pragmas */
  19 #elif defined(HAVE_WEAK_ATTRIBUTE)
  20 int MPI_File_write_all_begin(MPI_File fh, const void *buf, int count, MPI_Datatype datatype)
  21     __attribute__((weak,alias("PMPI_File_write_all_begin")));
  22 #endif
  23 
  24 /* Include mapping from MPI->PMPI */
  25 #define MPIO_BUILD_PROFILING
  26 #include "mpioprof.h"
  27 #endif
  28 
  29 /*@
  30     MPI_File_write_all_begin - Begin a split collective write using
  31     individual file pointer
  32 
  33 Input Parameters:
  34 . fh - file handle (handle)
  35 . buf - initial address of buffer (choice)
  36 . count - number of elements in buffer (nonnegative integer)
  37 . datatype - datatype of each buffer element (handle)
  38 
  39 .N fortran
  40 @*/
  41 int MPI_File_write_all_begin(MPI_File fh, ROMIO_CONST void *buf, int count,
  42                              MPI_Datatype datatype)
  43 {
  44     int error_code;
  45     static char myname[] = "MPI_FILE_WRITE_ALL_BEGIN";
  46 
  47     error_code = MPIOI_File_write_all_begin(fh, (MPI_Offset) 0,
  48                                             ADIO_INDIVIDUAL, buf, count,
  49                                             datatype, myname);
  50 
  51     return error_code;
  52 }
  53 
  54 /* prevent multiple definitions of this routine */
  55 #ifdef MPIO_BUILD_PROFILING
  56 int MPIOI_File_write_all_begin(MPI_File fh,
  57                                MPI_Offset offset,
  58                                int file_ptr_type,
  59                                const void *buf,
  60                                int count,
  61                                MPI_Datatype datatype,
  62                                char *myname)
  63 {
  64     int error_code;
  65     MPI_Count datatype_size;
  66     ADIO_File adio_fh;
  67     void *e32buf=NULL;
  68     const void *xbuf=NULL;
  69 
  70     ROMIO_THREAD_CS_ENTER();
  71 
  72     adio_fh = MPIO_File_resolve(fh);
  73 
  74     /* --BEGIN ERROR HANDLING-- */
  75     MPIO_CHECK_FILE_HANDLE(adio_fh, myname, error_code);
  76     MPIO_CHECK_COUNT(adio_fh, count, myname, error_code);
  77     MPIO_CHECK_DATATYPE(adio_fh, datatype, myname, error_code);
  78     MPIO_CHECK_NOT_SEQUENTIAL_MODE(adio_fh, myname, error_code);
  79 
  80     if (file_ptr_type == ADIO_EXPLICIT_OFFSET && offset < 0)
  81     {
  82         error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE,
  83                                           myname, __LINE__, MPI_ERR_ARG,
  84                                           "**iobadoffset", 0);
  85         error_code = MPIO_Err_return_file(adio_fh, error_code);
  86         goto fn_exit;
  87     }
  88 
  89     if (adio_fh->split_coll_count)
  90     {
  91         error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE,
  92                                           myname, __LINE__, MPI_ERR_IO, 
  93                                           "**iosplitcoll", 0);
  94         error_code = MPIO_Err_return_file(adio_fh, error_code);
  95         goto fn_exit;
  96     }
  97     /* --END ERROR HANDLING-- */
  98 
  99     adio_fh->split_coll_count = 1;
 100 
 101     MPI_Type_size_x(datatype, &datatype_size);
 102     /* --BEGIN ERROR HANDLING-- */
 103     MPIO_CHECK_INTEGRAL_ETYPE(adio_fh, count, datatype_size, myname, error_code);
 104     MPIO_CHECK_COUNT_SIZE(adio_fh, count, datatype_size, myname, error_code);
 105     /* --END ERROR HANDLING-- */
 106 
 107 
 108     xbuf = buf;
 109     if (adio_fh->is_external32) {
 110         error_code = MPIU_external32_buffer_setup(buf, count, datatype, &e32buf);
 111         if (error_code != MPI_SUCCESS) 
 112             goto fn_exit;
 113 
 114         xbuf = e32buf;
 115     }
 116 
 117     adio_fh->split_datatype = datatype;
 118     ADIO_WriteStridedColl(adio_fh, xbuf, count, datatype, file_ptr_type,
 119                           offset, &adio_fh->split_status, &error_code);
 120 
 121     /* --BEGIN ERROR HANDLING-- */
 122     if (error_code != MPI_SUCCESS)
 123         error_code = MPIO_Err_return_file(adio_fh, error_code);
 124     /* --END ERROR HANDLING-- */
 125 
 126 fn_exit:
 127     if ( e32buf != NULL) ADIOI_Free(e32buf);
 128     ROMIO_THREAD_CS_EXIT();
 129 
 130     return error_code;
 131 }
 132 #endif

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