00001
00002
00003
00004
00005
00006
00007
00008 #ifdef _UNICOS
00009 #include <fortran.h>
00010 #endif
00011 #include "adio.h"
00012 #include "mpio.h"
00013
00014
00015 #if defined(MPIO_BUILD_PROFILING) || defined(HAVE_WEAK_SYMBOLS)
00016
00017 #if defined(HAVE_WEAK_SYMBOLS)
00018 #if defined(HAVE_PRAGMA_WEAK)
00019 #if defined(FORTRANCAPS)
00020 extern FORTRAN_API void FORT_CALL MPI_FILE_SET_VIEW( MPI_Fint *, MPI_Offset *, MPI_Fint *, MPI_Fint *, char * FORT_MIXED_LEN_DECL, MPI_Fint *, MPI_Fint * FORT_END_LEN_DECL );
00021 #pragma weak MPI_FILE_SET_VIEW = PMPI_FILE_SET_VIEW
00022 #elif defined(FORTRANDOUBLEUNDERSCORE)
00023 extern FORTRAN_API void FORT_CALL mpi_file_set_view__( MPI_Fint *, MPI_Offset *, MPI_Fint *, MPI_Fint *, char * FORT_MIXED_LEN_DECL, MPI_Fint *, MPI_Fint * FORT_END_LEN_DECL );
00024 #pragma weak mpi_file_set_view__ = pmpi_file_set_view__
00025 #elif !defined(FORTRANUNDERSCORE)
00026 extern FORTRAN_API void FORT_CALL mpi_file_set_view( MPI_Fint *, MPI_Offset *, MPI_Fint *, MPI_Fint *, char * FORT_MIXED_LEN_DECL, MPI_Fint *, MPI_Fint * FORT_END_LEN_DECL );
00027 #pragma weak mpi_file_set_view = pmpi_file_set_view
00028 #else
00029 extern FORTRAN_API void FORT_CALL mpi_file_set_view_( MPI_Fint *, MPI_Offset *, MPI_Fint *, MPI_Fint *, char * FORT_MIXED_LEN_DECL, MPI_Fint *, MPI_Fint * FORT_END_LEN_DECL );
00030 #pragma weak mpi_file_set_view_ = pmpi_file_set_view_
00031 #endif
00032
00033 #elif defined(HAVE_PRAGMA_HP_SEC_DEF)
00034 #if defined(FORTRANCAPS)
00035 #pragma _HP_SECONDARY_DEF PMPI_FILE_SET_VIEW MPI_FILE_SET_VIEW
00036 #elif defined(FORTRANDOUBLEUNDERSCORE)
00037 #pragma _HP_SECONDARY_DEF pmpi_file_set_view__ mpi_file_set_view__
00038 #elif !defined(FORTRANUNDERSCORE)
00039 #pragma _HP_SECONDARY_DEF pmpi_file_set_view mpi_file_set_view
00040 #else
00041 #pragma _HP_SECONDARY_DEF pmpi_file_set_view_ mpi_file_set_view_
00042 #endif
00043
00044 #elif defined(HAVE_PRAGMA_CRI_DUP)
00045 #if defined(FORTRANCAPS)
00046 #pragma _CRI duplicate MPI_FILE_SET_VIEW as PMPI_FILE_SET_VIEW
00047 #elif defined(FORTRANDOUBLEUNDERSCORE)
00048 #pragma _CRI duplicate mpi_file_set_view__ as pmpi_file_set_view__
00049 #elif !defined(FORTRANUNDERSCORE)
00050 #pragma _CRI duplicate mpi_file_set_view as pmpi_file_set_view
00051 #else
00052 #pragma _CRI duplicate mpi_file_set_view_ as pmpi_file_set_view_
00053 #endif
00054
00055
00056 #endif
00057
00058 #include "mpioprof.h"
00059 #endif
00060
00061 #ifdef FORTRANCAPS
00062 #define mpi_file_set_view_ PMPI_FILE_SET_VIEW
00063 #elif defined(FORTRANDOUBLEUNDERSCORE)
00064 #define mpi_file_set_view_ pmpi_file_set_view__
00065 #elif !defined(FORTRANUNDERSCORE)
00066 #if defined(HPUX) || defined(SPPUX)
00067 #pragma _HP_SECONDARY_DEF pmpi_file_set_view pmpi_file_set_view_
00068 #endif
00069 #define mpi_file_set_view_ pmpi_file_set_view
00070 #else
00071 #if defined(HPUX) || defined(SPPUX)
00072 #pragma _HP_SECONDARY_DEF pmpi_file_set_view_ pmpi_file_set_view
00073 #endif
00074 #define mpi_file_set_view_ pmpi_file_set_view_
00075 #endif
00076
00077 #else
00078
00079 #ifdef FORTRANCAPS
00080 #define mpi_file_set_view_ MPI_FILE_SET_VIEW
00081 #elif defined(FORTRANDOUBLEUNDERSCORE)
00082 #define mpi_file_set_view_ mpi_file_set_view__
00083 #elif !defined(FORTRANUNDERSCORE)
00084 #if defined(HPUX) || defined(SPPUX)
00085 #pragma _HP_SECONDARY_DEF mpi_file_set_view mpi_file_set_view_
00086 #endif
00087 #define mpi_file_set_view_ mpi_file_set_view
00088 #else
00089 #if defined(HPUX) || defined(SPPUX)
00090 #pragma _HP_SECONDARY_DEF mpi_file_set_view_ mpi_file_set_view
00091 #endif
00092 #endif
00093 #endif
00094
00095 #if defined(MPIHP) || defined(MPILAM)
00096
00097 void mpi_file_set_view_(MPI_Fint *fh,MPI_Offset *disp,MPI_Fint *etype,
00098 MPI_Fint *filetype,char *datarep,MPI_Fint *info, MPI_Fint *ierr,
00099 int str_len );
00100
00101 void mpi_file_set_view_(MPI_Fint *fh,MPI_Offset *disp,MPI_Fint *etype,
00102 MPI_Fint *filetype,char *datarep,MPI_Fint *info, MPI_Fint *ierr,
00103 int str_len )
00104 {
00105 char *newstr;
00106 MPI_File fh_c;
00107 int i, real_len;
00108 MPI_Datatype etype_c, filetype_c;
00109 MPI_Info info_c;
00110
00111 etype_c = MPI_Type_f2c(*etype);
00112 filetype_c = MPI_Type_f2c(*filetype);
00113 info_c = MPI_Info_f2c(*info);
00114
00115
00116 if (datarep <= (char *) 0) {
00117 FPRINTF(stderr, "MPI_File_set_view: datarep is an invalid address\n");
00118 MPI_Abort(MPI_COMM_WORLD, 1);
00119 }
00120 for (i=str_len-1; i>=0; i--) if (datarep[i] != ' ') break;
00121 if (i < 0) {
00122 FPRINTF(stderr, "MPI_File_set_view: datarep is a blank string\n");
00123 MPI_Abort(MPI_COMM_WORLD, 1);
00124 }
00125 real_len = i + 1;
00126
00127 newstr = (char *) ADIOI_Malloc((real_len+1)*sizeof(char));
00128 ADIOI_Strncpy(newstr, datarep, real_len);
00129 newstr[real_len] = '\0';
00130
00131 fh_c = MPI_File_f2c(*fh);
00132
00133 *ierr = MPI_File_set_view(fh_c,*disp,etype_c,filetype_c,newstr,info_c);
00134
00135 ADIOI_Free(newstr);
00136 }
00137
00138 #else
00139
00140 #ifdef _UNICOS
00141 void mpi_file_set_view_(MPI_Fint *fh,MPI_Offset *disp,MPI_Datatype *etype,
00142 MPI_Datatype *filetype,_fcd datarep_fcd,MPI_Fint *info, MPI_Fint *ierr)
00143 {
00144 char *datarep = _fcdtocp(datarep_fcd);
00145 int str_len = _fcdlen(datarep_fcd);
00146 #else
00147
00148 FORTRAN_API void FORT_CALL mpi_file_set_view_( MPI_Fint *fh, MPI_Offset *disp, MPI_Fint *etype, MPI_Fint *filetype, char *datarep FORT_MIXED_LEN_DECL, MPI_Fint *info, MPI_Fint *ierr FORT_END_LEN_DECL );
00149
00150 FORTRAN_API void FORT_CALL mpi_file_set_view_( MPI_Fint *fh, MPI_Offset *disp, MPI_Fint *etype, MPI_Fint *filetype, char *datarep FORT_MIXED_LEN(str_len), MPI_Fint *info, MPI_Fint *ierr FORT_END_LEN(str_len) )
00151 {
00152 #endif
00153 char *newstr;
00154 MPI_File fh_c;
00155 int i, real_len;
00156 MPI_Info info_c;
00157
00158 info_c = MPI_Info_f2c(*info);
00159
00160
00161 if (datarep <= (char *) 0) {
00162 FPRINTF(stderr, "MPI_File_set_view: datarep is an invalid address\n");
00163 MPI_Abort(MPI_COMM_WORLD, 1);
00164 }
00165 for (i=str_len-1; i>=0; i--) if (datarep[i] != ' ') break;
00166 if (i < 0) {
00167 FPRINTF(stderr, "MPI_File_set_view: datarep is a blank string\n");
00168 MPI_Abort(MPI_COMM_WORLD, 1);
00169 }
00170 real_len = i + 1;
00171
00172 newstr = (char *) ADIOI_Malloc((real_len+1)*sizeof(char));
00173 ADIOI_Strncpy(newstr, datarep, real_len);
00174 newstr[real_len] = '\0';
00175
00176 fh_c = MPI_File_f2c(*fh);
00177
00178 *ierr = MPI_File_set_view(fh_c,*disp,*etype,*filetype,newstr,info_c);
00179
00180 ADIOI_Free(newstr);
00181 }
00182 #endif