-: 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:75 -: 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; -: 50: -: 51: MPIU_THREAD_CS_ENTER(ALLFUNC,); 88718: 52: MPIR_Nest_incr(); -: 53: 88718: 54: fh = MPIO_File_resolve(mpi_fh); -: 55: |
-: 56: /* --BEGIN ERROR HANDLING-- */ 88718: 57: MPIO_CHECK_FILE_HANDLE(fh, myname, error_code); 88718: 58: MPIO_CHECK_COUNT(fh, count, myname, error_code); 88718: 59: MPIO_CHECK_DATATYPE(fh, datatype, myname, error_code); -: 60: /* --END ERROR HANDLING-- */ -: 61: |
88718: 62: MPI_Type_size(datatype, &datatype_size); -: 63: |
-: 64: /* --BEGIN ERROR HANDLING-- */ 88718: 65: MPIO_CHECK_COUNT_SIZE(fh, count, datatype_size, myname, error_code); -: 66: /* --END ERROR HANDLING-- */ -: 67: |
88718: 68: if (count*datatype_size == 0) -: 69: { -: 70:#ifdef HAVE_STATUS_SET_BYTES 4: 71: MPIR_Status_set_bytes(status, datatype, 0); -: 72:#endif 4: 73: error_code = MPI_SUCCESS; 4: 74: goto fn_exit; -: 75: } -: 76: |
-: 77: /* --BEGIN ERROR HANDLING-- */ 88714: 78: MPIO_CHECK_INTEGRAL_ETYPE(fh, count, datatype_size, myname, error_code); 88714: 79: MPIO_CHECK_READABLE(fh, myname, error_code); 88714: 80: MPIO_CHECK_FS_SUPPORTS_SHARED(fh, myname, error_code); -: 81: /* --END ERROR HANDLING-- */ -: 82: |
88714: 83: ADIOI_Datatype_iscontig(datatype, &buftype_is_contig); 88714: 84: ADIOI_Datatype_iscontig(fh->filetype, &filetype_is_contig); -: 85: 88714: 86: ADIOI_TEST_DEFERRED(fh, myname, &error_code); -: 87: 88714: 88: incr = (count*datatype_size)/fh->etype_size; -: 89: 88714: 90: ADIO_Get_shared_fp(fh, incr, &shared_fp, &error_code); |
-: 91: /* --BEGIN ERROR HANDLING-- */ 88714: 92: if (error_code != MPI_SUCCESS) -: 93: { #####: 94: error_code = MPIO_Err_return_file(fh, error_code); #####: 95: goto fn_exit; -: 96: } -: 97: /* --END ERROR HANDLING-- */ -: 98: -: 99: /* contiguous or strided? */ |
88714: 100: if (buftype_is_contig && filetype_is_contig) -: 101: { -: 102: /* convert count and shared_fp to bytes */ 88714: 103: bufsize = datatype_size * count; 88714: 104: off = fh->disp + fh->etype_size * shared_fp; -: 105: -: 106: /* if atomic mode requested, lock (exclusive) the region, because there -: 107: could be a concurrent noncontiguous request. On NFS, locking -: 108: is done in the ADIO_ReadContig.*/ -: 109: 88714: 110: if ((fh->atomicity) && (fh->file_system != ADIO_NFS)) |
#####: 111: ADIOI_WRITE_LOCK(fh, off, SEEK_SET, bufsize); -: 112: |
88714: 113: ADIO_ReadContig(fh, buf, count, datatype, ADIO_EXPLICIT_OFFSET, -: 114: off, status, &error_code); -: 115: 88714: 116: if ((fh->atomicity) && (fh->file_system != ADIO_NFS)) |
#####: 117: ADIOI_UNLOCK(fh, off, SEEK_SET, bufsize); -: 118: } -: 119: else -: 120: { #####: 121: ADIO_ReadStrided(fh, buf, count, datatype, ADIO_EXPLICIT_OFFSET, -: 122: shared_fp, status, &error_code); -: 123: /* For strided and atomic mode, locking is done in ADIO_ReadStrided */ -: 124: } -: 125: |
-: 126: /* --BEGIN ERROR HANDLING-- */ 88714: 127: if (error_code != MPI_SUCCESS) #####: 128: error_code = MPIO_Err_return_file(fh, error_code); -: 129: /* --END ERROR HANDLING-- */ -: 130: |
88718: 131:fn_exit: 88718: 132: MPIR_Nest_decr(); -: 133: MPIU_THREAD_CS_EXIT(ALLFUNC,); -: 134: 88718: 135: return error_code; -: 136:} |