00001 
00002 
00003 
00004 
00005 
00006 
00007 #include "mpioimpl.h"
00008 
00009 #ifdef HAVE_WEAK_SYMBOLS
00010 
00011 #if defined(HAVE_PRAGMA_WEAK)
00012 #pragma weak MPI_File_read_all = PMPI_File_read_all
00013 #elif defined(HAVE_PRAGMA_HP_SEC_DEF)
00014 #pragma _HP_SECONDARY_DEF PMPI_File_read_all MPI_File_read_all
00015 #elif defined(HAVE_PRAGMA_CRI_DUP)
00016 #pragma _CRI duplicate MPI_File_read_all as PMPI_File_read_all
00017 
00018 #endif
00019 
00020 
00021 #define MPIO_BUILD_PROFILING
00022 #include "mpioprof.h"
00023 #endif
00024 
00025 
00026 
00027 
00028 
00029 
00030 
00031 
00032 
00033 
00034 
00035 
00036 
00037 
00038 
00039 
00040 
00041 int MPI_File_read_all(MPI_File mpi_fh, void *buf, int count, 
00042                       MPI_Datatype datatype, MPI_Status *status)
00043 {
00044     int error_code;
00045     static char myname[] = "MPI_FILE_READ_ALL";
00046 #ifdef MPI_hpux
00047     int fl_xmpi;
00048 
00049     HPMP_IO_START(fl_xmpi, BLKMPIFILEREADALL, TRDTBLOCK, fh, datatype, count);
00050 #endif 
00051 
00052     error_code = MPIOI_File_read_all(mpi_fh, (MPI_Offset) 0,
00053                      ADIO_INDIVIDUAL, buf,
00054                      count, datatype, myname, status);
00055 
00056 #ifdef MPI_hpux
00057     HPMP_IO_END(fl_xmpi, fh, datatype, count);
00058 #endif 
00059 
00060     return error_code;
00061 }
00062 
00063 
00064 
00065 
00066 int MPIOI_File_read_all(MPI_File mpi_fh,
00067             MPI_Offset offset,
00068             int file_ptr_type,
00069             void *buf,
00070             int count,
00071             MPI_Datatype datatype,
00072             char *myname,
00073             MPI_Status *status)
00074 {
00075     int error_code, datatype_size;
00076     ADIO_File fh;
00077 
00078     MPIU_THREAD_CS_ENTER(ALLFUNC,);
00079 
00080     fh = MPIO_File_resolve(mpi_fh);
00081 
00082     
00083     MPIO_CHECK_FILE_HANDLE(fh, myname, error_code);
00084     MPIO_CHECK_COUNT(fh, count, myname, error_code);
00085     MPIO_CHECK_DATATYPE(fh, datatype, myname, error_code);
00086 
00087     if (file_ptr_type == ADIO_EXPLICIT_OFFSET && offset < 0)
00088     {
00089     error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE,
00090                       myname, __LINE__, MPI_ERR_ARG,
00091                       "**iobadoffset", 0);
00092     error_code = MPIO_Err_return_file(fh, error_code);
00093     goto fn_exit;
00094     }
00095     
00096 
00097     MPI_Type_size(datatype, &datatype_size);
00098 
00099     
00100     MPIO_CHECK_INTEGRAL_ETYPE(fh, count, datatype_size, myname, error_code);
00101     MPIO_CHECK_READABLE(fh, myname, error_code);
00102     MPIO_CHECK_NOT_SEQUENTIAL_MODE(fh, myname, error_code);
00103     MPIO_CHECK_COUNT_SIZE(fh, count, datatype_size, myname, error_code);
00104     
00105 
00106     ADIO_ReadStridedColl(fh, buf, count, datatype, file_ptr_type,
00107              offset, status, &error_code);
00108 
00109     
00110     if (error_code != MPI_SUCCESS)
00111     error_code = MPIO_Err_return_file(fh, error_code);
00112     
00113 
00114 fn_exit:
00115     MPIU_THREAD_CS_EXIT(ALLFUNC,);
00116 
00117     return error_code;
00118 }
00119