00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #ifndef ADIO_INCLUDE
00024 #define ADIO_INCLUDE
00025
00026 #ifdef SPPUX
00027 #define _POSIX_SOURCE
00028 #endif
00029
00030 #ifdef USE_FORT_STDCALL
00031 #define FORT_CALL __stdcall
00032 #elif defined (USE_FORT_CDECL)
00033 #define FORT_CALL __cdecl
00034 #else
00035 #define FORT_CALL
00036 #endif
00037
00038 #ifdef USE_FORT_MIXED_STR_LEN
00039 #define FORT_MIXED_LEN_DECL , int
00040 #define FORT_END_LEN_DECL
00041 #define FORT_MIXED_LEN(a) , int a
00042 #define FORT_END_LEN(a)
00043 #else
00044 #define FORT_MIXED_LEN_DECL
00045 #define FORT_END_LEN_DECL , int
00046 #define FORT_MIXED_LEN(a)
00047 #define FORT_END_LEN(a) , int a
00048 #endif
00049
00050 #ifdef HAVE_FORTRAN_API
00051 # ifdef FORTRAN_EXPORTS
00052 # define FORTRAN_API __declspec(dllexport)
00053 # else
00054 # define FORTRAN_API __declspec(dllimport)
00055 # endif
00056 #else
00057 # define FORTRAN_API
00058 #endif
00059
00060 #include "romioconf.h"
00061
00062 #include "mpi.h"
00063 #include "mpio.h"
00064 #include <fcntl.h>
00065 #include <sys/types.h>
00066 #include <sys/stat.h>
00067 #include <string.h>
00068 #include <stdio.h>
00069 #include <stdlib.h>
00070 #include <errno.h>
00071 #ifdef SPPUX
00072 #include <sys/cnx_fcntl.h>
00073 #endif
00074
00075 #ifdef ROMIO_NTFS
00076 #include <winsock2.h>
00077 #include <windows.h>
00078 #define FDTYPE HANDLE
00079 #else
00080 #define FDTYPE int
00081 #endif
00082
00083 #ifdef MPI_OFFSET_IS_INT
00084 typedef int ADIO_Offset;
00085 # define ADIO_OFFSET MPI_INT
00086 #elif defined(HAVE_LONG_LONG_64)
00087 typedef long long ADIO_Offset;
00088 # ifdef HAVE_MPI_LONG_LONG_INT
00089 # define ADIO_OFFSET MPI_LONG_LONG_INT
00090 # else
00091 # define ADIO_OFFSET MPI_DOUBLE
00092 # endif
00093 #elif defined(HAVE_INT64)
00094 typedef __int64 ADIO_Offset;
00095 # define ADIO_OFFSET MPI_DOUBLE
00096 #else
00097 typedef long ADIO_Offset;
00098 # define ADIO_OFFSET MPI_LONG
00099 #endif
00100
00101 #ifndef SX4
00102 # define MPI_AINT MPI_LONG
00103 #else
00104 # if (defined(_SX) && !defined(_LONG64))
00105 # define MPI_AINT MPI_LONG_LONG_INT
00106 # else
00107 # define MPI_AINT MPI_LONG
00108 # endif
00109 #endif
00110
00111 #define ADIO_Status MPI_Status
00112
00113 #ifndef MPIO_INCLUDE
00114 # ifdef NEEDS_MPI_FINT
00115 typedef int MPI_Fint;
00116 # endif
00117 #endif
00118
00119 #if (!defined(HAVE_MPI_INFO) && !defined(MPIO_INCLUDE))
00120 typedef struct MPIR_Info *MPI_Info;
00121 # define MPI_INFO_NULL 0
00122 # define MPI_MAX_INFO_VAL 1024
00123
00124 int MPI_Info_create(MPI_Info *info);
00125 int MPI_Info_set(MPI_Info info, char *key, char *value);
00126 int MPI_Info_delete(MPI_Info info, char *key);
00127 int MPI_Info_get(MPI_Info info, char *key, int valuelen,
00128 char *value, int *flag);
00129 int MPI_Info_get_valuelen(MPI_Info info, char *key, int *valuelen, int *flag);
00130 int MPI_Info_get_nkeys(MPI_Info info, int *nkeys);
00131 int MPI_Info_get_nthkey(MPI_Info info, int n, char *key);
00132 int MPI_Info_dup(MPI_Info info, MPI_Info *newinfo);
00133 int MPI_Info_free(MPI_Info *info);
00134
00135 #ifdef MPI_Info_f2c
00136 #undef MPI_Info_f2c
00137 #endif
00138 #ifdef MPI_Info_c2f
00139 #undef MPI_Info_c2f
00140 #endif
00141
00142 MPI_Fint MPI_Info_c2f(MPI_Info info);
00143 MPI_Info MPI_Info_f2c(MPI_Fint info);
00144
00145 int PMPI_Info_create(MPI_Info *info);
00146 int PMPI_Info_set(MPI_Info info, char *key, char *value);
00147 int PMPI_Info_delete(MPI_Info info, char *key);
00148 int PMPI_Info_get(MPI_Info info, char *key, int valuelen,
00149 char *value, int *flag);
00150 int PMPI_Info_get_valuelen(MPI_Info info, char *key, int *valuelen, int *flag);
00151 int PMPI_Info_get_nkeys(MPI_Info info, int *nkeys);
00152 int PMPI_Info_get_nthkey(MPI_Info info, int n, char *key);
00153 int PMPI_Info_dup(MPI_Info info, MPI_Info *newinfo);
00154 int PMPI_Info_free(MPI_Info *info);
00155
00156 MPI_Fint PMPI_Info_c2f(MPI_Info info);
00157 MPI_Info PMPI_Info_f2c(MPI_Fint info);
00158
00159 #endif
00160
00161 typedef struct ADIOI_Fns_struct ADIOI_Fns;
00162 typedef struct ADIOI_Hints_struct ADIOI_Hints;
00163
00164 struct ADIOI_FileD {
00165 int cookie;
00166 FDTYPE fd_sys;
00167 #ifdef XFS
00168 int fd_direct;
00169
00170 int direct_read;
00171 int direct_write;
00172
00173 unsigned d_mem;
00174 unsigned d_miniosz;
00175
00176 unsigned d_maxiosz;
00177 #endif
00178 ADIO_Offset fp_ind;
00179 ADIO_Offset fp_sys_posn;
00180
00181 ADIOI_Fns *fns;
00182 MPI_Comm comm;
00183 char *filename;
00184 int file_system;
00185 int access_mode;
00186 ADIO_Offset disp;
00187 MPI_Datatype etype;
00188 MPI_Datatype filetype;
00189 int etype_size;
00190 ADIOI_Hints *hints;
00191 MPI_Info info;
00192 int split_coll_count;
00193 char *shared_fp_fname;
00194 struct ADIOI_FileD *shared_fp_fd;
00195
00196 int async_count;
00197 int perm;
00198 int atomicity;
00199 int iomode;
00200 MPI_Errhandler err_handler;
00201 };
00202
00203 typedef struct ADIOI_FileD *ADIO_File;
00204
00205 struct ADIOI_RequestD {
00206 int cookie;
00207 void *handle;
00208 int optype;
00209 ADIO_File fd;
00210 MPI_Datatype datatype;
00211 int queued;
00212
00213 int nbytes;
00214 struct ADIOI_Async *ptr_in_async_list;
00215
00216 };
00217
00218 typedef struct ADIOI_RequestD *ADIO_Request;
00219
00220
00221 typedef struct {
00222 ADIO_Offset disp;
00223 MPI_Datatype etype;
00224 MPI_Datatype filetype;
00225 MPI_Info info;
00226 int iomode;
00227
00228 int atomicity;
00229 ADIO_Offset fsize;
00230 ADIO_Offset diskspace;
00231 } ADIO_Fcntl_t;
00232
00233
00234
00235 #define ADIO_CREATE 1
00236 #define ADIO_RDONLY 2
00237 #define ADIO_WRONLY 4
00238 #define ADIO_RDWR 8
00239 #define ADIO_DELETE_ON_CLOSE 16
00240 #define ADIO_UNIQUE_OPEN 32
00241 #define ADIO_EXCL 64
00242 #define ADIO_APPEND 128
00243 #define ADIO_SEQUENTIAL 256
00244
00245
00246 #define ADIO_EXPLICIT_OFFSET 100
00247 #define ADIO_INDIVIDUAL 101
00248 #define ADIO_SHARED 102
00249
00250 #define ADIO_REQUEST_NULL ((ADIO_Request) 0)
00251 #define ADIO_FILE_NULL ((ADIO_File) 0)
00252
00253
00254 #define ADIO_NFS 150
00255 #define ADIO_PIOFS 151
00256 #define ADIO_UFS 152
00257 #define ADIO_PFS 153
00258 #define ADIO_XFS 154
00259 #define ADIO_HFS 155
00260 #define ADIO_SFS 156
00261 #define ADIO_PVFS 157
00262 #define ADIO_NTFS 158
00263 #define ADIO_TESTFS 159
00264
00265 #define ADIO_SEEK_SET SEEK_SET
00266 #define ADIO_SEEK_CUR SEEK_CUR
00267 #define ADIO_SEEK_END SEEK_END
00268
00269 #define ADIO_FCNTL_SET_VIEW 176
00270 #define ADIO_FCNTL_SET_ATOMICITY 180
00271 #define ADIO_FCNTL_SET_IOMODE 184
00272 #define ADIO_FCNTL_SET_DISKSPACE 188
00273 #define ADIO_FCNTL_GET_FSIZE 200
00274
00275
00276 #define ADIO_PERM_NULL -1
00277
00278
00279 #ifndef M_ASYNC
00280 #define M_UNIX 0
00281
00282 #define M_SYNC 2
00283 #define M_RECORD 3
00284 #define M_GLOBAL 4
00285 #define M_ASYNC 5
00286 #endif
00287
00288 #define ADIOI_FILE_COOKIE 2487376
00289 #define ADIOI_REQ_COOKIE 3493740
00290
00291
00292
00293
00294
00295
00296 void ADIO_Init(int *argc, char ***argv, int *error_code);
00297 void ADIO_End(int *error_code);
00298 ADIO_File ADIO_Open(MPI_Comm orig_comm, MPI_Comm comm, char *filename,
00299 int file_system,
00300 int access_mode, ADIO_Offset disp, MPI_Datatype etype,
00301 MPI_Datatype filetype, int iomode,
00302 MPI_Info info, int perm, int *error_code);
00303 void ADIO_Close(ADIO_File fd, int *error_code);
00304 void ADIO_ReadContig(ADIO_File fd, void *buf, int count, MPI_Datatype datatype,
00305 int file_ptr_type, ADIO_Offset offset,
00306 ADIO_Status *status, int *error_code);
00307 void ADIO_WriteContig(ADIO_File fd, void *buf, int count,
00308 MPI_Datatype datatype, int file_ptr_type,
00309 ADIO_Offset offset, int *bytes_written, int
00310 *error_code);
00311 void ADIO_IwriteContig(ADIO_File fd, void *buf, int count,
00312 MPI_Datatype datatype, int file_ptr_type,
00313 ADIO_Offset offset, ADIO_Request *request, int
00314 *error_code);
00315 void ADIO_IreadContig(ADIO_File fd, void *buf, int count,
00316 MPI_Datatype datatype, int file_ptr_type,
00317 ADIO_Offset offset, ADIO_Request *request, int
00318 *error_code);
00319 int ADIO_ReadDone(ADIO_Request *request, ADIO_Status *status,
00320 int *error_code);
00321 int ADIO_WriteDone(ADIO_Request *request, ADIO_Status *status,
00322 int *error_code);
00323 int ADIO_ReadIcomplete(ADIO_Request *request, ADIO_Status *status, int
00324 *error_code);
00325 int ADIO_WriteIcomplete(ADIO_Request *request, ADIO_Status *status,
00326 int *error_code);
00327 void ADIO_ReadComplete(ADIO_Request *request, ADIO_Status *status, int
00328 *error_code);
00329 void ADIO_WriteComplete(ADIO_Request *request, ADIO_Status *status,
00330 int *error_code);
00331 void ADIO_Fcntl(ADIO_File fd, int flag, ADIO_Fcntl_t *fcntl_struct, int
00332 *error_code);
00333 void ADIO_ReadStrided(ADIO_File fd, void *buf, int count,
00334 MPI_Datatype datatype, int file_ptr_type,
00335 ADIO_Offset offset, ADIO_Status *status, int
00336 *error_code);
00337 void ADIO_WriteStrided(ADIO_File fd, void *buf, int count,
00338 MPI_Datatype datatype, int file_ptr_type,
00339 ADIO_Offset offset, ADIO_Status *status, int
00340 *error_code);
00341 void ADIO_ReadStridedColl(ADIO_File fd, void *buf, int count,
00342 MPI_Datatype datatype, int file_ptr_type,
00343 ADIO_Offset offset, ADIO_Status *status, int
00344 *error_code);
00345 void ADIO_WriteStridedColl(ADIO_File fd, void *buf, int count,
00346 MPI_Datatype datatype, int file_ptr_type,
00347 ADIO_Offset offset, ADIO_Status *status, int
00348 *error_code);
00349 void ADIO_IreadStrided(ADIO_File fd, void *buf, int count,
00350 MPI_Datatype datatype, int file_ptr_type,
00351 ADIO_Offset offset, ADIO_Request *request, int
00352 *error_code);
00353 void ADIO_IwriteStrided(ADIO_File fd, void *buf, int count,
00354 MPI_Datatype datatype, int file_ptr_type,
00355 ADIO_Offset offset, ADIO_Request *request, int
00356 *error_code);
00357 ADIO_Offset ADIO_SeekIndividual(ADIO_File fd, ADIO_Offset offset,
00358 int whence, int *error_code);
00359 void ADIO_Delete(char *filename, int *error_code);
00360 void ADIO_Flush(ADIO_File fd, int *error_code);
00361 void ADIO_Resize(ADIO_File fd, ADIO_Offset size, int *error_code);
00362 void ADIO_SetInfo(ADIO_File fd, MPI_Info users_info, int *error_code);
00363 void ADIO_ResolveFileType(MPI_Comm comm, char *filename, int *fstype,
00364 ADIOI_Fns **ops, int *error_code);
00365 void ADIO_Get_shared_fp(ADIO_File fd, int size, ADIO_Offset *shared_fp,
00366 int *error_code);
00367 void ADIO_Set_shared_fp(ADIO_File fd, ADIO_Offset offset, int *error_code);
00368 void ADIO_Set_view(ADIO_File fd, ADIO_Offset disp, MPI_Datatype etype,
00369 MPI_Datatype filetype, MPI_Info info, int *error_code);
00370
00371
00372 #include "adioi.h"
00373 #include "adioi_fs_proto.h"
00374 #include "mpio_error.h"
00375
00376 #endif