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_read_ordered = PMPI_File_read_ordered
00014 #elif defined(HAVE_PRAGMA_HP_SEC_DEF)
00015 #pragma _HP_SECONDARY_DEF PMPI_File_read_ordered MPI_File_read_ordered
00016 #elif defined(HAVE_PRAGMA_CRI_DUP)
00017 #pragma _CRI duplicate MPI_File_read_ordered as PMPI_File_read_ordered
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
00041
00042 int MPI_File_read_ordered(MPI_File mpi_fh, void *buf, int count,
00043 MPI_Datatype datatype, MPI_Status *status)
00044 {
00045 int error_code, datatype_size, nprocs, myrank, incr;
00046 int source, dest;
00047 static char myname[] = "MPI_FILE_READ_ORDERED";
00048 ADIO_Offset shared_fp=0;
00049 ADIO_File fh;
00050
00051 MPIU_THREAD_CS_ENTER(ALLFUNC,);
00052
00053 fh = MPIO_File_resolve(mpi_fh);
00054
00055
00056 MPIO_CHECK_FILE_HANDLE(fh, myname, error_code);
00057 MPIO_CHECK_COUNT(fh, count, myname, error_code);
00058 MPIO_CHECK_DATATYPE(fh, datatype, myname, error_code);
00059
00060
00061 MPI_Type_size(datatype, &datatype_size);
00062
00063
00064 MPIO_CHECK_INTEGRAL_ETYPE(fh, count, datatype_size, myname, error_code);
00065 MPIO_CHECK_FS_SUPPORTS_SHARED(fh, myname, error_code);
00066 MPIO_CHECK_COUNT_SIZE(fh, count, datatype_size, myname, error_code);
00067
00068
00069 ADIOI_TEST_DEFERRED(fh, "MPI_File_read_ordered", &error_code);
00070
00071 MPI_Comm_size(fh->comm, &nprocs);
00072 MPI_Comm_rank(fh->comm, &myrank);
00073
00074 incr = (count*datatype_size)/fh->etype_size;
00075
00076
00077 source = myrank - 1;
00078 dest = myrank + 1;
00079 if (source < 0) source = MPI_PROC_NULL;
00080 if (dest >= nprocs) dest = MPI_PROC_NULL;
00081 MPI_Recv(NULL, 0, MPI_BYTE, source, 0, fh->comm, MPI_STATUS_IGNORE);
00082
00083 ADIO_Get_shared_fp(fh, incr, &shared_fp, &error_code);
00084
00085 if (error_code != MPI_SUCCESS) {
00086 error_code = MPIO_Err_return_file(fh, error_code);
00087 goto fn_exit;
00088 }
00089
00090
00091 MPI_Send(NULL, 0, MPI_BYTE, dest, 0, fh->comm);
00092
00093 ADIO_ReadStridedColl(fh, buf, count, datatype, ADIO_EXPLICIT_OFFSET,
00094 shared_fp, status, &error_code);
00095
00096
00097 if (error_code != MPI_SUCCESS)
00098 error_code = MPIO_Err_return_file(fh, error_code);
00099
00100
00101 fn_exit:
00102 MPIU_THREAD_CS_EXIT(ALLFUNC,);
00103
00104
00105 return error_code;
00106 }