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_get_view = PMPI_File_get_view
00015 #elif defined(HAVE_PRAGMA_HP_SEC_DEF)
00016 #pragma _HP_SECONDARY_DEF PMPI_File_get_view MPI_File_get_view
00017 #elif defined(HAVE_PRAGMA_CRI_DUP)
00018 #pragma _CRI duplicate MPI_File_get_view as PMPI_File_get_view
00019
00020 #endif
00021
00022
00023 #define MPIO_BUILD_PROFILING
00024 #include "mpioprof.h"
00025 #endif
00026 #ifdef MPISGI
00027 #include "mpisgi2.h"
00028 #endif
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044 int MPI_File_get_view(MPI_File fh, MPI_Offset *disp, MPI_Datatype *etype,
00045 MPI_Datatype *filetype, char *datarep)
00046 {
00047 #ifndef PRINT_ERR_MSG
00048 int error_code;
00049 static char myname[] = "MPI_FILE_GET_VIEW";
00050 #endif
00051 int i, j, k, combiner;
00052 MPI_Datatype copy_etype, copy_filetype;
00053
00054 #ifdef PRINT_ERR_MSG
00055 if ((fh <= (MPI_File) 0) || (fh->cookie != ADIOI_FILE_COOKIE)) {
00056 FPRINTF(stderr, "MPI_File_get_view: Invalid file handle\n");
00057 MPI_Abort(MPI_COMM_WORLD, 1);
00058 }
00059 #else
00060 ADIOI_TEST_FILE_HANDLE(fh, myname);
00061 #endif
00062
00063 if (datarep <= (char *) 0) {
00064 #ifdef PRINT_ERR_MSG
00065 FPRINTF(stderr, "MPI_File_get_view: The user must allocate memory for datarep\n");
00066 MPI_Abort(MPI_COMM_WORLD, 1);
00067 #else
00068 error_code = MPIR_Err_setmsg(MPI_ERR_ARG, MPIR_ERR_DATAREP_ARG,
00069 myname, (char *) 0, (char *) 0);
00070 return ADIOI_Error(fh, error_code, myname);
00071 #endif
00072 }
00073
00074 *disp = fh->disp;
00075 strcpy(datarep, "native");
00076
00077 MPI_Type_get_envelope(fh->etype, &i, &j, &k, &combiner);
00078 if (combiner == MPI_COMBINER_NAMED) *etype = fh->etype;
00079 else {
00080 MPI_Type_contiguous(1, fh->etype, ©_etype);
00081 MPI_Type_commit(©_etype);
00082 *etype = copy_etype;
00083 }
00084 MPI_Type_get_envelope(fh->filetype, &i, &j, &k, &combiner);
00085 if (combiner == MPI_COMBINER_NAMED) *filetype = fh->filetype;
00086 else {
00087 MPI_Type_contiguous(1, fh->filetype, ©_filetype);
00088 MPI_Type_commit(©_filetype);
00089 *filetype = copy_filetype;
00090 }
00091
00092 return MPI_SUCCESS;
00093 }