-: 0:Source:/home/MPI/testing/mpich2/mpich2/src/mpi/romio/mpi-io/read_sh.c
-: 0:Graph:read_sh.gcno
-: 0:Data:read_sh.gcda
-: 0:Runs:529
-: 0:Programs:141
-: 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_read_shared = PMPI_File_read_shared
-: 14:#elif defined(HAVE_PRAGMA_HP_SEC_DEF)
-: 15:#pragma _HP_SECONDARY_DEF PMPI_File_read_shared MPI_File_read_shared
-: 16:#elif defined(HAVE_PRAGMA_CRI_DUP)
-: 17:#pragma _CRI duplicate MPI_File_read_shared as PMPI_File_read_shared
-: 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:/* status object not filled currently */
-: 27:
-: 28:/*@
-: 29: MPI_File_read_shared - Read using shared file pointer
-: 30:
-: 31:Input Parameters:
-: 32:. fh - file handle (handle)
-: 33:. count - number of elements in buffer (nonnegative integer)
-: 34:. datatype - datatype of each buffer element (handle)
-: 35:
-: 36:Output Parameters:
-: 37:. buf - initial address of buffer (choice)
-: 38:. status - status object (Status)
-: 39:
-: 40:.N fortran
-: 41:@*/
-: 42:int MPI_File_read_shared(MPI_File mpi_fh, void *buf, int count,
-: 43: MPI_Datatype datatype, MPI_Status *status)
88718: 44:{
-: 45: int error_code, bufsize, buftype_is_contig, filetype_is_contig;
-: 46: static char myname[] = "MPI_FILE_READ_SHARED";
-: 47: int datatype_size, incr;
-: 48: ADIO_Offset off, shared_fp;
-: 49: ADIO_File fh;
88718: 50: MPIU_THREADPRIV_DECL;
-: 51:
88718: 52: MPIU_THREAD_CS_ENTER(ALLFUNC,);
88718: 53: MPIR_Nest_incr();
-: 54:
88718: 55: fh = MPIO_File_resolve(mpi_fh);
-: 56:
|
-: 57: /* --BEGIN ERROR HANDLING-- */
88718: 58: MPIO_CHECK_FILE_HANDLE(fh, myname, error_code);
88718: 59: MPIO_CHECK_COUNT(fh, count, myname, error_code);
88718: 60: MPIO_CHECK_DATATYPE(fh, datatype, myname, error_code);
-: 61: /* --END ERROR HANDLING-- */
-: 62:
|
88718: 63: MPI_Type_size(datatype, &datatype_size);
-: 64:
|
-: 65: /* --BEGIN ERROR HANDLING-- */
88718: 66: MPIO_CHECK_COUNT_SIZE(fh, count, datatype_size, myname, error_code);
-: 67: /* --END ERROR HANDLING-- */
-: 68:
|
88718: 69: if (count*datatype_size == 0)
-: 70: {
-: 71:#ifdef HAVE_STATUS_SET_BYTES
4: 72: MPIR_Status_set_bytes(status, datatype, 0);
-: 73:#endif
4: 74: error_code = MPI_SUCCESS;
4: 75: goto fn_exit;
-: 76: }
-: 77:
|
-: 78: /* --BEGIN ERROR HANDLING-- */
88714: 79: MPIO_CHECK_INTEGRAL_ETYPE(fh, count, datatype_size, myname, error_code);
88714: 80: MPIO_CHECK_READABLE(fh, myname, error_code);
88714: 81: MPIO_CHECK_FS_SUPPORTS_SHARED(fh, myname, error_code);
-: 82: /* --END ERROR HANDLING-- */
-: 83:
|
88714: 84: ADIOI_Datatype_iscontig(datatype, &buftype_is_contig);
88714: 85: ADIOI_Datatype_iscontig(fh->filetype, &filetype_is_contig);
-: 86:
88714: 87: ADIOI_TEST_DEFERRED(fh, myname, &error_code);
-: 88:
88714: 89: incr = (count*datatype_size)/fh->etype_size;
-: 90:
88714: 91: ADIO_Get_shared_fp(fh, incr, &shared_fp, &error_code);
|
-: 92: /* --BEGIN ERROR HANDLING-- */
88714: 93: if (error_code != MPI_SUCCESS)
-: 94: {
#####: 95: error_code = MPIO_Err_return_file(fh, error_code);
#####: 96: goto fn_exit;
-: 97: }
-: 98: /* --END ERROR HANDLING-- */
-: 99:
-: 100: /* contiguous or strided? */
|
88714: 101: if (buftype_is_contig && filetype_is_contig)
-: 102: {
-: 103: /* convert count and shared_fp to bytes */
88714: 104: bufsize = datatype_size * count;
88714: 105: off = fh->disp + fh->etype_size * shared_fp;
-: 106:
-: 107: /* if atomic mode requested, lock (exclusive) the region, because there
-: 108: could be a concurrent noncontiguous request. On NFS, locking
-: 109: is done in the ADIO_ReadContig.*/
-: 110:
88714: 111: if ((fh->atomicity) && (fh->file_system != ADIO_NFS))
|
#####: 112: ADIOI_WRITE_LOCK(fh, off, SEEK_SET, bufsize);
-: 113:
|
88714: 114: ADIO_ReadContig(fh, buf, count, datatype, ADIO_EXPLICIT_OFFSET,
-: 115: off, status, &error_code);
-: 116:
88714: 117: if ((fh->atomicity) && (fh->file_system != ADIO_NFS))
|
#####: 118: ADIOI_UNLOCK(fh, off, SEEK_SET, bufsize);
-: 119: }
-: 120: else
-: 121: {
#####: 122: ADIO_ReadStrided(fh, buf, count, datatype, ADIO_EXPLICIT_OFFSET,
-: 123: shared_fp, status, &error_code);
-: 124: /* For strided and atomic mode, locking is done in ADIO_ReadStrided */
-: 125: }
-: 126:
|
-: 127: /* --BEGIN ERROR HANDLING-- */
88714: 128: if (error_code != MPI_SUCCESS)
#####: 129: error_code = MPIO_Err_return_file(fh, error_code);
-: 130: /* --END ERROR HANDLING-- */
-: 131:
|
88718: 132:fn_exit:
88718: 133: MPIR_Nest_decr();
88718: 134: MPIU_THREAD_CS_EXIT(ALLFUNC,);
-: 135:
88718: 136: return error_code;
-: 137:}
|