1 
   2 
   3 
   4 
   5 
   6 
   7 
   8 
   9 
  10 
  11 
  12 
  13 
  14 
  15 
  16 
  17 
  18 
  19 
  20 
  21 #ifndef ADIO_INCLUDE
  22 #define ADIO_INCLUDE
  23 
  24 #ifdef SPPUX
  25 #define _POSIX_SOURCE
  26 #endif
  27 
  28 #ifdef USE_FORT_STDCALL
  29 #define FORT_CALL __stdcall
  30 #elif defined (USE_FORT_CDECL)
  31 #define FORT_CALL __cdecl
  32 #else
  33 #define FORT_CALL
  34 #endif
  35 
  36 #ifdef USE_FORT_MIXED_STR_LEN
  37 #define FORT_MIXED_LEN_DECL   , int
  38 #define FORT_END_LEN_DECL
  39 #define FORT_MIXED_LEN(a)     , int a
  40 #define FORT_END_LEN(a)
  41 #else
  42 #define FORT_MIXED_LEN_DECL
  43 #define FORT_END_LEN_DECL     , int
  44 #define FORT_MIXED_LEN(a)
  45 #define FORT_END_LEN(a)       , int a
  46 #endif
  47 
  48 #ifdef HAVE_FORTRAN_API
  49 # ifdef FORTRAN_EXPORTS
  50 #  define FORTRAN_API __declspec(dllexport)
  51 # else
  52 #  define FORTRAN_API __declspec(dllimport)
  53 # endif
  54 #else
  55 # define FORTRAN_API
  56 #endif
  57 
  58 
  59 #ifdef HAVE_WINDOWS_H
  60 #define ADIOI_UNREFERENCED_ARG(a) a
  61 #else
  62 #define ADIOI_UNREFERENCED_ARG(a)
  63 #endif
  64 
  65 
  66 
  67 #ifndef ROMIOCONF_H_INCLUDED
  68 #include "romioconf.h"
  69 #define ROMIOCONF_H_INCLUDED
  70 #endif
  71 
  72 #include "mpi.h"
  73 #include "mpio.h"
  74 #ifdef HAVE_FCNTL_H
  75 #include <fcntl.h>
  76 #endif
  77 #ifdef HAVE_SYS_TYPES_H
  78 #include <sys/types.h>
  79 #endif
  80 #include <sys/stat.h>
  81 #include <string.h>
  82 #include <stdio.h>
  83 #include <stdlib.h>
  84 #include <errno.h>
  85 #ifdef SPPUX
  86 #include <sys/cnx_fcntl.h>
  87 #endif
  88 
  89 #ifdef ROMIO_NTFS
  90 #include <winsock2.h>
  91 #include <windows.h>
  92 #define FDTYPE HANDLE
  93 #else
  94 #define FDTYPE int
  95 #endif
  96 
  97 #ifdef MPI_OFFSET_IS_INT
  98    typedef int ADIO_Offset;
  99    typedef unsigned ADIO_Size;
 100 #  define ADIO_OFFSET MPI_INT
 101 #elif defined(HAVE_LONG_LONG_64)
 102    typedef long long ADIO_Offset;
 103    typedef unsigned long long ADIO_Size;
 104 #  ifdef HAVE_MPI_LONG_LONG_INT
 105 #     define ADIO_OFFSET MPI_LONG_LONG_INT
 106 #  else
 107 #     define ADIO_OFFSET MPI_DOUBLE
 108 #  endif
 109 #elif defined(HAVE_INT64)
 110    typedef __int64 ADIO_Offset;
 111    typedef unsigned __int64 ADIO_Size;
 112 #  define ADIO_OFFSET MPI_DOUBLE
 113 #else
 114    typedef long ADIO_Offset;
 115    typedef unsigned long ADIO_Size;
 116 #  define ADIO_OFFSET MPI_LONG
 117 #endif
 118 
 119 #define ADIO_Status MPI_Status   
 120 
 121 #ifndef MPIO_INCLUDE
 122 #  ifdef NEEDS_MPI_FINT
 123       typedef int MPI_Fint; 
 124 #  endif
 125 #endif
 126 
 127 #if (!defined(HAVE_MPI_INFO) && !defined(MPIO_INCLUDE))
 128    typedef struct MPIR_Info *MPI_Info;
 129 #  define MPI_INFO_NULL 0
 130 #  define MPI_MAX_INFO_VAL      1024
 131 
 132 int MPI_Info_create(MPI_Info *info);
 133 int MPI_Info_set(MPI_Info info, char *key, char *value);
 134 int MPI_Info_delete(MPI_Info info, char *key);
 135 int MPI_Info_get(MPI_Info info, char *key, int valuelen, 
 136                          char *value, int *flag);
 137 int MPI_Info_get_valuelen(MPI_Info info, char *key, int *valuelen, int *flag);
 138 int MPI_Info_get_nkeys(MPI_Info info, int *nkeys);
 139 int MPI_Info_get_nthkey(MPI_Info info, int n, char *key);
 140 int MPI_Info_dup(MPI_Info info, MPI_Info *newinfo);
 141 int MPI_Info_free(MPI_Info *info);
 142 
 143 #ifdef MPI_Info_f2c
 144 #undef MPI_Info_f2c
 145 #endif
 146 #ifdef MPI_Info_c2f
 147 #undef MPI_Info_c2f
 148 #endif
 149 
 150 MPI_Fint MPI_Info_c2f(MPI_Info info);
 151 MPI_Info MPI_Info_f2c(MPI_Fint info);
 152 
 153 int PMPI_Info_create(MPI_Info *info);
 154 int PMPI_Info_set(MPI_Info info, char *key, char *value);
 155 int PMPI_Info_delete(MPI_Info info, char *key);
 156 int PMPI_Info_get(MPI_Info info, char *key, int valuelen, 
 157                          char *value, int *flag);
 158 int PMPI_Info_get_valuelen(MPI_Info info, char *key, int *valuelen, int *flag);
 159 int PMPI_Info_get_nkeys(MPI_Info info, int *nkeys);
 160 int PMPI_Info_get_nthkey(MPI_Info info, int n, char *key);
 161 int PMPI_Info_dup(MPI_Info info, MPI_Info *newinfo);
 162 int PMPI_Info_free(MPI_Info *info);
 163 
 164 MPI_Fint PMPI_Info_c2f(MPI_Info info);
 165 MPI_Info PMPI_Info_f2c(MPI_Fint info);
 166 
 167 #endif
 168 
 169 
 170 
 171 #if defined(HAVE_STRDUP) && defined(NEEDS_STRDUP_DECL) && !defined(strdup)
 172 char *strdup(const char *s);
 173 # endif
 174 #if defined(HAVE_READLINK) && defined(NEEDS_READLINK_DECL) && !defined(readlink)
 175 ssize_t readlink(const char *path, char *buf, size_t bufsiz);
 176 # endif
 177 #if defined(HAVE_LSTAT) && defined(NEEDS_LSTAT_DECL) && !defined(lstat)
 178 int lstat(const char *file_name, struct stat *buf);
 179 # endif
 180 #if defined(HAVE_FSYNC) && defined(NEEDS_FSYNC_DECL) && !defined(fsync)
 181 int fsync(int fd);
 182 # endif
 183 #if defined(HAVE_FTRUNCATE) && defined(NEEDS_FTRUNCATE_DECL) && !defined(ftruncate)
 184 int ftruncate(int fd, off_t length);
 185 # endif
 186 
 187 
 188 typedef struct ADIOI_Fns_struct ADIOI_Fns;
 189 typedef struct ADIOI_Hints_struct ADIOI_Hints;
 190 
 191 typedef struct ADIOI_FileD {
 192     int cookie;              
 193     FDTYPE fd_sys;              
 194     FDTYPE null_fd;          
 195     int fd_direct;           
 196 
 197     int direct_read;         
 198     int direct_write;        
 199     
 200     unsigned d_mem;          
 201     unsigned d_miniosz;      
 202 
 203     long blksize;            
 204 
 205     ADIO_Offset fp_ind;      
 206     ADIO_Offset fp_sys_posn; 
 207 
 208     ADIOI_Fns *fns;          
 209     MPI_Comm comm;           
 210     int is_open;            
 211     int is_agg;              
 212     char *filename;          
 213     int file_system;         
 214     int access_mode;         
 215 
 216 
 217     int orig_access_mode;    
 218     ADIO_Offset disp;        
 219     MPI_Datatype etype;      
 220     MPI_Datatype filetype;   
 221     MPI_Count etype_size;          
 222     ADIOI_Hints *hints;      
 223     MPI_Info info;
 224 
 225     
 226     int split_coll_count;    
 227     MPI_Status split_status; 
 228     MPI_Datatype split_datatype; 
 229 
 230     
 231     char *shared_fp_fname;   
 232     struct ADIOI_FileD *shared_fp_fd;  
 233 
 234     int async_count;         
 235     int perm;
 236     int atomicity;          
 237     int fortran_handle;     
 238     MPI_Errhandler err_handler;
 239     void *fs_ptr;            
 240 
 241     
 242     ADIO_Offset *file_realm_st_offs; 
 243     MPI_Datatype *file_realm_types;  
 244     int my_cb_nodes_index; 
 245     char *io_buf;          
 246     MPI_Win io_buf_window; 
 247     int *io_buf_put_amounts; 
 248 
 249     MPI_Win io_buf_put_amounts_window; 
 250     
 251     int is_external32;      
 252 
 253 } ADIOI_FileD;
 254 
 255 typedef struct ADIOI_FileD *ADIO_File;
 256 
 257 typedef MPI_Request ADIO_Request;
 258 
 259 
 260 typedef struct {
 261     ADIO_Offset disp;
 262     MPI_Datatype etype;
 263     MPI_Datatype filetype;
 264     MPI_Info info;
 265     int atomicity;
 266     ADIO_Offset fsize;       
 267     ADIO_Offset diskspace;   
 268 } ADIO_Fcntl_t;              
 269 
 270 
 271 
 272 #define ADIO_CREATE              1
 273 #define ADIO_RDONLY              2
 274 #define ADIO_WRONLY              4
 275 #define ADIO_RDWR                8
 276 #define ADIO_DELETE_ON_CLOSE     16
 277 #define ADIO_UNIQUE_OPEN         32
 278 #define ADIO_EXCL                64
 279 #define ADIO_APPEND             128
 280 #define ADIO_SEQUENTIAL         256
 281 
 282 #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)
 283 
 284 
 285 #define ADIO_EXPLICIT_OFFSET     100
 286 #define ADIO_INDIVIDUAL          101
 287 #define ADIO_SHARED              102
 288 
 289 #define ADIO_REQUEST_NULL        ((ADIO_Request) 0)
 290 #define ADIO_FILE_NULL           ((ADIO_File) 0)
 291 
 292 
 293 #define ADIO_NFS                 150
 294 #define ADIO_PIOFS               151   
 295 #define ADIO_UFS                 152   
 296 #define ADIO_PFS                 153   
 297 #define ADIO_XFS                 154   
 298 #define ADIO_HFS                 155   
 299 #define ADIO_SFS                 156   
 300 #define ADIO_PVFS                157   
 301 #define ADIO_NTFS                158   
 302 #define ADIO_TESTFS              159   
 303 #define ADIO_PVFS2               160   
 304 #define ADIO_PANFS               161   
 305 #define ADIO_GRIDFTP             162   
 306 #define ADIO_LUSTRE              163   
 307   
 308   
 309 #define ADIO_ZOIDFS              167   
 310 
 311 #define ADIO_GPFS                  168
 312 
 313 #define ADIO_SEEK_SET            SEEK_SET
 314 #define ADIO_SEEK_CUR            SEEK_CUR
 315 #define ADIO_SEEK_END            SEEK_END
 316 
 317 #define ADIO_FCNTL_SET_ATOMICITY 180
 318 #define ADIO_FCNTL_SET_DISKSPACE 188
 319 #define ADIO_FCNTL_GET_FSIZE     200
 320 
 321 
 322 #define ADIO_LOCKS               300 
 323 #define ADIO_SHARED_FP           301 
 324 #define ADIO_ATOMIC_MODE         302 
 325 #define ADIO_DATA_SIEVING_WRITES 303 
 326 #define ADIO_SCALABLE_OPEN       304 
 327 
 328 
 329 #define ADIO_UNLINK_AFTER_CLOSE  305 
 330 
 331 
 332 #define ADIO_TWO_PHASE           306 
 333 
 334 
 335 #define ADIO_SCALABLE_RESIZE     307 
 336 
 337 
 338 
 339 #define ADIO_PERM_NULL           -1
 340 
 341 #define ADIOI_FILE_COOKIE 2487376
 342 #define ADIOI_REQ_COOKIE 3493740
 343 
 344 
 345 
 346 
 347 
 348 
 349 void ADIO_Init(int *argc, char ***argv, int *error_code);
 350 void ADIO_End(int *error_code);
 351 MPI_File ADIO_Open(MPI_Comm orig_comm, MPI_Comm comm, const char *filename,
 352                    int file_system, ADIOI_Fns *ops,
 353                    int access_mode, ADIO_Offset disp, MPI_Datatype etype,
 354                    MPI_Datatype filetype,
 355                    MPI_Info info, int perm, int *error_code);
 356 void ADIOI_OpenColl(ADIO_File fd, int rank, int acces_mode, int *error_code);
 357 void ADIO_ImmediateOpen(ADIO_File fd, int *error_code);
 358 void ADIO_Close(ADIO_File fd, int *error_code);
 359 void ADIO_ReadContig(ADIO_File fd, void *buf, int count, MPI_Datatype datatype,
 360                     int file_ptr_type,  ADIO_Offset offset, 
 361                     ADIO_Status *status, int *error_code);
 362 void ADIO_WriteContig(ADIO_File fd, void *buf, int count, 
 363                      MPI_Datatype datatype, int file_ptr_type,
 364                       ADIO_Offset offset, int *bytes_written, int
 365                       *error_code);
 366 void ADIO_IwriteContig(ADIO_File fd, void *buf, int count, 
 367                       MPI_Datatype datatype, int file_ptr_type,
 368                       ADIO_Offset offset, ADIO_Request *request, int
 369                       *error_code);   
 370 void ADIO_IreadContig(ADIO_File fd, void *buf, int count, 
 371                       MPI_Datatype datatype, int file_ptr_type,
 372                       ADIO_Offset offset, ADIO_Request *request, int
 373                       *error_code);   
 374 int ADIO_ReadDone(ADIO_Request *request, ADIO_Status *status, 
 375                int *error_code);
 376 int ADIO_WriteDone(ADIO_Request *request, ADIO_Status *status, 
 377                int *error_code);
 378 int ADIO_ReadIcomplete(ADIO_Request *request, ADIO_Status *status, int
 379                        *error_code); 
 380 int ADIO_WriteIcomplete(ADIO_Request *request, ADIO_Status *status,
 381                         int *error_code); 
 382 void ADIO_ReadComplete(ADIO_Request *request, ADIO_Status *status, int
 383                        *error_code); 
 384 void ADIO_WriteComplete(ADIO_Request *request, ADIO_Status *status,
 385                         int *error_code); 
 386 void ADIO_Fcntl(ADIO_File fd, int flag, ADIO_Fcntl_t *fcntl_struct, int
 387                 *error_code); 
 388 void ADIO_ReadStrided(ADIO_File fd, void *buf, int count,
 389                        MPI_Datatype datatype, int file_ptr_type,
 390                        ADIO_Offset offset, ADIO_Status *status, int
 391                        *error_code);
 392 void ADIO_WriteStrided(ADIO_File fd, const void *buf, int count,
 393                        MPI_Datatype datatype, int file_ptr_type,
 394                        ADIO_Offset offset, ADIO_Status *status, int
 395                        *error_code);
 396 void ADIO_ReadStridedColl(ADIO_File fd, void *buf, int count,
 397                        MPI_Datatype datatype, int file_ptr_type,
 398                        ADIO_Offset offset, ADIO_Status *status, int
 399                        *error_code);
 400 void ADIO_WriteStridedColl(ADIO_File fd, void *buf, int count,
 401                        MPI_Datatype datatype, int file_ptr_type,
 402                        ADIO_Offset offset, ADIO_Status *status, int
 403                        *error_code);
 404 void ADIO_IreadStrided(ADIO_File fd, void *buf, int count,
 405                        MPI_Datatype datatype, int file_ptr_type,
 406                        ADIO_Offset offset, ADIO_Request *request, int
 407                        *error_code);
 408 void ADIO_IwriteStrided(ADIO_File fd, void *buf, int count,
 409                        MPI_Datatype datatype, int file_ptr_type,
 410                        ADIO_Offset offset, ADIO_Request *request, int
 411                        *error_code);
 412 void ADIO_IreadStridedColl(ADIO_File fd, void *buf, int count,
 413                MPI_Datatype datatype, int file_ptr_type,
 414                ADIO_Offset offset, ADIO_Request *request,
 415                int *error_code);
 416 void ADIO_IwriteStridedColl(ADIO_File fd, void *buf, int count,
 417                MPI_Datatype datatype, int file_ptr_type,
 418                ADIO_Offset offset, ADIO_Request *request,
 419                int *error_code);
 420 ADIO_Offset ADIO_SeekIndividual(ADIO_File fd, ADIO_Offset offset, 
 421                        int whence, int *error_code);
 422 void ADIO_Delete(char *filename, int *error_code);
 423 void ADIO_Flush(ADIO_File fd, int *error_code);
 424 void ADIO_Resize(ADIO_File fd, ADIO_Offset size, int *error_code);
 425 void ADIO_SetInfo(ADIO_File fd, MPI_Info users_info, int *error_code);
 426 void ADIO_ResolveFileType(MPI_Comm comm, const char *filename, int *fstype,
 427           ADIOI_Fns **ops, int *error_code);
 428 void ADIO_Get_shared_fp(ADIO_File fd, ADIO_Offset size, ADIO_Offset *shared_fp,
 429                          int *error_code);
 430 void ADIO_Set_shared_fp(ADIO_File fd, ADIO_Offset offset, int *error_code);
 431 void ADIO_Set_view(ADIO_File fd, ADIO_Offset disp, MPI_Datatype etype, 
 432                 MPI_Datatype filetype, MPI_Info info,  int *error_code);
 433 int  ADIO_Feature(ADIO_File fd, int flag);
 434 
 435 
 436 int ADIO_Type_create_subarray(int ndims,
 437                               int *array_of_sizes,
 438                               int *array_of_subsizes,
 439                               int *array_of_starts,
 440                               int order,
 441                               MPI_Datatype oldtype,
 442                               MPI_Datatype *newtype);
 443 int ADIO_Type_create_darray(int size, int rank, int ndims, 
 444                             int *array_of_gsizes, int *array_of_distribs, 
 445                             int *array_of_dargs, int *array_of_psizes, 
 446                             int order, MPI_Datatype oldtype, 
 447                             MPI_Datatype *newtype);
 448 
 449 
 450 MPI_File MPIO_File_create(int size);
 451 ADIO_File MPIO_File_resolve(MPI_File mpi_fh);
 452 void MPIO_File_free(MPI_File *mpi_fh);
 453 MPI_File MPIO_File_f2c(MPI_Fint fh);
 454 MPI_Fint MPIO_File_c2f(MPI_File fh);
 455 int MPIO_Err_create_code(int lastcode, int fatal, const char fcname[],
 456                          int line, int error_class, const char generic_msg[],
 457                          const char specific_msg[], ... );
 458 int MPIO_Err_return_file(MPI_File mpi_fh, int error_code);
 459 int MPIO_Err_return_comm(MPI_Comm mpi_comm, int error_code);
 460 
 461 
 462 void MPIO_Completed_request_create(MPI_File *fh, MPI_Offset nbytes,
 463                 int * error_code, MPI_Request *request);
 464 
 465 #include "adioi.h"
 466 #include "adioi_fs_proto.h"
 467 #include "mpio_error.h"
 468 #include "mpipr.h"
 469 
 470 
 471 #define MPIR_ERR_FATAL 1
 472 #define MPIR_ERR_RECOVERABLE 0
 473 
 474 #endif