00001
00002
00003
00004
00005
00006
00007
00008 #include "mpioimpl.h"
00009
00010 #ifdef HAVE_WEAK_SYMBOLS
00011
00012 #if defined(HAVE_PRAGMA_WEAK)
00013 #pragma weak MPI_File_iread_shared = PMPI_File_iread_shared
00014 #elif defined(HAVE_PRAGMA_HP_SEC_DEF)
00015 #pragma _HP_SECONDARY_DEF PMPI_File_iread_shared MPI_File_iread_shared
00016 #elif defined(HAVE_PRAGMA_CRI_DUP)
00017 #pragma _CRI duplicate MPI_File_iread_shared as PMPI_File_iread_shared
00018
00019 #endif
00020
00021
00022 #define MPIO_BUILD_PROFILING
00023 #include "mpioprof.h"
00024 #endif
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040 #ifdef HAVE_MPI_GREQUEST
00041 #include "mpiu_greq.h"
00042
00043
00044 int MPI_File_iread_shared(MPI_File mpi_fh, void *buf, int count,
00045 MPI_Datatype datatype, MPI_Request *request)
00046 {
00047 int error_code, bufsize, buftype_is_contig, filetype_is_contig;
00048 ADIO_File fh;
00049 static char myname[] = "MPI_FILE_IREAD_SHARED";
00050 int datatype_size, incr;
00051 MPI_Status status;
00052 ADIO_Offset off, shared_fp;
00053 MPI_Offset nbytes=0;
00054
00055 MPIU_THREAD_CS_ENTER(ALLFUNC,);
00056
00057 fh = MPIO_File_resolve(mpi_fh);
00058
00059
00060 MPIO_CHECK_FILE_HANDLE(fh, myname, error_code);
00061 MPIO_CHECK_COUNT(fh, count, myname, error_code);
00062 MPIO_CHECK_DATATYPE(fh, datatype, myname, error_code);
00063
00064
00065 MPI_Type_size(datatype, &datatype_size);
00066
00067
00068 MPIO_CHECK_INTEGRAL_ETYPE(fh, count, datatype_size, myname, error_code);
00069 MPIO_CHECK_FS_SUPPORTS_SHARED(fh, myname, error_code);
00070 MPIO_CHECK_COUNT_SIZE(fh, count, datatype_size, myname, error_code);
00071
00072
00073 ADIOI_Datatype_iscontig(datatype, &buftype_is_contig);
00074 ADIOI_Datatype_iscontig(fh->filetype, &filetype_is_contig);
00075
00076 ADIOI_TEST_DEFERRED(fh, myname, &error_code);
00077
00078 incr = (count*datatype_size)/fh->etype_size;
00079 ADIO_Get_shared_fp(fh, incr, &shared_fp, &error_code);
00080
00081
00082 if (error_code != MPI_SUCCESS)
00083 {
00084
00085 MPIO_Err_return_file(fh, error_code);
00086 }
00087
00088
00089 if (buftype_is_contig && filetype_is_contig)
00090 {
00091
00092 bufsize = datatype_size * count;
00093 off = fh->disp + fh->etype_size * shared_fp;
00094 if (!(fh->atomicity))
00095 {
00096 ADIO_IreadContig(fh, buf, count, datatype, ADIO_EXPLICIT_OFFSET,
00097 off, request, &error_code);
00098 }
00099 else
00100 {
00101
00102
00103
00104 if (fh->file_system != ADIO_NFS)
00105 {
00106 ADIOI_WRITE_LOCK(fh, off, SEEK_SET, bufsize);
00107 }
00108
00109 ADIO_ReadContig(fh, buf, count, datatype, ADIO_EXPLICIT_OFFSET,
00110 off, &status, &error_code);
00111
00112 if (fh->file_system != ADIO_NFS)
00113 {
00114 ADIOI_UNLOCK(fh, off, SEEK_SET, bufsize);
00115 }
00116 if (error_code == MPI_SUCCESS){
00117 nbytes = count * datatype_size;
00118 }
00119 MPIO_Completed_request_create(&fh, nbytes, &error_code, request);
00120 }
00121 }
00122 else
00123 {
00124 ADIO_IreadStrided(fh, buf, count, datatype, ADIO_EXPLICIT_OFFSET,
00125 shared_fp, request, &error_code);
00126 }
00127
00128
00129 if (error_code != MPI_SUCCESS)
00130 error_code = MPIO_Err_return_file(fh, error_code);
00131
00132
00133 fn_exit:
00134 MPIU_THREAD_CS_EXIT(ALLFUNC,);
00135 return error_code;
00136 }
00137 #endif