00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #ifndef ADIOI_INCLUDE
00025 #define ADIOI_INCLUDE
00026
00027
00028
00029
00030
00031 struct ADIOI_Hints_struct {
00032 int initialized;
00033 int striping_factor;
00034 int striping_unit;
00035 int cb_read;
00036 int cb_write;
00037 int cb_nodes;
00038 int cb_buffer_size;
00039 int cb_pfr;
00040 int cb_fr_type;
00041 int cb_fr_alignment;
00042 int cb_ds_threshold;
00043 int cb_alltoall;
00044 int ds_read;
00045 int ds_write;
00046 int no_indep_rw;
00047 int ind_rd_buffer_size;
00048 int ind_wr_buffer_size;
00049 int deferred_open;
00050 int min_fdomain_size;
00051 char *cb_config_list;
00052 int *ranklist;
00053 union {
00054 struct {
00055 int listio_read;
00056 int listio_write;
00057 } pvfs;
00058 struct {
00059 int debugmask;
00060 int posix_read;
00061 int posix_write;
00062 int listio_read;
00063 int listio_write;
00064 int dtype_read;
00065 int dtype_write;
00066 } pvfs2;
00067 struct {
00068 int start_iodevice;
00069 int co_ratio;
00070 int coll_threshold;
00071 int ds_in_coll;
00072 } lustre;
00073 struct {
00074 unsigned read_chunk_sz;
00075 unsigned write_chunk_sz;
00076 } xfs;
00077 } fs_hints;
00078
00079 };
00080
00081 typedef struct ADIOI_Datarep {
00082 char *name;
00083 void *state;
00084 MPI_Datarep_extent_function *extent_fn;
00085 MPI_Datarep_conversion_function *read_conv_fn;
00086 MPI_Datarep_conversion_function *write_conv_fn;
00087 struct ADIOI_Datarep *next;
00088 } ADIOI_Datarep;
00089
00090
00091
00092
00093
00094
00095 enum {
00096 ADIOI_HINT_AUTO = 0,
00097 ADIOI_HINT_ENABLE = 1,
00098 ADIOI_HINT_DISABLE = 2
00099 };
00100
00101
00102
00103
00104
00105 typedef struct ADIOI_Fl_node {
00106 MPI_Datatype type;
00107 int count;
00108 ADIO_Offset *blocklens;
00109 ADIO_Offset *indices;
00110 struct ADIOI_Fl_node *next;
00111 } ADIOI_Flatlist_node;
00112
00113 #ifdef ROMIO_PVFS2
00114 #include <pvfs2.h>
00115 #endif
00116 typedef struct ADIOI_AIO_req_str {
00117
00118
00119 MPI_Request req;
00120 MPI_Offset nbytes;
00121
00122 #ifdef ROMIO_HAVE_WORKING_AIO
00123 struct aiocb *aiocbp;
00124 #endif
00125 #ifdef ROMIO_PVFS2
00126 PVFS_sys_op_id op_id;
00127 PVFS_sysresp_io resp_io;
00128 PVFS_Request file_req;
00129 PVFS_Request mem_req;
00130 #endif
00131 #ifdef ROMIO_NTFS
00132
00133 LPOVERLAPPED lpOvl;
00134
00135 HANDLE fd;
00136 #endif
00137 } ADIOI_AIO_Request;
00138
00139 struct ADIOI_Fns_struct {
00140 void (*ADIOI_xxx_Open) (ADIO_File fd, int *error_code);
00141 void (*ADIOI_xxx_OpenColl) (ADIO_File fd, int rank,
00142 int access_mode, int *error_code);
00143 void (*ADIOI_xxx_ReadContig) (ADIO_File fd, void *buf, int count,
00144 MPI_Datatype datatype, int file_ptr_type,
00145 ADIO_Offset offset, ADIO_Status *status, int *error_code);
00146 void (*ADIOI_xxx_WriteContig) (ADIO_File fd, void *buf, int count,
00147 MPI_Datatype datatype, int file_ptr_type,
00148 ADIO_Offset offset, ADIO_Status *status, int *error_code);
00149 void (*ADIOI_xxx_ReadStridedColl) (ADIO_File fd, void *buf, int count,
00150 MPI_Datatype datatype, int file_ptr_type,
00151 ADIO_Offset offset, ADIO_Status *status, int *error_code);
00152 void (*ADIOI_xxx_WriteStridedColl) (ADIO_File fd, void *buf, int count,
00153 MPI_Datatype datatype, int file_ptr_type,
00154 ADIO_Offset offset, ADIO_Status *status, int *error_code);
00155 ADIO_Offset (*ADIOI_xxx_SeekIndividual) (ADIO_File fd, ADIO_Offset offset,
00156 int whence, int *error_code);
00157 void (*ADIOI_xxx_Fcntl) (ADIO_File fd, int flag,
00158 ADIO_Fcntl_t *fcntl_struct, int *error_code);
00159 void (*ADIOI_xxx_SetInfo) (ADIO_File fd, MPI_Info users_info,
00160 int *error_code);
00161 void (*ADIOI_xxx_ReadStrided) (ADIO_File fd, void *buf, int count,
00162 MPI_Datatype datatype, int file_ptr_type,
00163 ADIO_Offset offset, ADIO_Status *status, int *error_code);
00164 void (*ADIOI_xxx_WriteStrided) (ADIO_File fd, void *buf, int count,
00165 MPI_Datatype datatype, int file_ptr_type,
00166 ADIO_Offset offset, ADIO_Status *status, int *error_code);
00167 void (*ADIOI_xxx_Close) (ADIO_File fd, int *error_code);
00168 void (*ADIOI_xxx_IreadContig) (ADIO_File fd, void *buf, int count,
00169 MPI_Datatype datatype, int file_ptr_type,
00170 ADIO_Offset offset, ADIO_Request *request, int *error_code);
00171 void (*ADIOI_xxx_IwriteContig) (ADIO_File fd, void *buf, int count,
00172 MPI_Datatype datatype, int file_ptr_type,
00173 ADIO_Offset offset, ADIO_Request *request, int *error_code);
00174 int (*ADIOI_xxx_ReadDone) (ADIO_Request *request, ADIO_Status *status,
00175 int *error_code);
00176 int (*ADIOI_xxx_WriteDone) (ADIO_Request *request, ADIO_Status *status,
00177 int *error_code);
00178 void (*ADIOI_xxx_ReadComplete) (ADIO_Request *request, ADIO_Status *status,
00179 int *error_code);
00180 void (*ADIOI_xxx_WriteComplete) (ADIO_Request *request, ADIO_Status *status,
00181 int *error_code);
00182 void (*ADIOI_xxx_IreadStrided) (ADIO_File fd, void *buf, int count,
00183 MPI_Datatype datatype, int file_ptr_type,
00184 ADIO_Offset offset, ADIO_Request *request, int *error_code);
00185 void (*ADIOI_xxx_IwriteStrided) (ADIO_File fd, void *buf, int count,
00186 MPI_Datatype datatype, int file_ptr_type,
00187 ADIO_Offset offset, ADIO_Request *request, int *error_code);
00188 void (*ADIOI_xxx_Flush) (ADIO_File fd, int *error_code);
00189 void (*ADIOI_xxx_Resize) (ADIO_File fd, ADIO_Offset size, int *error_code);
00190 void (*ADIOI_xxx_Delete) (char *filename, int *error_code);
00191 int (*ADIOI_xxx_Feature) (ADIO_File fd, int flag);
00192 };
00193
00194
00195 #define ADIOI_READ 26
00196 #define ADIOI_WRITE 27
00197
00198 #define ADIOI_MIN(a, b) ((a) < (b) ? (a) : (b))
00199 #define ADIOI_MAX(a, b) ((a) > (b) ? (a) : (b))
00200
00201 #define ADIOI_PREALLOC_BUFSZ 16777216
00202
00203
00204
00205
00206
00207 #define ADIOI_CB_BUFFER_SIZE_DFLT "16777216"
00208
00209 #define ADIOI_IND_RD_BUFFER_SIZE_DFLT "4194304"
00210
00211
00212
00213
00214 #define ADIOI_IND_WR_BUFFER_SIZE_DFLT "524288"
00215
00216 #define ADIOI_CB_CONFIG_LIST_DFLT "*:1"
00217
00218
00219
00220
00221 #define ADIOI_OpenColl(fd, rank, access_mode, error_code) \
00222 (*(fd->fns->ADIOI_xxx_OpenColl))(fd, rank, access_mode, error_code)
00223
00224 #define ADIO_ReadContig(fd,buf,count,datatype,file_ptr_type,offset,status,error_code) \
00225 (*(fd->fns->ADIOI_xxx_ReadContig))(fd,buf,count,datatype,file_ptr_type,offset,status,error_code)
00226
00227 #define ADIO_WriteContig(fd,buf,count,datatype,file_ptr_type,offset,status,error_code) \
00228 (*(fd->fns->ADIOI_xxx_WriteContig))(fd,buf,count,datatype,file_ptr_type,offset,status,error_code)
00229
00230 #define ADIO_SeekIndividual(fd,offset,whence,error_code) \
00231 (*(fd->fns->ADIOI_xxx_SeekIndividual))(fd,offset,whence,error_code)
00232
00233 #define ADIO_Fcntl(fd,flag,fcntl_struct,error_code) \
00234 (*(fd->fns->ADIOI_xxx_Fcntl))(fd,flag,fcntl_struct,error_code)
00235
00236 #define ADIO_IreadContig(fd,buf,count,datatype,file_ptr_type,offset,request,error_code) \
00237 (*(fd->fns->ADIOI_xxx_IreadContig))(fd,buf,count,datatype,file_ptr_type,offset,request,error_code)
00238
00239 #define ADIO_IwriteContig(fd,buf,count,datatype,file_ptr_type,offset,request,error_code) \
00240 (*(fd->fns->ADIOI_xxx_IwriteContig))(fd,buf,count,datatype,file_ptr_type,offset,request,error_code)
00241
00242
00243 #define ADIO_ReadDone(request,status,error_code) \
00244 (*((*(request))->fd->fns->ADIOI_xxx_ReadDone))(request,status,error_code)
00245
00246 #define ADIO_WriteDone(request,status,error_code) \
00247 (*((*(request))->fd->fns->ADIOI_xxx_WriteDone))(request,status,error_code)
00248
00249 #define ADIO_ReadIcomplete(request,status,error_code) \
00250 (*((*(request))->fd->fns->ADIOI_xxx_ReadIcomplete))(request,status,error_code)
00251
00252 #define ADIO_WriteIcomplete(request,status,error_code) \
00253 (*((*(request))->fd->fns->ADIOI_xxx_WriteIcomplete))(request,status,error_code)
00254
00255 #define ADIO_ReadComplete(request,status,error_code) \
00256 (*((*(request))->fd->fns->ADIOI_xxx_ReadComplete))(request,status,error_code)
00257
00258 #define ADIO_WriteComplete(request,status,error_code) \
00259 (*((*(request))->fd->fns->ADIOI_xxx_WriteComplete))(request,status,error_code)
00260
00261 #define ADIO_ReadStrided(fd,buf,count,datatype,file_ptr_type,offset,status,error_code) \
00262 (*(fd->fns->ADIOI_xxx_ReadStrided))(fd,buf,count,datatype,file_ptr_type,offset,status,error_code)
00263
00264 #define ADIO_WriteStrided(fd,buf,count,datatype,file_ptr_type,offset,status,error_code) \
00265 (*(fd->fns->ADIOI_xxx_WriteStrided))(fd,buf,count,datatype,file_ptr_type,offset,status,error_code)
00266
00267 #define ADIO_ReadStridedColl(fd,buf,count,datatype,file_ptr_type,offset,status,error_code) \
00268 (*(fd->fns->ADIOI_xxx_ReadStridedColl))(fd,buf,count,datatype,file_ptr_type,offset,status,error_code)
00269
00270 #define ADIO_WriteStridedColl(fd,buf,count,datatype,file_ptr_type,offset,status,error_code) \
00271 (*(fd->fns->ADIOI_xxx_WriteStridedColl))(fd,buf,count,datatype,file_ptr_type,offset,status,error_code)
00272
00273 #define ADIO_IreadStrided(fd,buf,count,datatype,file_ptr_type,offset,request,error_code) \
00274 (*(fd->fns->ADIOI_xxx_IreadStrided))(fd,buf,count,datatype,file_ptr_type,offset,request,error_code)
00275
00276 #define ADIO_IwriteStrided(fd,buf,count,datatype,file_ptr_type,offset,request,error_code) \
00277 (*(fd->fns->ADIOI_xxx_IwriteStrided))(fd,buf,count,datatype,file_ptr_type,offset,request,error_code)
00278
00279 #define ADIO_Flush(fd,error_code) (*(fd->fns->ADIOI_xxx_Flush))(fd,error_code)
00280
00281 #define ADIO_Resize(fd,size,error_code) \
00282 (*(fd->fns->ADIOI_xxx_Resize))(fd,size,error_code)
00283
00284 #define ADIO_Delete(filename,error_code) \
00285 (*(fd->fns->ADIOI_xxx_Delete))(filename,error_code)
00286
00287 #define ADIO_SetInfo(fd, users_info, error_code) \
00288 (*(fd->fns->ADIOI_xxx_SetInfo))(fd, users_info, error_code)
00289
00290 #define ADIO_Feature(fd, flag) \
00291 (*(fd->fns->ADIOI_xxx_Feature))(fd, flag)
00292
00293
00294
00295
00296
00297 typedef struct {
00298 ADIO_Offset *offsets;
00299 int *lens;
00300
00301
00302 MPI_Aint *mem_ptrs;
00303
00304
00305 int count;
00306 } ADIOI_Access;
00307
00308
00309
00310 typedef struct {
00311 ADIO_Offset *offsets;
00312 int *lens;
00313 int count;
00314 } ADIOI_Offlen;
00315
00316
00317
00318 void ADIOI_SetFunctions(ADIO_File fd);
00319 void ADIOI_Flatten_datatype(MPI_Datatype type);
00320 void ADIOI_Flatten(MPI_Datatype type, ADIOI_Flatlist_node *flat,
00321 ADIO_Offset st_offset, int *curr_index);
00322 void ADIOI_Delete_flattened(MPI_Datatype datatype);
00323 int ADIOI_Count_contiguous_blocks(MPI_Datatype type, int *curr_index);
00324 void ADIOI_Complete_async(int *error_code);
00325 void *ADIOI_Malloc_fn(size_t size, int lineno, const char *fname);
00326 void *ADIOI_Calloc_fn(size_t nelem, size_t elsize, int lineno, const char *fname);
00327 void *ADIOI_Realloc_fn(void *ptr, size_t size, int lineno, const char *fname);
00328 void ADIOI_Free_fn(void *ptr, int lineno, const char *fname);
00329 void ADIOI_Datatype_iscontig(MPI_Datatype datatype, int *flag);
00330 void ADIOI_Get_position(ADIO_File fd, ADIO_Offset *offset);
00331 void ADIOI_Get_eof_offset(ADIO_File fd, ADIO_Offset *eof_offset);
00332 void ADIOI_Get_byte_offset(ADIO_File fd, ADIO_Offset offset,
00333 ADIO_Offset *disp);
00334 void ADIOI_process_system_hints(MPI_Info info);
00335 void ADIOI_incorporate_system_hints(MPI_Info info, MPI_Info sysinfo,
00336 MPI_Info *new_info);
00337
00338
00339 void ADIOI_GEN_Fcntl(ADIO_File fd, int flag, ADIO_Fcntl_t *fcntl_struct,
00340 int *error_code);
00341 void ADIOI_GEN_Flush(ADIO_File fd, int *error_code);
00342 void ADIOI_GEN_OpenColl(ADIO_File fd, int rank,
00343 int access_mode, int *error_code);
00344 void ADIOI_SCALEABLE_OpenColl(ADIO_File fd, int rank,
00345 int access_mode, int *error_code);
00346 void ADIOI_FAILSAFE_OpenColl(ADIO_File fd, int rank,
00347 int access_mode, int *error_code);
00348 void ADIOI_GEN_Delete(char *filename, int *error_code);
00349 void ADIOI_GEN_ReadContig(ADIO_File fd, void *buf, int count,
00350 MPI_Datatype datatype, int file_ptr_type,
00351 ADIO_Offset offset, ADIO_Status *status,
00352 int *error_code);
00353 int ADIOI_GEN_aio(ADIO_File fd, void *buf, int len, ADIO_Offset offset,
00354 int wr, MPI_Request *request);
00355 void ADIOI_GEN_IreadContig(ADIO_File fd, void *buf, int count,
00356 MPI_Datatype datatype, int file_ptr_type,
00357 ADIO_Offset offset, ADIO_Request *request,
00358 int *error_code);
00359 void ADIOI_GEN_WriteContig(ADIO_File fd, void *buf, int count,
00360 MPI_Datatype datatype, int file_ptr_type,
00361 ADIO_Offset offset, ADIO_Status *status,
00362 int *error_code);
00363 void ADIOI_GEN_IwriteContig(ADIO_File fd, void *buf, int count,
00364 MPI_Datatype datatype, int file_ptr_type,
00365 ADIO_Offset offset, ADIO_Request *request,
00366 int *error_code);
00367 void ADIOI_GEN_ReadStrided(ADIO_File fd, void *buf, int count,
00368 MPI_Datatype datatype, int file_ptr_type,
00369 ADIO_Offset offset, ADIO_Status *status, int
00370 *error_code);
00371 void ADIOI_GEN_IreadStrided(ADIO_File fd, void *buf, int count,
00372 MPI_Datatype datatype, int file_ptr_type,
00373 ADIO_Offset offset, ADIO_Request *request, int
00374 *error_code);
00375 void ADIOI_GEN_IwriteStrided(ADIO_File fd, void *buf, int count,
00376 MPI_Datatype datatype, int file_ptr_type,
00377 ADIO_Offset offset, ADIO_Request *request, int
00378 *error_code);
00379 int ADIOI_GEN_IODone(ADIO_Request *request, ADIO_Status *status,
00380 int *error_code);
00381 void ADIOI_GEN_IOComplete(ADIO_Request *request, ADIO_Status *status,
00382 int *error_code);
00383 int ADIOI_GEN_aio_poll_fn(void *extra_state, ADIO_Status *status);
00384 int ADIOI_GEN_aio_wait_fn(int count, void **array_of_states, double timeout,
00385 ADIO_Status *status);
00386 int ADIOI_GEN_aio_query_fn(void *extra_state, ADIO_Status *status);
00387 int ADIOI_GEN_aio_free_fn(void *extra_state);
00388 int ADIOI_GEN_Feature(ADIO_File fd, int feature);
00389
00390 void ADIOI_GEN_ReadStrided_naive(ADIO_File fd, void *buf, int count,
00391 MPI_Datatype buftype, int file_ptr_type,
00392 ADIO_Offset offset, ADIO_Status *status, int
00393 *error_code);
00394 void ADIOI_GEN_WriteStrided(ADIO_File fd, void *buf, int count,
00395 MPI_Datatype datatype, int file_ptr_type,
00396 ADIO_Offset offset, ADIO_Status *status, int
00397 *error_code);
00398 void ADIOI_GEN_WriteStrided_naive(ADIO_File fd, void *buf, int count,
00399 MPI_Datatype datatype, int file_ptr_type,
00400 ADIO_Offset offset, ADIO_Status *status, int
00401 *error_code);
00402 void ADIOI_NOLOCK_WriteStrided(ADIO_File fd, void *buf, int count,
00403 MPI_Datatype datatype, int file_ptr_type,
00404 ADIO_Offset offset, ADIO_Status *status, int
00405 *error_code);
00406 void ADIOI_GEN_ReadStridedColl(ADIO_File fd, void *buf, int count,
00407 MPI_Datatype datatype, int file_ptr_type,
00408 ADIO_Offset offset, ADIO_Status *status, int
00409 *error_code);
00410 void ADIOI_GEN_WriteStridedColl(ADIO_File fd, void *buf, int count,
00411 MPI_Datatype datatype, int file_ptr_type,
00412 ADIO_Offset offset, ADIO_Status *status, int
00413 *error_code);
00414 void ADIOI_Calc_my_off_len(ADIO_File fd, int bufcount, MPI_Datatype
00415 datatype, int file_ptr_type, ADIO_Offset
00416 offset, ADIO_Offset **offset_list_ptr, ADIO_Offset
00417 **len_list_ptr, ADIO_Offset *start_offset_ptr,
00418 ADIO_Offset *end_offset_ptr, int
00419 *contig_access_count_ptr);
00420 void ADIOI_Calc_file_domains(ADIO_Offset *st_offsets, ADIO_Offset
00421 *end_offsets, int nprocs, int nprocs_for_coll,
00422 ADIO_Offset *min_st_offset_ptr,
00423 ADIO_Offset **fd_start_ptr, ADIO_Offset
00424 **fd_end_ptr, int min_fd_size,
00425 ADIO_Offset *fd_size_ptr,
00426 int striping_unit);
00427 int ADIOI_Calc_aggregator(ADIO_File fd,
00428 ADIO_Offset off,
00429 ADIO_Offset min_off,
00430 ADIO_Offset *len,
00431 ADIO_Offset fd_size,
00432 ADIO_Offset *fd_start,
00433 ADIO_Offset *fd_end);
00434 void ADIOI_Calc_my_req(ADIO_File fd, ADIO_Offset *offset_list,
00435 ADIO_Offset *len_list, int
00436 contig_access_count, ADIO_Offset
00437 min_st_offset, ADIO_Offset *fd_start,
00438 ADIO_Offset *fd_end, ADIO_Offset fd_size,
00439 int nprocs,
00440 int *count_my_req_procs_ptr,
00441 int **count_my_req_per_proc_ptr,
00442 ADIOI_Access **my_req_ptr,
00443 int **buf_idx_ptr);
00444 void ADIOI_Calc_others_req(ADIO_File fd, int count_my_req_procs,
00445 int *count_my_req_per_proc,
00446 ADIOI_Access *my_req,
00447 int nprocs, int myrank,
00448 int *count_others_req_procs_ptr,
00449 ADIOI_Access **others_req_ptr);
00450
00451
00452
00453 #define TEMP_OFF 0
00454 #define REAL_OFF 1
00455 #define MAX_OFF_TYPE 2
00456
00457
00458 #define DATA_TAG 30
00459 #define AMT_TAG 31
00460
00461
00462 #define ADIOI_FR_AAR 0
00463 #define ADIOI_FR_FSZ -1
00464 #define ADIOI_FR_USR_REALMS -2
00465
00466 typedef struct flatten_state
00467 {
00468 ADIO_Offset abs_off;
00469 ADIO_Offset cur_sz;
00470 ADIO_Offset idx;
00471 ADIO_Offset cur_reg_off;
00472 } flatten_state;
00473
00474 typedef struct view_state
00475 {
00476 ADIO_Offset fp_ind;
00477 ADIO_Offset disp;
00478 ADIO_Offset byte_off;
00479 ADIO_Offset sz;
00480 ADIO_Offset ext;
00481 ADIO_Offset type_sz;
00482
00483
00484 flatten_state cur_state;
00485
00486 flatten_state tmp_state;
00487
00488
00489 ADIO_Offset pre_sz;
00490 int pre_ol_ct;
00491 MPI_Aint *pre_disp_arr;
00492 int *pre_blk_arr;
00493
00494 ADIOI_Flatlist_node *flat_type_p;
00495 } view_state;
00496
00497 void ADIOI_Calc_bounds (ADIO_File fd, int count, MPI_Datatype buftype,
00498 int file_ptr_type, ADIO_Offset offset,
00499 ADIO_Offset *st_offset, ADIO_Offset *end_offset);
00500 int ADIOI_Agg_idx (int rank, ADIO_File fd);
00501 void ADIOI_Calc_file_realms (ADIO_File fd, ADIO_Offset min_st_offset,
00502 ADIO_Offset max_end_offset);
00503 void ADIOI_IOFiletype(ADIO_File fd, void *buf, int count,
00504 MPI_Datatype datatype, int file_ptr_type,
00505 ADIO_Offset offset, MPI_Datatype custom_ftype,
00506 int rdwr, ADIO_Status *status, int
00507 *error_code);
00508 void ADIOI_IOStridedColl(ADIO_File fd, void *buf, int count, int rdwr,
00509 MPI_Datatype datatype, int file_ptr_type,
00510 ADIO_Offset offset, ADIO_Status *status, int
00511 *error_code);
00512 void ADIOI_Print_flatlist_node(ADIOI_Flatlist_node *flatlist_node_p);
00513 ADIOI_Flatlist_node * ADIOI_Add_contig_flattened(MPI_Datatype contig_type);
00514 void ADIOI_Exch_file_views(int myrank, int nprocs, int file_ptr_type,
00515 ADIO_File fd, int count,
00516 MPI_Datatype datatype, ADIO_Offset off,
00517 view_state *my_mem_view_state_arr,
00518 view_state *agg_file_view_state_arr,
00519 view_state *client_file_view_state_arr);
00520 int ADIOI_init_view_state(int file_ptr_type,
00521 int nprocs,
00522 view_state *view_state_arr,
00523 int op_type);
00524 int ADIOI_Build_agg_reqs(ADIO_File fd, int rw_type, int nprocs,
00525 view_state *client_file_view_state_arr,
00526 MPI_Datatype *client_comm_dtype_arr,
00527 ADIO_Offset *client_comm_sz_arr,
00528 ADIO_Offset *agg_dtype_offset_p,
00529 MPI_Datatype *agg_dtype_p);
00530 int ADIOI_Build_client_reqs(ADIO_File fd,
00531 int nprocs,
00532 view_state *my_mem_view_state_arr,
00533 view_state *agg_file_view_state_arr,
00534 ADIO_Offset *agg_comm_sz_arr,
00535 MPI_Datatype *agg_comm_dtype_arr);
00536 int ADIOI_Build_client_pre_req(ADIO_File fd,
00537 int agg_rank,
00538 int agg_idx,
00539 view_state *my_mem_view_state_p,
00540 view_state *agg_file_view_state_p,
00541 ADIO_Offset max_pre_req_sz,
00542 int max_ol_ct);
00543 int ADIOI_Build_client_req(ADIO_File fd,
00544 int agg_rank,
00545 int agg_idx,
00546 view_state *my_mem_view_state_p,
00547 view_state *agg_file_view_state_p,
00548 ADIO_Offset agg_comm_sz,
00549 MPI_Datatype *agg_comm_dtype_p);
00550
00551 ADIO_Offset ADIOI_GEN_SeekIndividual(ADIO_File fd, ADIO_Offset offset,
00552 int whence, int *error_code);
00553 void ADIOI_GEN_Resize(ADIO_File fd, ADIO_Offset size, int *error_code);
00554 void ADIOI_GEN_SetInfo(ADIO_File fd, MPI_Info users_info, int *error_code);
00555 void ADIOI_GEN_Close(ADIO_File fd, int *error_code);
00556 void ADIOI_Shfp_fname(ADIO_File fd, int rank);
00557 void ADIOI_GEN_Prealloc(ADIO_File fd, ADIO_Offset size, int *error_code);
00558 int ADIOI_Error(ADIO_File fd, int error_code, char *string);
00559 int MPIR_Err_setmsg( int, int, const char *, const char *, const char *, ... );
00560 int ADIOI_End_call(MPI_Comm comm, int keyval, void *attribute_val, void *extra_state);
00561 int MPIR_Status_set_bytes(MPI_Status *status, MPI_Datatype datatype, int nbytes);
00562 int ADIOI_Uses_generic_read(ADIO_File fd);
00563 int ADIOI_Uses_generic_write(ADIO_File fd);
00564
00565
00566 int ADIOI_FAKE_IODone(ADIO_Request *request, ADIO_Status *status,
00567 int *error_code);
00568 void ADIOI_FAKE_IreadContig(ADIO_File fd, void *buf, int count,
00569 MPI_Datatype datatype, int file_ptr_type,
00570 ADIO_Offset offset, ADIO_Request *request,
00571 int *error_code);
00572 void ADIOI_FAKE_IreadStrided(ADIO_File fd, void *buf, int count,
00573 MPI_Datatype datatype, int file_ptr_type,
00574 ADIO_Offset offset, ADIO_Request *request,
00575 int *error_code);
00576 void ADIOI_FAKE_IwriteContig(ADIO_File fd, void *buf, int count,
00577 MPI_Datatype datatype, int file_ptr_type,
00578 ADIO_Offset offset, ADIO_Request *request,
00579 int *error_code);
00580 void ADIOI_FAKE_IwriteStrided(ADIO_File fd, void *buf, int count,
00581 MPI_Datatype datatype, int file_ptr_type,
00582 ADIO_Offset offset, ADIO_Request *request,
00583 int *error_code);
00584 void ADIOI_FAKE_IOComplete(ADIO_Request *request, ADIO_Status *status,
00585 int *error_code);
00586
00587
00588
00589 int MPIOI_File_read(MPI_File fh,
00590 MPI_Offset offset,
00591 int file_ptr_type,
00592 void *buf,
00593 int count,
00594 MPI_Datatype datatype,
00595 char *myname,
00596 MPI_Status *status);
00597 int MPIOI_File_write(MPI_File fh,
00598 MPI_Offset offset,
00599 int file_ptr_type,
00600 void *buf,
00601 int count,
00602 MPI_Datatype datatype,
00603 char *myname,
00604 MPI_Status *status);
00605 int MPIOI_File_read_all(MPI_File fh,
00606 MPI_Offset offset,
00607 int file_ptr_type,
00608 void *buf,
00609 int count,
00610 MPI_Datatype datatype,
00611 char *myname,
00612 MPI_Status *status);
00613 int MPIOI_File_write_all(MPI_File fh,
00614 MPI_Offset offset,
00615 int file_ptr_type,
00616 void *buf,
00617 int count,
00618 MPI_Datatype datatype,
00619 char *myname,
00620 MPI_Status *status);
00621 int MPIOI_File_read_all_begin(MPI_File fh,
00622 MPI_Offset offset,
00623 int file_ptr_type,
00624 void *buf,
00625 int count,
00626 MPI_Datatype datatype,
00627 char *myname);
00628 int MPIOI_File_write_all_begin(MPI_File fh,
00629 MPI_Offset offset,
00630 int file_ptr_type,
00631 void *buf,
00632 int count,
00633 MPI_Datatype datatype,
00634 char *myname);
00635 int MPIOI_File_read_all_end(MPI_File fh,
00636 void *buf,
00637 char *myname,
00638 MPI_Status *status);
00639 int MPIOI_File_write_all_end(MPI_File fh,
00640 void *buf,
00641 char *myname,
00642 MPI_Status *status);
00643 int MPIOI_File_iwrite(MPI_File fh,
00644 MPI_Offset offset,
00645 int file_ptr_type,
00646 void *buf,
00647 int count,
00648 MPI_Datatype datatype,
00649 char *myname,
00650 MPI_Request *request);
00651 int MPIOI_File_iread(MPI_File fh,
00652 MPI_Offset offset,
00653 int file_ptr_type,
00654 void *buf,
00655 int count,
00656 MPI_Datatype datatype,
00657 char *myname,
00658 MPI_Request *request);
00659
00660
00661
00662
00663
00664 #if (defined(ROMIO_HFS) || defined(ROMIO_XFS))
00665
00666 # define ADIOI_WRITE_LOCK(fd, offset, whence, len) \
00667 do {if (((fd)->file_system == ADIO_XFS) || ((fd)->file_system == ADIO_HFS)) \
00668 ADIOI_Set_lock64((fd)->fd_sys, F_SETLKW64, F_WRLCK, offset, whence, len);\
00669 else ADIOI_Set_lock((fd)->fd_sys, F_SETLKW, F_WRLCK, offset, whence, len); } while (0)
00670
00671 # define ADIOI_READ_LOCK(fd, offset, whence, len) \
00672 do {if (((fd)->file_system == ADIO_XFS) || ((fd)->file_system == ADIO_HFS)) \
00673 ADIOI_Set_lock64((fd)->fd_sys, F_SETLKW64, F_RDLCK, offset, whence, len);\
00674 else ADIOI_Set_lock((fd)->fd_sys, F_SETLKW, F_RDLCK, offset, whence, len); }while (0)
00675
00676 # define ADIOI_UNLOCK(fd, offset, whence, len) \
00677 do {if (((fd)->file_system == ADIO_XFS) || ((fd)->file_system == ADIO_HFS)) \
00678 ADIOI_Set_lock64((fd)->fd_sys, F_SETLK64, F_UNLCK, offset, whence, len); \
00679 else ADIOI_Set_lock((fd)->fd_sys, F_SETLK, F_UNLCK, offset, whence, len); }while (0)
00680
00681 #elif (defined(ROMIO_NTFS))
00682
00683 #define ADIOI_LOCK_CMD 0
00684 #define ADIOI_UNLOCK_CMD 1
00685
00686 # define ADIOI_WRITE_LOCK(fd, offset, whence, len) \
00687 ADIOI_Set_lock((fd)->fd_sys, ADIOI_LOCK_CMD, LOCKFILE_EXCLUSIVE_LOCK, offset, whence, len)
00688 # define ADIOI_READ_LOCK(fd, offset, whence, len) \
00689 ADIOI_Set_lock((fd)->fd_sys, ADIOI_LOCK_CMD, 0, offset, whence, len)
00690 # define ADIOI_UNLOCK(fd, offset, whence, len) \
00691 ADIOI_Set_lock((fd)->fd_sys, ADIOI_UNLOCK_CMD, LOCKFILE_FAIL_IMMEDIATELY, offset, whence, len)
00692
00693 #else
00694
00695 #ifdef ADIOI_MPE_LOGGING
00696 # define ADIOI_WRITE_LOCK(fd, offset, whence, len) do { \
00697 MPE_Log_event( ADIOI_MPE_writelock_a, 0, NULL ); \
00698 ADIOI_Set_lock((fd)->fd_sys, F_SETLKW, F_WRLCK, offset, whence, len); \
00699 MPE_Log_event( ADIOI_MPE_writelock_b, 0, NULL ); } while( 0 )
00700 # define ADIOI_READ_LOCK(fd, offset, whence, len) \
00701 MPE_Log_event( ADIOI_MPE_readlock_a, 0, NULL ); do { \
00702 ADIOI_Set_lock((fd)->fd_sys, F_SETLKW, F_RDLCK, offset, whence, len); \
00703 MPE_Log_event( ADIOI_MPE_readlock_b, 0, NULL ); } while( 0 )
00704 # define ADIOI_UNLOCK(fd, offset, whence, len) do { \
00705 MPE_Log_event( ADIOI_MPE_unlock_a, 0, NULL ); \
00706 ADIOI_Set_lock((fd)->fd_sys, F_SETLK, F_UNLCK, offset, whence, len); \
00707 MPE_Log_event( ADIOI_MPE_unlock_b, 0, NULL ); } while( 0 )
00708 #else
00709 # define ADIOI_WRITE_LOCK(fd, offset, whence, len) \
00710 ADIOI_Set_lock((fd)->fd_sys, F_SETLKW, F_WRLCK, offset, whence, len)
00711 # define ADIOI_READ_LOCK(fd, offset, whence, len) \
00712 ADIOI_Set_lock((fd)->fd_sys, F_SETLKW, F_RDLCK, offset, whence, len)
00713 # define ADIOI_UNLOCK(fd, offset, whence, len) \
00714 ADIOI_Set_lock((fd)->fd_sys, F_SETLK, F_UNLCK, offset, whence, len)
00715 #endif
00716
00717 #endif
00718
00719 int ADIOI_Set_lock(FDTYPE fd_sys, int cmd, int type, ADIO_Offset offset, int whence, ADIO_Offset len);
00720 int ADIOI_Set_lock64(FDTYPE fd_sys, int cmd, int type, ADIO_Offset offset, int whence, ADIO_Offset len);
00721
00722 #define ADIOI_Malloc(a) ADIOI_Malloc_fn(a,__LINE__,__FILE__)
00723 #define ADIOI_Calloc(a,b) ADIOI_Calloc_fn(a,b,__LINE__,__FILE__)
00724 #define ADIOI_Realloc(a,b) ADIOI_Realloc_fn(a,b,__LINE__,__FILE__)
00725 #define ADIOI_Free(a) ADIOI_Free_fn(a,__LINE__,__FILE__)
00726
00727 int ADIOI_Strncpy( char *outstr, const char *instr, size_t maxlen );
00728 int ADIOI_Strnapp( char *, const char *, size_t );
00729 char *ADIOI_Strdup( const char * );
00730
00731
00732
00733
00734
00735
00736
00737
00738 #define ADIOI_Info_set(info_,key_str_,val_) \
00739 MPI_Info_set((info_),((char*)key_str_),(char*)(val_))
00740 #define ADIOI_Info_get(info_,key_str_,val_len_,val_,flag_) \
00741 MPI_Info_get((info_),((char*)key_str_),(val_len_),(val_),(flag_))
00742 #define ADIOI_Info_get_valuelen(info_,key_str_,val_len_,flag_) \
00743 MPI_Info_get_valuelen((info_),((char*)key_str_),(val_len_),(flag_))
00744 #define ADIOI_Info_delete(info_,key_str_) \
00745 MPI_Info_delete((info_),((char*)key_str_))
00746
00747
00748
00749
00750 #ifndef ATTRIBUTE
00751 #ifdef HAVE_GCC_ATTRIBUTE
00752 #define ATTRIBUTE(a) __attribute__(a)
00753 #else
00754 #define ATTRIBUTE(a)
00755 #endif
00756 #endif
00757
00758
00759
00760 #ifdef HAVE_SNPRINTF
00761 #define ADIOI_Snprintf snprintf
00762
00763 #ifdef NEEDS_SNPRINTF_DECL
00764 extern int snprintf( char *, size_t, const char *, ... ) ATTRIBUTE((format(printf,3,4)));
00765 #endif
00766 #else
00767 int ADIOI_Snprintf( char *str, size_t size, const char *format, ... )
00768 ATTRIBUTE((format(printf,3,4)));
00769 #endif
00770
00771 #define FPRINTF fprintf
00772
00773 #ifndef HAVE_STRERROR
00774 # ifdef HAVE_SYSERRLIST
00775 extern char *sys_errlist[];
00776 # define strerror(n) sys_errlist[n]
00777 # else
00778 # define PRINT_ERR_MSG
00779 # endif
00780 #endif
00781
00782 #include "adioi_error.h"
00783
00784
00785
00786 #ifdef ADIOI_MPE_LOGGING
00787 #include "mpe.h"
00788
00789 int ADIOI_MPE_open_a;
00790 int ADIOI_MPE_open_b;
00791 int ADIOI_MPE_read_a;
00792 int ADIOI_MPE_read_b;
00793 int ADIOI_MPE_write_a;
00794 int ADIOI_MPE_write_b;
00795 int ADIOI_MPE_lseek_a;
00796 int ADIOI_MPE_lseek_b;
00797 int ADIOI_MPE_close_a;
00798 int ADIOI_MPE_close_b;
00799 int ADIOI_MPE_writelock_a;
00800 int ADIOI_MPE_writelock_b;
00801 int ADIOI_MPE_readlock_a;
00802 int ADIOI_MPE_readlock_b;
00803 int ADIOI_MPE_unlock_a;
00804 int ADIOI_MPE_unlock_b;
00805 int ADIOI_MPE_postwrite_a;
00806 int ADIOI_MPE_postwrite_b;
00807 int ADIOI_MPE_openinternal_a;
00808 int ADIOI_MPE_openinternal_b;
00809 int ADIOI_MPE_stat_a;
00810 int ADIOI_MPE_stat_b;
00811 int ADIOI_MPE_iread_a;
00812 int ADIOI_MPE_iread_b;
00813 int ADIOI_MPE_iwrite_a;
00814 int ADIOI_MPE_iwrite_b;
00815 #endif
00816
00817 #ifdef ROMIO_INSIDE_MPICH2
00818
00819
00820
00821
00822
00823
00824
00825 #include "mpiimpl.h"
00826
00827 #define ADIOI_AINT_CAST_TO_VOID_PTR (void*)(MPIR_Pint)
00828
00829
00830 #define ADIOI_AINT_CAST_TO_LONG_LONG (long long)
00831 #define ADIOI_AINT_CAST_TO_OFFSET ADIOI_AINT_CAST_TO_LONG_LONG
00832
00833 #define ADIOI_ENSURE_AINT_FITS_IN_PTR(aint_value) MPID_Ensure_Aint_fits_in_pointer(aint_value)
00834 #define ADIOI_Assert MPIU_Assert
00835 #else
00836 #include <assert.h>
00837 #define ADIOI_AINT_CAST_TO_VOID_PTR (void*)
00838 #define ADIOI_AINT_CAST_TO_LONG_LONG (long long)
00839 #define ADIOI_AINT_CAST_TO_OFFSET ADIOI_AINT_CAST_TO_LONG_LONG
00840 #define ADIOI_ENSURE_AINT_FITS_IN_PTR(aint_value)
00841 #define ADIOI_Assert assert
00842 #define MPIR_Upint unsigned long
00843 #define MPIU_THREADPRIV_DECL
00844 #endif
00845
00846 #ifdef USE_DBG_LOGGING
00847
00848 #define DBGT_FPRINTF if (MPIU_DBG_SELECTED(ROMIO,VERBOSE)) fprintf(stderr,"%s:%d:",__FILE__,__LINE__); \
00849 if (MPIU_DBG_SELECTED(ROMIO,TERSE)) fprintf
00850
00851 #define DBG_FPRINTF if (MPIU_DBG_SELECTED(ROMIO,VERBOSE)) fprintf(stderr,"%s:%d:",__FILE__,__LINE__); \
00852 if (MPIU_DBG_SELECTED(ROMIO,TYPICAL)) fprintf
00853
00854 #define DBGV_FPRINTF if (MPIU_DBG_SELECTED(ROMIO,VERBOSE)) fprintf(stderr,"%s:%d:",__FILE__,__LINE__); \
00855 if (MPIU_DBG_SELECTED(ROMIO,VERBOSE)) fprintf
00856 #else
00857 #define DBGT_FPRINTF if (0) fprintf
00858 #define DBG_FPRINTF if (0) fprintf
00859 #define DBGV_FPRINTF if (0) fprintf
00860 #endif
00861 #endif
00862