00001
00002
00003
00004
00005
00006
00007
00008
00009 #include "mpioimpl.h"
00010
00011 #ifdef HAVE_WEAK_SYMBOLS
00012
00013 #if defined(HAVE_PRAGMA_WEAK)
00014 #pragma weak MPI_File_read_at_all_begin = PMPI_File_read_at_all_begin
00015 #elif defined(HAVE_PRAGMA_HP_SEC_DEF)
00016 #pragma _HP_SECONDARY_DEF PMPI_File_read_at_all_begin MPI_File_read_at_all_begin
00017 #elif defined(HAVE_PRAGMA_CRI_DUP)
00018 #pragma _CRI duplicate MPI_File_read_at_all_begin as PMPI_File_read_at_all_begin
00019
00020 #endif
00021
00022
00023 #define MPIO_BUILD_PROFILING
00024 #include "mpioprof.h"
00025 #endif
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041 int MPI_File_read_at_all_begin(MPI_File fh, MPI_Offset offset, void *buf,
00042 int count, MPI_Datatype datatype)
00043 {
00044 int error_code, datatype_size;
00045 #ifndef PRINT_ERR_MSG
00046 static char myname[] = "MPI_FILE_READ_AT_ALL_BEGIN";
00047 #endif
00048 MPI_Status status;
00049
00050 #ifdef PRINT_ERR_MSG
00051 if ((fh <= (MPI_File) 0) || (fh->cookie != ADIOI_FILE_COOKIE)) {
00052 FPRINTF(stderr, "MPI_File_read_at_all_begin: Invalid file handle\n");
00053 MPI_Abort(MPI_COMM_WORLD, 1);
00054 }
00055 #else
00056 ADIOI_TEST_FILE_HANDLE(fh, myname);
00057 #endif
00058
00059 if (offset < 0) {
00060 #ifdef PRINT_ERR_MSG
00061 FPRINTF(stderr, "MPI_File_read_at_all_begin: Invalid offset argument\n");
00062 MPI_Abort(MPI_COMM_WORLD, 1);
00063 #else
00064 error_code = MPIR_Err_setmsg(MPI_ERR_ARG, MPIR_ERR_OFFSET_ARG,
00065 myname, (char *) 0, (char *) 0);
00066 return ADIOI_Error(fh, error_code, myname);
00067 #endif
00068 }
00069
00070 if (count < 0) {
00071 #ifdef PRINT_ERR_MSG
00072 FPRINTF(stderr, "MPI_File_read_at_all_begin: Invalid count argument\n");
00073 MPI_Abort(MPI_COMM_WORLD, 1);
00074 #else
00075 error_code = MPIR_Err_setmsg(MPI_ERR_ARG, MPIR_ERR_COUNT_ARG,
00076 myname, (char *) 0, (char *) 0);
00077 return ADIOI_Error(fh, error_code, myname);
00078 #endif
00079 }
00080
00081 if (datatype == MPI_DATATYPE_NULL) {
00082 #ifdef PRINT_ERR_MSG
00083 FPRINTF(stderr, "MPI_File_read_at_all_begin: Invalid datatype\n");
00084 MPI_Abort(MPI_COMM_WORLD, 1);
00085 #else
00086 error_code = MPIR_Err_setmsg(MPI_ERR_TYPE, MPIR_ERR_TYPE_NULL,
00087 myname, (char *) 0, (char *) 0);
00088 return ADIOI_Error(fh, error_code, myname);
00089 #endif
00090 }
00091
00092 if (fh->access_mode & MPI_MODE_SEQUENTIAL) {
00093 #ifdef PRINT_ERR_MSG
00094 FPRINTF(stderr, "MPI_File_read_at_all_begin: Can't use this function because file was opened with MPI_MODE_SEQUENTIAL\n");
00095 MPI_Abort(MPI_COMM_WORLD, 1);
00096 #else
00097 error_code = MPIR_Err_setmsg(MPI_ERR_UNSUPPORTED_OPERATION,
00098 MPIR_ERR_AMODE_SEQ, myname, (char *) 0, (char *) 0);
00099 return ADIOI_Error(fh, error_code, myname);
00100 #endif
00101 }
00102
00103 if (fh->split_coll_count) {
00104 #ifdef PRINT_ERR_MSG
00105 FPRINTF(stderr, "MPI_File_read_at_all_begin: Only one active split collective I/O operation allowed per file handle\n");
00106 MPI_Abort(MPI_COMM_WORLD, 1);
00107 #else
00108 error_code = MPIR_Err_setmsg(MPI_ERR_IO, MPIR_ERR_MULTIPLE_SPLIT_COLL,
00109 myname, (char *) 0, (char *) 0);
00110 return ADIOI_Error(fh, error_code, myname);
00111 #endif
00112 }
00113
00114 fh->split_coll_count = 1;
00115
00116 MPI_Type_size(datatype, &datatype_size);
00117 if ((count*datatype_size) % fh->etype_size != 0) {
00118 #ifdef PRINT_ERR_MSG
00119 FPRINTF(stderr, "MPI_File_read_at_all_begin: Only an integral number of etypes can be accessed\n");
00120 MPI_Abort(MPI_COMM_WORLD, 1);
00121 #else
00122 error_code = MPIR_Err_setmsg(MPI_ERR_IO, MPIR_ERR_ETYPE_FRACTIONAL,
00123 myname, (char *) 0, (char *) 0);
00124 return ADIOI_Error(fh, error_code, myname);
00125 #endif
00126 }
00127
00128 ADIO_ReadStridedColl(fh, buf, count, datatype, ADIO_EXPLICIT_OFFSET,
00129 offset, &status, &error_code);
00130 return error_code;
00131 }