-: 0:Source:/home/MPI/testing/mpich2/mpich2/src/mpi/romio/mpi-io/iwrite.c
-: 0:Graph:iwrite.gcno
-: 0:Data:iwrite.gcda
-: 0:Runs:529
-: 0:Programs:142
-: 1:/* -*- Mode: C; c-basic-offset:4 ; -*- */
-: 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_iwrite = PMPI_File_iwrite
-: 14:#elif defined(HAVE_PRAGMA_HP_SEC_DEF)
-: 15:#pragma _HP_SECONDARY_DEF PMPI_File_iwrite MPI_File_iwrite
-: 16:#elif defined(HAVE_PRAGMA_CRI_DUP)
-: 17:#pragma _CRI duplicate MPI_File_iwrite as PMPI_File_iwrite
-: 18:/* end of weak pragmas */
-: 19:#endif
-: 20:
-: 21:/* Include mapping from MPI->PMPI */
-: 22:#define MPIO_BUILD_PROFILING
-: 23:#include "mpioprof.h"
-: 24:#endif
-: 25:
-: 26:/*@
-: 27: MPI_File_iwrite - Nonblocking write using individual file pointer
-: 28:
-: 29:Input Parameters:
-: 30:. fh - file handle (handle)
-: 31:. buf - initial address of buffer (choice)
-: 32:. count - number of elements in buffer (nonnegative integer)
-: 33:. datatype - datatype of each buffer element (handle)
-: 34:
-: 35:Output Parameters:
-: 36:. request - request object (handle)
-: 37:
-: 38:.N fortran
-: 39:@*/
-: 40:#ifdef HAVE_MPI_GREQUEST
-: 41:#include "mpiu_greq.h"
-: 42:#endif
-: 43:
-: 44:int MPI_File_iwrite(MPI_File mpi_fh, void *buf, int count,
-: 45: MPI_Datatype datatype, MPI_Request *request)
88768: 46:{
88768: 47: int error_code=MPI_SUCCESS;
-: 48: static char myname[] = "MPI_FILE_IWRITE";
88768: 49: MPIU_THREADPRIV_DECL;
-: 50:#ifdef MPI_hpux
-: 51: int fl_xmpi;
-: 52:
-: 53: HPMP_IO_START(fl_xmpi, BLKMPIFILEIWRITE, TRDTSYSTEM, mpi_fh, datatype,
-: 54: count);
-: 55:#endif /* MPI_hpux */
-: 56:
88768: 57: MPIU_THREAD_CS_ENTER(ALLFUNC,);
-: 58:
88768: 59: error_code = MPIOI_File_iwrite(mpi_fh, (MPI_Offset) 0, ADIO_INDIVIDUAL,
-: 60: buf, count, datatype, myname, request);
-: 61:
|
-: 62: /* --BEGIN ERROR HANDLING-- */
88768: 63: if (error_code != MPI_SUCCESS)
#####: 64: error_code = MPIO_Err_return_file(mpi_fh, error_code);
-: 65: /* --END ERROR HANDLING-- */
-: 66:
-: 67:#ifdef MPI_hpux
-: 68: HPMP_IO_END(fl_xmpi, mpi_fh, datatype, count);
-: 69:#endif /* MPI_hpux */
|
88768: 70: MPIU_THREAD_CS_EXIT(ALLFUNC,);
-: 71:
88768: 72: return error_code;
-: 73:}
-: 74:
-: 75:/* prevent multiple definitions of this routine */
-: 76:#ifdef MPIO_BUILD_PROFILING
-: 77:int MPIOI_File_iwrite(MPI_File mpi_fh,
-: 78: MPI_Offset offset,
-: 79: int file_ptr_type,
-: 80: void *buf,
-: 81: int count,
-: 82: MPI_Datatype datatype,
-: 83: char *myname,
-: 84: MPI_Request *request)
177488: 85:{
-: 86: int error_code, bufsize, buftype_is_contig, filetype_is_contig;
-: 87: int datatype_size;
-: 88: ADIO_Status status;
-: 89: ADIO_Offset off;
-: 90: ADIO_File fh;
177488: 91: MPI_Offset nbytes=0;
-: 92:
177488: 93: MPIR_Nest_incr();
-: 94:
177488: 95: fh = MPIO_File_resolve(mpi_fh);
-: 96:
|
-: 97: /* --BEGIN ERROR HANDLING-- */
177488: 98: MPIO_CHECK_FILE_HANDLE(fh, myname, error_code);
177488: 99: MPIO_CHECK_COUNT(fh, count, myname, error_code);
177488: 100: MPIO_CHECK_DATATYPE(fh, datatype, myname, error_code);
-: 101:
177488: 102: if (file_ptr_type == ADIO_EXPLICIT_OFFSET && offset < 0) {
#####: 103: error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE,
-: 104: myname, __LINE__, MPI_ERR_ARG,
-: 105: "**iobadoffset", 0);
#####: 106: error_code = MPIO_Err_return_file(fh, error_code);
#####: 107: goto fn_exit;
-: 108: }
-: 109: /* --END ERROR HANDLING-- */
-: 110:
|
177488: 111: MPI_Type_size(datatype, &datatype_size);
-: 112:
|
-: 113: /* --BEGIN ERROR HANDLING-- */
177488: 114: MPIO_CHECK_INTEGRAL_ETYPE(fh, count, datatype_size, myname, error_code);
177488: 115: MPIO_CHECK_WRITABLE(fh, myname, error_code);
177488: 116: MPIO_CHECK_NOT_SEQUENTIAL_MODE(fh, myname, error_code);
177488: 117: MPIO_CHECK_COUNT_SIZE(fh, count, datatype_size, myname, error_code);
-: 118: /* --END ERROR HANDLING-- */
-: 119:
|
177488: 120: ADIOI_Datatype_iscontig(datatype, &buftype_is_contig);
177488: 121: ADIOI_Datatype_iscontig(fh->filetype, &filetype_is_contig);
-: 122:
177488: 123: ADIOI_TEST_DEFERRED(fh, myname, &error_code);
-: 124:
177488: 125: if (buftype_is_contig && filetype_is_contig) {
-: 126: /* convert sizes to bytes */
177468: 127: bufsize = datatype_size * count;
177468: 128: if (file_ptr_type == ADIO_EXPLICIT_OFFSET) {
88712: 129: off = fh->disp + fh->etype_size * offset;
-: 130: }
-: 131: else {
88756: 132: off = fh->fp_ind;
-: 133: }
-: 134:
177468: 135: if (!(fh->atomicity)) {
177468: 136: ADIO_IwriteContig(fh, buf, count, datatype, file_ptr_type,
-: 137: off, request, &error_code);
-: 138: }
-: 139: else {
-: 140: /* to maintain strict atomicity semantics with other concurrent
-: 141: operations, lock (exclusive) and call blocking routine */
|
#####: 142: if (ADIO_Feature(fh, ADIO_LOCKS) )
-: 143: {
#####: 144: ADIOI_WRITE_LOCK(fh, off, SEEK_SET, bufsize);
-: 145: }
-: 146:
#####: 147: ADIO_WriteContig(fh, buf, count, datatype, file_ptr_type, off,
-: 148: &status, &error_code);
-: 149:
#####: 150: if (ADIO_Feature(fh, ADIO_LOCKS) )
-: 151: {
#####: 152: ADIOI_UNLOCK(fh, off, SEEK_SET, bufsize);
-: 153: }
#####: 154: if (error_code == MPI_SUCCESS) {
#####: 155: nbytes = count * datatype_size;
-: 156: }
-: 157:
#####: 158: MPIO_Completed_request_create(&fh, nbytes, &error_code, request);
-: 159: }
-: 160: }
-: 161: else {
|
20: 162: ADIO_IwriteStrided(fh, buf, count, datatype, file_ptr_type,
-: 163: offset, request, &error_code);
-: 164: }
177488: 165:fn_exit:
177488: 166: MPIR_Nest_decr();
-: 167:
177488: 168: return error_code;
-: 169:}
-: 170:#endif
|