00001
00002
00003
00004
00005
00006
00007
00008 #ifndef DATALOOP_PARTS_H
00009 #define DATALOOP_PARTS_H
00010
00011
00012 #ifndef PREPEND_PREFIX
00013 #error "PREPEND_PREFIX must be defined before dataloop_parts.h is included."
00014 #endif
00015
00016 #ifndef DLOOP_Offset
00017 #error "DLOOP_Offset must be defined before dataloop_parts.h is included."
00018 #endif
00019
00020 #ifndef DLOOP_Count
00021 #error "DLOOP_Count must be defined before dataloop_parts.h is included."
00022 #endif
00023
00024 #ifndef DLOOP_Handle
00025 #error "DLOOP_Handle must be defined before dataloop_parts.h is included."
00026 #endif
00027
00028 #ifndef DLOOP_Buffer
00029 #error "DLOOP_Buffer must be defined before dataloop_parts.h is included."
00030 #endif
00031
00032 #ifndef DLOOP_Type
00033 #error "DLOOP_Type must be defined before dataloop_parts.h is included."
00034 #endif
00035
00036
00037 #define DLOOP_Dataloop PREPEND_PREFIX(Dataloop)
00038 #define DLOOP_Dataloop_contig PREPEND_PREFIX(Dataloop_contig)
00039 #define DLOOP_Dataloop_vector PREPEND_PREFIX(Dataloop_vector)
00040 #define DLOOP_Dataloop_blockindexed PREPEND_PREFIX(Dataloop_blockindexed)
00041 #define DLOOP_Dataloop_indexed PREPEND_PREFIX(Dataloop_indexed)
00042 #define DLOOP_Dataloop_struct PREPEND_PREFIX(Dataloop_struct)
00043 #define DLOOP_Dataloop_common PREPEND_PREFIX(Dataloop_common)
00044 #define DLOOP_Segment PREPEND_PREFIX(Segment)
00045 #define DLOOP_Dataloop_stackelm PREPEND_PREFIX(Dataloop_stackelm)
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055 #define DLOOP_DATALOOP_HOMOGENEOUS 0
00056 #define DLOOP_DATALOOP_HETEROGENEOUS 1
00057 #define DLOOP_DATALOOP_ALL_BYTES 2
00058
00059
00060 #define SEGMENT_IGNORE_LAST ((DLOOP_Offset) -1)
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084 typedef struct DLOOP_Dataloop_contig {
00085 DLOOP_Count count;
00086 struct DLOOP_Dataloop *dataloop;
00087 } DLOOP_Dataloop_contig;
00088
00089
00090
00091
00092
00093
00094
00095
00096
00097
00098
00099
00100
00101 typedef struct DLOOP_Dataloop_vector {
00102 DLOOP_Count count;
00103 struct DLOOP_Dataloop *dataloop;
00104 DLOOP_Count blocksize;
00105 DLOOP_Offset stride;
00106 } DLOOP_Dataloop_vector;
00107
00108
00109
00110
00111
00112
00113
00114
00115
00116
00117
00118
00119
00120
00121
00122 typedef struct DLOOP_Dataloop_blockindexed {
00123 DLOOP_Count count;
00124 struct DLOOP_Dataloop *dataloop;
00125 DLOOP_Count blocksize;
00126 DLOOP_Offset *offset_array;
00127 } DLOOP_Dataloop_blockindexed;
00128
00129
00130
00131
00132
00133
00134
00135
00136
00137
00138
00139
00140
00141
00142
00143 typedef struct DLOOP_Dataloop_indexed {
00144 DLOOP_Count count;
00145 struct DLOOP_Dataloop *dataloop;
00146 DLOOP_Count *blocksize_array;
00147 DLOOP_Offset *offset_array;
00148 DLOOP_Count total_blocks;
00149 } DLOOP_Dataloop_indexed;
00150
00151
00152
00153
00154
00155
00156
00157
00158
00159
00160
00161
00162
00163
00164 typedef struct DLOOP_Dataloop_struct {
00165 DLOOP_Count count;
00166 struct DLOOP_Dataloop **dataloop_array;
00167 DLOOP_Count *blocksize_array;
00168 DLOOP_Offset *offset_array;
00169 DLOOP_Offset *el_extent_array;
00170 } DLOOP_Dataloop_struct;
00171
00172
00173
00174
00175
00176
00177
00178 typedef struct DLOOP_Dataloop_common {
00179 DLOOP_Count count;
00180 struct DLOOP_Dataloop *dataloop;
00181 } DLOOP_Dataloop_common;
00182
00183
00184
00185
00186
00187
00188
00189
00190
00191
00192
00193
00194
00195
00196
00197
00198
00199
00200
00201
00202
00203
00204
00205
00206
00207
00208
00209
00210
00211
00212 typedef struct DLOOP_Dataloop {
00213 int kind;
00214
00215
00216
00217 union {
00218 DLOOP_Count count;
00219 DLOOP_Dataloop_contig c_t;
00220 DLOOP_Dataloop_vector v_t;
00221 DLOOP_Dataloop_blockindexed bi_t;
00222 DLOOP_Dataloop_indexed i_t;
00223 DLOOP_Dataloop_struct s_t;
00224 DLOOP_Dataloop_common cm_t;
00225 } loop_params;
00226 DLOOP_Offset el_size;
00227
00228
00229 DLOOP_Offset el_extent;
00230 DLOOP_Type el_type;
00231 } DLOOP_Dataloop;
00232
00233 #define DLOOP_FINAL_MASK 0x00000008
00234 #define DLOOP_KIND_MASK 0x00000007
00235 #define DLOOP_KIND_CONTIG 0x1
00236 #define DLOOP_KIND_VECTOR 0x2
00237 #define DLOOP_KIND_BLOCKINDEXED 0x3
00238 #define DLOOP_KIND_INDEXED 0x4
00239 #define DLOOP_KIND_STRUCT 0x5
00240
00241
00242
00243
00244
00245 #define DLOOP_MAX_DATATYPE_DEPTH 8
00246
00247
00248
00249
00250
00251
00252
00253
00254
00255
00256
00257
00258
00259
00260
00261
00262
00263
00264
00265
00266
00267
00268 typedef struct DLOOP_Dataloop_stackelm {
00269 int may_require_reloading;
00270
00271
00272
00273 DLOOP_Count curcount;
00274 DLOOP_Offset curoffset;
00275 DLOOP_Count curblock;
00276
00277 DLOOP_Count orig_count;
00278 DLOOP_Offset orig_offset;
00279 DLOOP_Count orig_block;
00280
00281 struct DLOOP_Dataloop *loop_p;
00282 } DLOOP_Dataloop_stackelm;
00283
00284
00285
00286
00287
00288
00289
00290
00291
00292
00293
00294
00295
00296 typedef struct DLOOP_Segment {
00297 void *ptr;
00298 DLOOP_Handle handle;
00299 DLOOP_Offset stream_off;
00300
00301
00302
00303 DLOOP_Dataloop_stackelm stackelm[DLOOP_MAX_DATATYPE_DEPTH];
00304 int cur_sp;
00305 int valid_sp;
00306
00307
00308
00309
00310 struct DLOOP_Dataloop builtin_loop;
00311
00312
00313
00314
00315
00316
00317 } DLOOP_Segment;
00318
00319
00320 void PREPEND_PREFIX(Dataloop_copy)(void *dest,
00321 void *src,
00322 int size);
00323 void PREPEND_PREFIX(Dataloop_update)(DLOOP_Dataloop *dataloop,
00324 DLOOP_Offset ptrdiff);
00325 DLOOP_Offset
00326 PREPEND_PREFIX(Dataloop_stream_size)(DLOOP_Dataloop *dl_p,
00327 DLOOP_Offset (*sizefn)(DLOOP_Type el_type));
00328 void PREPEND_PREFIX(Dataloop_print)(DLOOP_Dataloop *dataloop,
00329 int depth);
00330
00331 void PREPEND_PREFIX(Dataloop_alloc)(int kind,
00332 DLOOP_Count count,
00333 DLOOP_Dataloop **new_loop_p,
00334 int *new_loop_sz_p);
00335 void PREPEND_PREFIX(Dataloop_alloc_and_copy)(int kind,
00336 DLOOP_Count count,
00337 DLOOP_Dataloop *old_loop,
00338 int old_loop_sz,
00339 DLOOP_Dataloop **new_loop_p,
00340 int *new_loop_sz_p);
00341 void PREPEND_PREFIX(Dataloop_struct_alloc)(DLOOP_Count count,
00342 int old_loop_sz,
00343 int basic_ct,
00344 DLOOP_Dataloop **old_loop_p,
00345 DLOOP_Dataloop **new_loop_p,
00346 int *new_loop_sz_p);
00347 void PREPEND_PREFIX(Dataloop_dup)(DLOOP_Dataloop *old_loop,
00348 int old_loop_sz,
00349 DLOOP_Dataloop **new_loop_p);
00350
00351 void PREPEND_PREFIX(Dataloop_free)(DLOOP_Dataloop **dataloop);
00352
00353
00354 DLOOP_Segment * PREPEND_PREFIX(Segment_alloc)(void);
00355
00356 void PREPEND_PREFIX(Segment_free)(DLOOP_Segment *segp);
00357
00358 int PREPEND_PREFIX(Segment_init)(const DLOOP_Buffer buf,
00359 DLOOP_Count count,
00360 DLOOP_Handle handle,
00361 DLOOP_Segment *segp,
00362 int hetero);
00363
00364 void
00365 PREPEND_PREFIX(Segment_manipulate)(DLOOP_Segment *segp,
00366 DLOOP_Offset first,
00367 DLOOP_Offset *lastp,
00368 int (*piecefn) (DLOOP_Offset *blocks_p,
00369 DLOOP_Type el_type,
00370 DLOOP_Offset rel_off,
00371 DLOOP_Buffer bufp,
00372 void *v_paramp),
00373 int (*vectorfn) (DLOOP_Offset *blocks_p,
00374 DLOOP_Count count,
00375 DLOOP_Count blklen,
00376 DLOOP_Offset stride,
00377 DLOOP_Type el_type,
00378 DLOOP_Offset rel_off,
00379 DLOOP_Buffer bufp,
00380 void *v_paramp),
00381 int (*blkidxfn) (DLOOP_Offset *blocks_p,
00382 DLOOP_Count count,
00383 DLOOP_Count blklen,
00384 DLOOP_Offset *offsetarray,
00385 DLOOP_Type el_type,
00386 DLOOP_Offset rel_off,
00387 DLOOP_Buffer bufp,
00388 void *v_paramp),
00389 int (*indexfn) (DLOOP_Offset *blocks_p,
00390 DLOOP_Count count,
00391 DLOOP_Count *blockarray,
00392 DLOOP_Offset *offsetarray,
00393 DLOOP_Type el_type,
00394 DLOOP_Offset rel_off,
00395 DLOOP_Buffer bufp,
00396 void *v_paramp),
00397 DLOOP_Offset (*sizefn) (DLOOP_Type el_type),
00398 void *pieceparams);
00399
00400
00401 void PREPEND_PREFIX(Segment_count_contig_blocks)(DLOOP_Segment *segp,
00402 DLOOP_Offset first,
00403 DLOOP_Offset *lastp,
00404 DLOOP_Count *countp);
00405 void PREPEND_PREFIX(Segment_mpi_flatten)(DLOOP_Segment *segp,
00406 DLOOP_Offset first,
00407 DLOOP_Offset *lastp,
00408 int *blklens,
00409 MPI_Aint *disps,
00410 int *lengthp);
00411
00412 #define DLOOP_M2M_TO_USERBUF 0
00413 #define DLOOP_M2M_FROM_USERBUF 1
00414
00415 struct PREPEND_PREFIX(m2m_params) {
00416 int direction;
00417 char *streambuf;
00418 char *userbuf;
00419 };
00420
00421 void PREPEND_PREFIX(Segment_pack)(struct DLOOP_Segment *segp,
00422 DLOOP_Offset first,
00423 DLOOP_Offset *lastp,
00424 void *streambuf);
00425 void PREPEND_PREFIX(Segment_unpack)(struct DLOOP_Segment *segp,
00426 DLOOP_Offset first,
00427 DLOOP_Offset *lastp,
00428 void *streambuf);
00429
00430
00431 int PREPEND_PREFIX(Segment_contig_m2m)(DLOOP_Offset *blocks_p,
00432 DLOOP_Type el_type,
00433 DLOOP_Offset rel_off,
00434 void *bufp,
00435 void *v_paramp);
00436 int PREPEND_PREFIX(Segment_vector_m2m)(DLOOP_Offset *blocks_p,
00437 DLOOP_Count count,
00438 DLOOP_Count blksz,
00439 DLOOP_Offset stride,
00440 DLOOP_Type el_type,
00441 DLOOP_Offset rel_off,
00442 void *bufp,
00443 void *v_paramp);
00444 int PREPEND_PREFIX(Segment_blkidx_m2m)(DLOOP_Offset *blocks_p,
00445 DLOOP_Count count,
00446 DLOOP_Count blocklen,
00447 DLOOP_Offset *offsetarray,
00448 DLOOP_Type el_type,
00449 DLOOP_Offset rel_off,
00450 void *bufp,
00451 void *v_paramp);
00452 int PREPEND_PREFIX(Segment_index_m2m)(DLOOP_Offset *blocks_p,
00453 DLOOP_Count count,
00454 DLOOP_Count *blockarray,
00455 DLOOP_Offset *offsetarray,
00456 DLOOP_Type el_type,
00457 DLOOP_Offset rel_off,
00458 void *bufp,
00459 void *v_paramp);
00460 #endif
00461
00462
00463