diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2002-07-24 18:56:48 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2002-07-24 18:56:48 (GMT) |
commit | 40df66ebd027351e48eea8b7499490c9654d3943 (patch) | |
tree | 9dd8b9170bec792e840e2b350ca48153cd45ce88 /src/H5Sprivate.h | |
parent | c968525b29ce8cee8e842f6a7a1bbd78acc6b63f (diff) | |
download | hdf5-40df66ebd027351e48eea8b7499490c9654d3943.zip hdf5-40df66ebd027351e48eea8b7499490c9654d3943.tar.gz hdf5-40df66ebd027351e48eea8b7499490c9654d3943.tar.bz2 |
[svn-r5834] Purpose:
Large code cleanup/re-write
Description:
This is phase 1 of the data I/O re-architecture, with the following changes:
- Changed the selection drivers to not actually do any I/O, they
only generate the sequences of offset/length pairs needed for
the I/O (or memory access, in the case of iterating or filling
a selection in a memory buffer)
- Wrote more abstract I/O routines which get the sequence of offset/
length pairs for each selection and access perform the I/O or
memory access.
Benefits of this change include:
- Removed ~3400 lines of quite redundant code, with corresponding
reduction in the size of library binary.
- Any selection can now directly access memory when performing I/O,
if no type conversions are required, instead of just "regular"
hyperslab and 'all' selections, which speeds up I/O.
- Sped up I/O for hyperslab selections which have contiguous lower
dimensions by "flattening" them out into lesser dimensional objects
for the I/O.
No file format or API changes were necessary for this change.
The next phase will be to create a "selection driver" for each type of
selection, allowing each type of selection to directly call certain
methods that only apply to that type of selection, instead of passing
through dozens of functions which have switch statements to call the
appropriate method for each selection type. This will also reduce
the amount of code in the library and speed things up a bit more.
Phase 3 will involve generating an MPI datatype for all types of selections,
instead of only "regular" hyperslab and 'all' selections. This will
allow collective parallel I/O for all I/O operations which don't
require type conversions. It will also open up the door for allowing
collective I/O on datasets which require type conversion.
Phase 4 will involve changing the access pattern to deal with chunked
datasets in a more optimal way (in serial).
Phase 5 will deal with accessing chunked datasets more optimally for
collective parallel I/O operations.
Platforms tested:
FreeBSD 4.6 (sleipnir) w/ parallel & C++ and IRIX64 6.5 (modi4) w/parallel
Diffstat (limited to 'src/H5Sprivate.h')
-rw-r--r-- | src/H5Sprivate.h | 111 |
1 files changed, 49 insertions, 62 deletions
diff --git a/src/H5Sprivate.h b/src/H5Sprivate.h index de7f838..1412ea3 100644 --- a/src/H5Sprivate.h +++ b/src/H5Sprivate.h @@ -40,11 +40,15 @@ #define H5S_CONV_STORAGE_CHUNKED 0x0004 /* i.e. '2' */ #define H5S_CONV_STORAGE_MASK 0x0006 +/* Flags for H5S_select_get_seq_list() */ +#define H5S_GET_SEQ_LIST_SORTED 0x0001 + /* Forward references of common typedefs */ typedef struct H5S_t H5S_t; typedef struct H5S_pnt_node_t H5S_pnt_node_t; typedef struct H5S_hyper_span_t H5S_hyper_span_t; typedef struct H5S_hyper_span_info_t H5S_hyper_span_info_t; +typedef struct H5S_hyper_dim_t H5S_hyper_dim_t; /* Point selection iteration container */ typedef struct { @@ -54,10 +58,24 @@ typedef struct { /* New Hyperslab selection iteration container */ typedef struct { + /* Common fields for all hyperslab selections */ hsize_t elmt_left; /* Number of elements left to iterate over */ + hssize_t *off; /* Offset in span node (used as position for regular hyperslabs) */ + unsigned iter_rank; /* Rank of iterator information */ + /* (This should always be the same as the dataspace + * rank, except for regular hyperslab selections in + * which there are contiguous regions in the lower + * dimensions which have been "flattened" out + */ + + /* "Flattened" regular hyperslab selection fields */ + H5S_hyper_dim_t *diminfo; /* "Flattened" regular selection information */ + hsize_t *size; /* "Flattened" dataspace extent information */ + hssize_t *sel_off; /* "Flattened" selection offset information */ + + /* Irregular hyperslab selection fields */ H5S_hyper_span_info_t *spans; /* Pointer to copy of the span tree */ - H5S_hyper_span_t **span; /* Array of pointers to span nodes */ - hssize_t *off; /* Offset in span node (position for regular hyperslabs) */ + H5S_hyper_span_t **span;/* Array of pointers to span nodes */ } H5S_hyper_iter_t; /* "All" selection iteration container */ @@ -73,59 +91,9 @@ typedef union { H5S_all_iter_t all; /* "All" selection iteration information */ } H5S_sel_iter_t; -/* - * Data space conversions usually take place in two halves. One half - * transfers data points between memory and a data type conversion array - * where the points are contiguous, and the other half transfers points - * between the type conversion array and the file. - */ -typedef struct H5S_fconv_t { - /* Identification */ - const char *name; - H5S_sel_type type; - - /* Initialize file element numbering information */ - herr_t (*init)(const H5S_t *space, size_t elmt_size, H5S_sel_iter_t *iter); - - /* Determine optimal number of elements to transfer */ - hsize_t (*avail)(const H5S_t *file_space, const H5S_sel_iter_t *file_iter, - hsize_t max); - - /* Gather elements from disk to type conversion buffer */ - hsize_t (*gath)(H5F_t *f, const struct H5O_layout_t *layout, - H5P_genplist_t *dc_plist, size_t elmt_size, - const H5S_t *file_space, H5S_sel_iter_t *file_iter, - hsize_t nelmts, hid_t dxpl_id, void *tconv_buf/*out*/); - - /* Scatter elements from type conversion buffer to disk */ - herr_t (*scat)(H5F_t *f, const struct H5O_layout_t *layout, - H5P_genplist_t *dc_plist, size_t elmt_size, - const H5S_t *file_space, H5S_sel_iter_t *file_iter, - hsize_t nelmts, hid_t dxpl_id, const void *tconv_buf); -} H5S_fconv_t; - -typedef struct H5S_mconv_t { - /* Identification */ - const char *name; - H5S_sel_type type; - - /* Initialize memory element numbering information */ - herr_t (*init)(const H5S_t *space, size_t elmt_size, H5S_sel_iter_t *iter); - - /* Gather elements from app buffer to type conversion buffer */ - hsize_t (*gath)(const void *buf, size_t elmt_size, - const H5S_t *mem_space, H5S_sel_iter_t *mem_iter, - hsize_t nelmts, void *tconv_buf/*out*/); - - /* Scatter elements from type conversion buffer to application buffer */ - herr_t (*scat)(const void *tconv_buf, size_t elmt_size, - const H5S_t *mem_space, H5S_sel_iter_t *mem_iter, - hsize_t nelmts, void *buf/*out*/); -} H5S_mconv_t; - typedef struct H5S_conv_t { - const H5S_fconv_t *f; - const H5S_mconv_t *m; + H5S_sel_type ftype; + H5S_sel_type mtype; /* * If there is no data type conversion then it might be possible to @@ -167,14 +135,6 @@ typedef struct H5S_conv_t { #endif } H5S_conv_t; -/* Conversion information for the various data space selection types */ -__DLLVAR__ const H5S_fconv_t H5S_POINT_FCONV[]; -__DLLVAR__ const H5S_mconv_t H5S_POINT_MCONV[]; -__DLLVAR__ const H5S_fconv_t H5S_ALL_FCONV[]; -__DLLVAR__ const H5S_mconv_t H5S_ALL_MCONV[]; -__DLLVAR__ const H5S_fconv_t H5S_HYPER_FCONV[]; -__DLLVAR__ const H5S_mconv_t H5S_HYPER_MCONV[]; - /* We get the declaration of H5G_entry_t from the H5Oprivate.h file */ __DLL__ H5S_t *H5S_create(H5S_class_t type); @@ -215,10 +175,37 @@ __DLL__ htri_t H5S_select_regular(const H5S_t *space); __DLL__ htri_t H5S_select_shape_same(const H5S_t *space1, const H5S_t *space2); __DLL__ herr_t H5S_select_iterate(void *buf, hid_t type_id, H5S_t *space, H5D_operator_t op, void *operator_data); +__DLL__ herr_t H5S_select_iter_init(const H5S_t *space, size_t elmt_size, + H5S_sel_iter_t *iter); __DLL__ herr_t H5S_sel_iter_release(const H5S_t *space, H5S_sel_iter_t *sel_iter); __DLL__ herr_t H5S_select_fill(void *fill, size_t fill_size, const H5S_t *space, void *buf); +__DLL__ herr_t H5S_select_get_seq_list(unsigned flags, const H5S_t *space,H5S_sel_iter_t *iter, + size_t elem_size, size_t maxseq, size_t maxbytes, + size_t *nseq, size_t *nbytes, hsize_t *off, size_t *len); +__DLL__ hsize_t H5S_select_favail(const H5S_t *space, const H5S_sel_iter_t *iter, + hsize_t max); +__DLL__ herr_t H5S_select_fscat (H5F_t *f, const struct H5O_layout_t *layout, + H5P_genplist_t *dc_plist, size_t elmt_size, const H5S_t *file_space, + H5S_sel_iter_t *file_iter, hsize_t nelmts, hid_t dxpl_id, + const void *_buf); +__DLL__ hsize_t H5S_select_fgath (H5F_t *f, const struct H5O_layout_t *layout, + H5P_genplist_t *dc_plist, size_t elmt_size, const H5S_t *file_space, + H5S_sel_iter_t *file_iter, hsize_t nelmts, hid_t dxpl_id, + void *buf); +__DLL__ herr_t H5S_select_mscat (const void *_tscat_buf, size_t elmt_size, + const H5S_t *space, H5S_sel_iter_t *iter, hsize_t nelmts, + hid_t dxpl_id, void *_buf/*out*/); +__DLL__ hsize_t H5S_select_mgath (const void *_buf, size_t elmt_size, + const H5S_t *space, H5S_sel_iter_t *iter, hsize_t nelmts, + hid_t dxpl_id, void *_tgath_buf/*out*/); +__DLL__ herr_t H5S_select_read(H5F_t *f, const struct H5O_layout_t *layout, + H5P_genplist_t *dc_plist, size_t elmt_size, const H5S_t *file_space, + const H5S_t *mem_space, hid_t dxpl_id, void *buf/*out*/); +__DLL__ herr_t H5S_select_write(H5F_t *f, const struct H5O_layout_t *layout, + H5P_genplist_t *dc_plist, size_t elmt_size, const H5S_t *file_space, + const H5S_t *mem_space, hid_t dxpl_id, const void *buf/*out*/); /* Needed for internal use of selections in H5Fistore code */ __DLL__ herr_t H5S_select_all(H5S_t *space); |