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

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

DEFINITIONS

This source file includes following definitions.
  1. MPI_File_write_all
  2. MPIOI_File_write_all

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

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