00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef ADIO_INCLUDE
00022 #define ADIO_INCLUDE
00023
00024 #include "converse.h"
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
00061 #ifdef HAVE_WINDOWS_H
00062 #define ADIOI_UNREFERENCED_ARG(a) a
00063 #else
00064 #define ADIOI_UNREFERENCED_ARG(a)
00065 #endif
00066
00067
00068
00069 #ifndef ROMIOCONF_H_INCLUDED
00070 #include "romioconf.h"
00071 #define ROMIOCONF_H_INCLUDED
00072 #endif
00073
00074 #include "mpi.h"
00075 #include "mpio.h"
00076 #ifdef HAVE_FCNTL_H
00077 #include <fcntl.h>
00078 #endif
00079 #ifdef HAVE_SYS_TYPES_H
00080 #include <sys/types.h>
00081 #endif
00082 #include <sys/stat.h>
00083 #include <string.h>
00084 #include <stdio.h>
00085 #include <stdlib.h>
00086 #include <errno.h>
00087 #ifdef SPPUX
00088 #include <sys/cnx_fcntl.h>
00089 #endif
00090
00091 #ifdef ROMIO_NTFS
00092 #include <winsock2.h>
00093 #include <windows.h>
00094 #define FDTYPE HANDLE
00095 #else
00096 #define FDTYPE int
00097 #endif
00098
00099 #ifdef MPI_OFFSET_IS_INT
00100 typedef int ADIO_Offset;
00101 # define ADIO_OFFSET MPI_INT
00102 #elif defined(HAVE_LONG_LONG_64)
00103 typedef long long ADIO_Offset;
00104 # ifdef HAVE_MPI_LONG_LONG_INT
00105 # define ADIO_OFFSET MPI_LONG_LONG_INT
00106 # else
00107 # define ADIO_OFFSET MPI_DOUBLE
00108 # endif
00109 #elif defined(HAVE_INT64)
00110 typedef __int64 ADIO_Offset;
00111 # define ADIO_OFFSET MPI_DOUBLE
00112 #else
00113 typedef long ADIO_Offset;
00114 # define ADIO_OFFSET MPI_LONG
00115 #endif
00116
00117 #define ADIO_Status MPI_Status
00118
00119 #ifndef MPIO_INCLUDE
00120 # ifdef NEEDS_MPI_FINT
00121 typedef int MPI_Fint;
00122 # endif
00123 #endif
00124
00125 #if (!defined(HAVE_MPI_INFO) && !defined(MPIO_INCLUDE))
00126 typedef struct MPIR_Info *MPI_Info;
00127 # define MPI_INFO_NULL 0
00128 # define MPI_MAX_INFO_VAL 1024
00129
00130 int MPI_Info_create(MPI_Info *info);
00131 int MPI_Info_set(MPI_Info info, char *key, char *value);
00132 int MPI_Info_delete(MPI_Info info, char *key);
00133 int MPI_Info_get(MPI_Info info, char *key, int valuelen,
00134 char *value, int *flag);
00135 int MPI_Info_get_valuelen(MPI_Info info, char *key, int *valuelen, int *flag);
00136 int MPI_Info_get_nkeys(MPI_Info info, int *nkeys);
00137 int MPI_Info_get_nthkey(MPI_Info info, int n, char *key);
00138 int MPI_Info_dup(MPI_Info info, MPI_Info *newinfo);
00139 int MPI_Info_free(MPI_Info *info);
00140
00141 #ifdef MPI_Info_f2c
00142 #undef MPI_Info_f2c
00143 #endif
00144 #ifdef MPI_Info_c2f
00145 #undef MPI_Info_c2f
00146 #endif
00147
00148 MPI_Fint MPI_Info_c2f(MPI_Info info);
00149 MPI_Info MPI_Info_f2c(MPI_Fint info);
00150
00151 int PMPI_Info_create(MPI_Info *info);
00152 int PMPI_Info_set(MPI_Info info, char *key, char *value);
00153 int PMPI_Info_delete(MPI_Info info, char *key);
00154 int PMPI_Info_get(MPI_Info info, char *key, int valuelen,
00155 char *value, int *flag);
00156 int PMPI_Info_get_valuelen(MPI_Info info, char *key, int *valuelen, int *flag);
00157 int PMPI_Info_get_nkeys(MPI_Info info, int *nkeys);
00158 int PMPI_Info_get_nthkey(MPI_Info info, int n, char *key);
00159 int PMPI_Info_dup(MPI_Info info, MPI_Info *newinfo);
00160 int PMPI_Info_free(MPI_Info *info);
00161
00162 MPI_Fint PMPI_Info_c2f(MPI_Info info);
00163 MPI_Info PMPI_Info_f2c(MPI_Fint info);
00164
00165 #endif
00166
00167
00168
00169 #if defined(HAVE_STRDUP) && defined(NEEDS_STRDUP_DECL) && !defined(strdup)
00170 char *strdup(const char *s);
00171 # endif
00172 #if defined(HAVE_READLINK) && defined(NEEDS_READLINK_DECL) && !defined(readlink)
00173 int readlink(const char *path, char *buf, size_t bufsiz);
00174 # endif
00175 #if defined(HAVE_LSTAT) && defined(NEEDS_LSTAT_DECL) && !defined(lstat)
00176 int lstat(const char *file_name, struct stat *buf);
00177 # endif
00178 #if defined(HAVE_FSYNC) && defined(NEEDS_FSYNC_DECL) && !defined(fsync)
00179 int fsync(int fd);
00180 # endif
00181 #if defined(HAVE_FTRUNCATE) && defined(NEEDS_FTRUNCATE_DECL) && !defined(ftruncate)
00182 int ftruncate(int fd, off_t length);
00183 # endif
00184
00185
00186 typedef struct ADIOI_Fns_struct ADIOI_Fns;
00187 typedef struct ADIOI_Hints_struct ADIOI_Hints;
00188
00189 typedef struct ADIOI_FileD {
00190 int cookie;
00191 FDTYPE fd_sys;
00192 int fd_direct;
00193
00194 int direct_read;
00195 int direct_write;
00196
00197 unsigned d_mem;
00198 unsigned d_miniosz;
00199
00200 ADIO_Offset fp_ind;
00201 ADIO_Offset fp_sys_posn;
00202
00203 ADIOI_Fns *fns;
00204 MPI_Comm comm;
00205 MPI_Comm agg_comm;
00206 int is_open;
00207 int is_agg;
00208 char *filename;
00209 int file_system;
00210 int access_mode;
00211 ADIO_Offset disp;
00212 MPI_Datatype etype;
00213 MPI_Datatype filetype;
00214 int etype_size;
00215 ADIOI_Hints *hints;
00216 MPI_Info info;
00217
00218
00219 int split_coll_count;
00220 MPI_Status split_status;
00221 MPI_Datatype split_datatype;
00222
00223
00224 char *shared_fp_fname;
00225 struct ADIOI_FileD *shared_fp_fd;
00226
00227 int async_count;
00228 int perm;
00229 int atomicity;
00230 int fortran_handle;
00231 MPI_Errhandler err_handler;
00232 void *fs_ptr;
00233
00234
00235 ADIO_Offset *file_realm_st_offs;
00236 MPI_Datatype *file_realm_types;
00237 int my_cb_nodes_index;
00238 } ADIOI_FileD;
00239
00240 typedef struct ADIOI_FileD *ADIO_File;
00241
00242 typedef MPI_Request ADIO_Request;
00243
00244
00245 typedef struct {
00246 ADIO_Offset disp;
00247 MPI_Datatype etype;
00248 MPI_Datatype filetype;
00249 MPI_Info info;
00250 int atomicity;
00251 ADIO_Offset fsize;
00252 ADIO_Offset diskspace;
00253 } ADIO_Fcntl_t;
00254
00255
00256
00257 #define ADIO_CREATE 1
00258 #define ADIO_RDONLY 2
00259 #define ADIO_WRONLY 4
00260 #define ADIO_RDWR 8
00261 #define ADIO_DELETE_ON_CLOSE 16
00262 #define ADIO_UNIQUE_OPEN 32
00263 #define ADIO_EXCL 64
00264 #define ADIO_APPEND 128
00265 #define ADIO_SEQUENTIAL 256
00266
00267 #define ADIO_AMODE_NOMATCH ~(ADIO_CREATE|ADIO_RDONLY|ADIO_WRONLY|ADIO_RDWR|ADIO_DELETE_ON_CLOSE|ADIO_UNIQUE_OPEN|ADIO_EXCL|ADIO_APPEND|ADIO_SEQUENTIAL)
00268
00269
00270 #define ADIO_EXPLICIT_OFFSET 100
00271 #define ADIO_INDIVIDUAL 101
00272 #define ADIO_SHARED 102
00273
00274 #define ADIO_REQUEST_NULL ((ADIO_Request) 0)
00275 #define ADIO_FILE_NULL ((ADIO_File) 0)
00276
00277
00278 #define ADIO_NFS 150
00279 #define ADIO_PIOFS 151
00280 #define ADIO_UFS 152
00281 #define ADIO_PFS 153
00282 #define ADIO_XFS 154
00283 #define ADIO_HFS 155
00284 #define ADIO_SFS 156
00285 #define ADIO_PVFS 157
00286 #define ADIO_NTFS 158
00287 #define ADIO_TESTFS 159
00288 #define ADIO_PVFS2 160
00289 #define ADIO_PANFS 161
00290 #define ADIO_GRIDFTP 162
00291 #define ADIO_LUSTRE 163
00292 #define ADIO_BGL 164
00293 #define ADIO_BGLOCKLESS 165
00294 #define ADIO_ZOIDFS 167
00295
00296 #define ADIO_SEEK_SET SEEK_SET
00297 #define ADIO_SEEK_CUR SEEK_CUR
00298 #define ADIO_SEEK_END SEEK_END
00299
00300 #define ADIO_FCNTL_SET_ATOMICITY 180
00301 #define ADIO_FCNTL_SET_DISKSPACE 188
00302 #define ADIO_FCNTL_GET_FSIZE 200
00303
00304
00305 #define ADIO_LOCKS 300
00306 #define ADIO_SHARED_FP 301
00307 #define ADIO_ATOMIC_MODE 302
00308 #define ADIO_DATA_SIEVING_WRITES 303
00309 #define ADIO_SCALABLE_OPEN 304
00310
00311
00312 #define ADIO_UNLINK_AFTER_CLOSE 305
00313
00314
00315
00316
00317 #define ADIO_PERM_NULL -1
00318
00319 #define ADIOI_FILE_COOKIE 2487376
00320 #define ADIOI_REQ_COOKIE 3493740
00321
00322
00323
00324
00325
00326
00327 void ADIO_Init(int *argc, char ***argv, int *error_code);
00328 void ADIO_End(int *error_code);
00329 MPI_File ADIO_Open(MPI_Comm orig_comm, MPI_Comm comm, char *filename,
00330 int file_system, ADIOI_Fns *ops,
00331 int access_mode, ADIO_Offset disp, MPI_Datatype etype,
00332 MPI_Datatype filetype,
00333 MPI_Info info, int perm, int *error_code);
00334 void ADIOI_OpenColl(ADIO_File fd, int rank, int acces_mode, int *error_code);
00335 void ADIO_ImmediateOpen(ADIO_File fd, int *error_code);
00336 void ADIO_Close(ADIO_File fd, int *error_code);
00337 void ADIO_ReadContig(ADIO_File fd, void *buf, int count, MPI_Datatype datatype,
00338 int file_ptr_type, ADIO_Offset offset,
00339 ADIO_Status *status, int *error_code);
00340 void ADIO_WriteContig(ADIO_File fd, void *buf, int count,
00341 MPI_Datatype datatype, int file_ptr_type,
00342 ADIO_Offset offset, int *bytes_written, int
00343 *error_code);
00344 void ADIO_IwriteContig(ADIO_File fd, void *buf, int count,
00345 MPI_Datatype datatype, int file_ptr_type,
00346 ADIO_Offset offset, ADIO_Request *request, int
00347 *error_code);
00348 void ADIO_IreadContig(ADIO_File fd, void *buf, int count,
00349 MPI_Datatype datatype, int file_ptr_type,
00350 ADIO_Offset offset, ADIO_Request *request, int
00351 *error_code);
00352 int ADIO_ReadDone(ADIO_Request *request, ADIO_Status *status,
00353 int *error_code);
00354 int ADIO_WriteDone(ADIO_Request *request, ADIO_Status *status,
00355 int *error_code);
00356 int ADIO_ReadIcomplete(ADIO_Request *request, ADIO_Status *status, int
00357 *error_code);
00358 int ADIO_WriteIcomplete(ADIO_Request *request, ADIO_Status *status,
00359 int *error_code);
00360 void ADIO_ReadComplete(ADIO_Request *request, ADIO_Status *status, int
00361 *error_code);
00362 void ADIO_WriteComplete(ADIO_Request *request, ADIO_Status *status,
00363 int *error_code);
00364 void ADIO_Fcntl(ADIO_File fd, int flag, ADIO_Fcntl_t *fcntl_struct, int
00365 *error_code);
00366 void ADIO_ReadStrided(ADIO_File fd, void *buf, int count,
00367 MPI_Datatype datatype, int file_ptr_type,
00368 ADIO_Offset offset, ADIO_Status *status, int
00369 *error_code);
00370 void ADIO_WriteStrided(ADIO_File fd, void *buf, int count,
00371 MPI_Datatype datatype, int file_ptr_type,
00372 ADIO_Offset offset, ADIO_Status *status, int
00373 *error_code);
00374 void ADIO_ReadStridedColl(ADIO_File fd, void *buf, int count,
00375 MPI_Datatype datatype, int file_ptr_type,
00376 ADIO_Offset offset, ADIO_Status *status, int
00377 *error_code);
00378 void ADIO_WriteStridedColl(ADIO_File fd, void *buf, int count,
00379 MPI_Datatype datatype, int file_ptr_type,
00380 ADIO_Offset offset, ADIO_Status *status, int
00381 *error_code);
00382 void ADIO_IreadStrided(ADIO_File fd, void *buf, int count,
00383 MPI_Datatype datatype, int file_ptr_type,
00384 ADIO_Offset offset, ADIO_Request *request, int
00385 *error_code);
00386 void ADIO_IwriteStrided(ADIO_File fd, void *buf, int count,
00387 MPI_Datatype datatype, int file_ptr_type,
00388 ADIO_Offset offset, ADIO_Request *request, int
00389 *error_code);
00390 ADIO_Offset ADIO_SeekIndividual(ADIO_File fd, ADIO_Offset offset,
00391 int whence, int *error_code);
00392 void ADIO_Delete(char *filename, int *error_code);
00393 void ADIO_Flush(ADIO_File fd, int *error_code);
00394 void ADIO_Resize(ADIO_File fd, ADIO_Offset size, int *error_code);
00395 void ADIO_SetInfo(ADIO_File fd, MPI_Info users_info, int *error_code);
00396 void ADIO_ResolveFileType(MPI_Comm comm, char *filename, int *fstype,
00397 ADIOI_Fns **ops, int *error_code);
00398 void ADIO_Get_shared_fp(ADIO_File fd, int size, ADIO_Offset *shared_fp,
00399 int *error_code);
00400 void ADIO_Set_shared_fp(ADIO_File fd, ADIO_Offset offset, int *error_code);
00401 void ADIO_Set_view(ADIO_File fd, ADIO_Offset disp, MPI_Datatype etype,
00402 MPI_Datatype filetype, MPI_Info info, int *error_code);
00403 int ADIO_Feature(ADIO_File fd, int flag);
00404
00405
00406 int ADIO_Type_create_subarray(int ndims,
00407 int *array_of_sizes,
00408 int *array_of_subsizes,
00409 int *array_of_starts,
00410 int order,
00411 MPI_Datatype oldtype,
00412 MPI_Datatype *newtype);
00413 int ADIO_Type_create_darray(int size, int rank, int ndims,
00414 int *array_of_gsizes, int *array_of_distribs,
00415 int *array_of_dargs, int *array_of_psizes,
00416 int order, MPI_Datatype oldtype,
00417 MPI_Datatype *newtype);
00418
00419
00420 MPI_File MPIO_File_create(int size);
00421 ADIO_File MPIO_File_resolve(MPI_File mpi_fh);
00422 void MPIO_File_free(MPI_File *mpi_fh);
00423 MPI_File MPIO_File_f2c(MPI_Fint fh);
00424 MPI_Fint MPIO_File_c2f(MPI_File fh);
00425 int MPIO_Err_create_code(int lastcode, int fatal, const char fcname[],
00426 int line, int error_class, const char generic_msg[],
00427 const char specific_msg[], ... );
00428 int MPIO_Err_return_file(MPI_File mpi_fh, int error_code);
00429 int MPIO_Err_return_comm(MPI_Comm mpi_comm, int error_code);
00430
00431
00432 void MPIO_Completed_request_create(MPI_File *fh, MPI_Offset nbytes,
00433 int * error_code, MPI_Request *request);
00434
00435 #include "adioi.h"
00436 #include "adioi_fs_proto.h"
00437 #include "mpio_error.h"
00438 #include "mpipr.h"
00439
00440
00441 #define MPIR_ERR_FATAL 1
00442 #define MPIR_ERR_RECOVERABLE 0
00443
00444 #endif