HighFive 3.0.0
HighFive - Header-only C++ HDF5 interface
Loading...
Searching...
No Matches
H5PropertyList.hpp
Go to the documentation of this file.
1/*
2 * Copyright (c), 2017-2018, Adrien Devresse <adrien.devresse@epfl.ch>
3 * Juan Hernando <juan.hernando@epfl.ch>
4 * Distributed under the Boost Software License, Version 1.0.
5 * (See accompanying file LICENSE_1_0.txt or copy at
6 * http://www.boost.org/LICENSE_1_0.txt)
7 *
8 */
9#pragma once
10
11#include <vector>
12
13#include <H5Ppublic.h>
14
15// Required by MPIOFileAccess
16#ifdef H5_HAVE_PARALLEL
17#include <H5FDmpi.h>
18#endif
19
20#include "H5Exception.hpp"
21#include "H5Object.hpp"
22
23namespace HighFive {
24
85
104
105namespace details {
106template <typename T, typename U>
107T get_plist(const U& obj, hid_t (*f)(hid_t)) {
108 auto hid = f(obj.getId());
109 if (hid < 0) {
110 HDF5ErrMapper::ToException<PropertyException>("Unable to get property list");
111 }
112 T t{};
113 t._hid = hid;
114 return t;
115}
116} // namespace details
117
121 public:
122 PropertyListBase() noexcept;
123
124 static const PropertyListBase& Default() noexcept {
125 static const PropertyListBase plist{};
126 return plist;
127 }
128
129 private:
130 template <typename T, typename U>
131 friend T details::get_plist(const U&, hid_t (*f)(hid_t));
132};
133
137template <PropertyType T>
139 public:
142 constexpr PropertyType getType() const noexcept {
143 return T;
144 }
145
150 template <typename P>
151 void add(const P& property);
152
155 static const PropertyList<T>& Default() noexcept {
156 return static_cast<const PropertyList<T>&>(PropertyListBase::Default());
157 }
158
165 auto plist = PropertyList<T>();
166 plist._initializeIfNeeded();
167
168 return plist;
169 }
170
171 protected:
172 void _initializeIfNeeded();
173};
174
188
193template <PropertyType T>
195 public:
196 template <typename F, typename... Args>
197 void add(const F& funct, const Args&... args);
198};
199
200#ifdef H5_HAVE_PARALLEL
208 public:
209 MPIOFileAccess(MPI_Comm comm, MPI_Info info);
210
211 private:
212 friend FileAccessProps;
213 void apply(hid_t list) const;
214
215 MPI_Comm _comm;
216 MPI_Info _info;
217};
218
219
220#if H5_VERSION_GE(1, 10, 0)
226class MPIOCollectiveMetadata {
227 public:
228 explicit MPIOCollectiveMetadata(bool collective = true);
229 explicit MPIOCollectiveMetadata(const FileAccessProps& plist);
230
231 bool isCollectiveRead() const;
232 bool isCollectiveWrite() const;
233
234
235 private:
236 friend FileAccessProps;
237 void apply(hid_t plist) const;
238
239 bool collective_read_;
240 bool collective_write_;
241};
242
256class MPIOCollectiveMetadataRead {
257 public:
258 explicit MPIOCollectiveMetadataRead(bool collective = true);
259 explicit MPIOCollectiveMetadataRead(const FileAccessProps& plist);
260
261 bool isCollective() const;
262
263 private:
264 friend FileAccessProps;
265 friend MPIOCollectiveMetadata;
266
267 void apply(hid_t plist) const;
268
269 bool collective_;
270};
271
282class MPIOCollectiveMetadataWrite {
283 public:
284 explicit MPIOCollectiveMetadataWrite(bool collective = true);
285 explicit MPIOCollectiveMetadataWrite(const FileAccessProps& plist);
286
287 bool isCollective() const;
288
289 private:
290 friend FileAccessProps;
291 friend MPIOCollectiveMetadata;
292
293 void apply(hid_t plist) const;
294
295 bool collective_;
296};
297
298#endif
299#endif
300
318 public:
319 FileVersionBounds(H5F_libver_t low, H5F_libver_t high);
320 explicit FileVersionBounds(const FileAccessProps& fapl);
321
322 std::pair<H5F_libver_t, H5F_libver_t> getVersion() const;
323
324 private:
325 friend FileAccessProps;
326 void apply(hid_t list) const;
327
328 H5F_libver_t _low;
329 H5F_libver_t _high;
330};
331
338 public:
339 explicit MetadataBlockSize(hsize_t size);
340 explicit MetadataBlockSize(const FileAccessProps& fapl);
341
342 hsize_t getSize() const;
343
344 private:
345 friend FileAccessProps;
346 void apply(hid_t list) const;
347 hsize_t _size;
348};
349
350#if H5_VERSION_GE(1, 10, 1)
357class FileSpaceStrategy {
358 public:
365 FileSpaceStrategy(H5F_fspace_strategy_t strategy, hbool_t persist, hsize_t threshold);
366 explicit FileSpaceStrategy(const FileCreateProps& fcpl);
367
368 H5F_fspace_strategy_t getStrategy() const;
369 hbool_t getPersist() const;
370 hsize_t getThreshold() const;
371
372 private:
373 friend FileCreateProps;
374
375 void apply(hid_t list) const;
376
377 H5F_fspace_strategy_t _strategy;
378 hbool_t _persist;
379 hsize_t _threshold;
380};
381
391class FileSpacePageSize {
392 public:
397 explicit FileSpacePageSize(hsize_t page_size);
398 explicit FileSpacePageSize(const FileCreateProps& fcpl);
399
400 hsize_t getPageSize() const;
401
402 private:
403 friend FileCreateProps;
404 void apply(hid_t list) const;
405
406 hsize_t _page_size;
407};
408
409#ifndef H5_HAVE_PARALLEL
421class PageBufferSize {
422 public:
428 explicit PageBufferSize(size_t page_buffer_size,
429 unsigned min_meta_percent = 0,
430 unsigned min_raw_percent = 0);
431
432 explicit PageBufferSize(const FileAccessProps& fapl);
433
434 size_t getPageBufferSize() const;
435 unsigned getMinMetaPercent() const;
436 unsigned getMinRawPercent() const;
437
438 private:
439 friend FileAccessProps;
440
441 void apply(hid_t list) const;
442
443 size_t _page_buffer_size;
444 unsigned _min_meta;
445 unsigned _min_raw;
446};
447#endif
448#endif
449
453 public:
458 explicit EstimatedLinkInfo(unsigned entries, unsigned length);
459
460 explicit EstimatedLinkInfo(const GroupCreateProps& gcpl);
461
463 unsigned getEntries() const;
464
466 unsigned getNameLength() const;
467
468 private:
469 friend GroupCreateProps;
470 void apply(hid_t hid) const;
471 unsigned _entries;
472 unsigned _length;
473};
474
475
476class Chunking {
477 public:
478 explicit Chunking(const std::vector<hsize_t>& dims);
479 Chunking(const std::initializer_list<hsize_t>& items);
480
481 template <typename... Args>
482 explicit Chunking(hsize_t item, Args... args);
483
484 explicit Chunking(DataSetCreateProps& plist, size_t max_dims = 32);
485
486 const std::vector<hsize_t>& getDimensions() const;
487
488 private:
489 friend DataSetCreateProps;
490 void apply(hid_t hid) const;
491 std::vector<hsize_t> _dims;
492};
493
494class Deflate {
495 public:
496 explicit Deflate(unsigned level);
497
498 private:
499 friend DataSetCreateProps;
500 friend GroupCreateProps;
501 void apply(hid_t hid) const;
502 const unsigned _level;
503};
504
505class Szip {
506 public:
507 explicit Szip(unsigned options_mask = H5_SZIP_EC_OPTION_MASK,
508 unsigned pixels_per_block = H5_SZIP_MAX_PIXELS_PER_BLOCK);
509
510 unsigned getOptionsMask() const;
511 unsigned getPixelsPerBlock() const;
512
513 private:
514 friend DataSetCreateProps;
515 void apply(hid_t hid) const;
516 const unsigned _options_mask;
517 const unsigned _pixels_per_block;
518};
519
520class Shuffle {
521 public:
522 Shuffle() = default;
523
524 private:
525 friend DataSetCreateProps;
526 void apply(hid_t hid) const;
527};
528
535 public:
536 explicit AllocationTime(H5D_alloc_time_t alloc_time);
537 explicit AllocationTime(const DataSetCreateProps& dcpl);
538
539 H5D_alloc_time_t getAllocationTime();
540
541 private:
542 friend DataSetCreateProps;
543 void apply(hid_t dcpl) const;
544
545 H5D_alloc_time_t _alloc_time;
546};
547
550class Caching {
551 public:
554 Caching(size_t numSlots,
555 size_t cacheSize,
556 double w0 = static_cast<double>(H5D_CHUNK_CACHE_W0_DEFAULT));
557
558 explicit Caching(const DataSetCreateProps& dcpl);
559
560 size_t getNumSlots() const;
561 size_t getCacheSize() const;
562 double getW0() const;
563
564 private:
565 friend DataSetAccessProps;
566 void apply(hid_t hid) const;
567 size_t _numSlots;
568 size_t _cacheSize;
569 double _w0;
570};
571
573 public:
574 explicit CreateIntermediateGroup(bool create = true);
575
576 explicit CreateIntermediateGroup(const LinkCreateProps& lcpl);
577
578 bool isSet() const;
579
580 protected:
581 void fromPropertyList(hid_t hid);
582
583 private:
584 friend LinkCreateProps;
585 void apply(hid_t hid) const;
586 bool _create;
587};
588
589#ifdef H5_HAVE_PARALLEL
591 public:
592 explicit UseCollectiveIO(bool enable = true);
593
594 explicit UseCollectiveIO(const DataTransferProps& dxpl);
595
597 bool isCollective() const;
598
599 private:
600 friend DataTransferProps;
601 void apply(hid_t hid) const;
602 bool _enable;
603};
604
605
613 public:
614 explicit MpioNoCollectiveCause(const DataTransferProps& dxpl);
615
617 bool wasCollective() const;
618
620 uint32_t getLocalCause() const;
621
623 uint32_t getGlobalCause() const;
624
626 std::pair<uint32_t, uint32_t> getCause() const;
627
628 private:
629 friend DataTransferProps;
630 uint32_t _local_cause;
631 uint32_t _global_cause;
632};
633#endif
634
637 Tracked = H5P_CRT_ORDER_TRACKED,
638 Indexed = H5P_CRT_ORDER_INDEXED,
639 };
640};
641
648 public:
653 explicit LinkCreationOrder(unsigned flags)
654 : _flags(flags) {}
655
656 explicit LinkCreationOrder(const FileCreateProps& fcpl);
657 explicit LinkCreationOrder(const GroupCreateProps& gcpl);
658
659 unsigned getFlags() const;
660
661 protected:
662 void fromPropertyList(hid_t hid);
663
664 private:
665 friend FileCreateProps;
666 friend GroupCreateProps;
667 void apply(hid_t hid) const;
668 unsigned _flags;
669};
670
671
683 public:
690 AttributePhaseChange(unsigned max_compact, unsigned min_dense);
691
693 explicit AttributePhaseChange(const GroupCreateProps& gcpl);
694
695 unsigned max_compact() const;
696 unsigned min_dense() const;
697
698 private:
699 friend GroupCreateProps;
700 void apply(hid_t hid) const;
701
702 unsigned _max_compact;
703 unsigned _min_dense;
704};
705
707
708} // namespace HighFive
709
When are datasets allocated?
Definition H5PropertyList.hpp:534
H5D_alloc_time_t getAllocationTime()
Definition H5PropertyList_misc.hpp:357
Set threshold for attribute storage.
Definition H5PropertyList.hpp:682
unsigned max_compact() const
Definition H5PropertyList_misc.hpp:479
unsigned min_dense() const
Definition H5PropertyList_misc.hpp:483
Definition H5PropertyList.hpp:550
size_t getNumSlots() const
Definition H5PropertyList_misc.hpp:374
size_t getCacheSize() const
Definition H5PropertyList_misc.hpp:378
double getW0() const
Definition H5PropertyList_misc.hpp:382
Definition H5PropertyList.hpp:476
const std::vector< hsize_t > & getDimensions() const
Definition H5PropertyList_misc.hpp:299
Definition H5PropertyList.hpp:572
void fromPropertyList(hid_t hid)
Definition H5PropertyList_misc.hpp:397
bool isSet() const
Definition H5PropertyList_misc.hpp:402
Definition H5PropertyList.hpp:494
Configure the version bounds for the file.
Definition H5PropertyList.hpp:317
std::pair< H5F_libver_t, H5F_libver_t > getVersion() const
Definition H5PropertyList_misc.hpp:234
Configure MPI access for the file.
Definition H5PropertyList.hpp:207
Configure the metadata block size to use writing to files.
Definition H5PropertyList.hpp:337
hsize_t getSize() const
Definition H5PropertyList_misc.hpp:253
The cause for non-collective I/O.
Definition H5PropertyList.hpp:612
uint32_t getGlobalCause() const
The global cause for a non-collective I/O.
Definition H5PropertyList_misc.hpp:442
bool wasCollective() const
Was the datatransfer collective?
Definition H5PropertyList_misc.hpp:434
std::pair< uint32_t, uint32_t > getCause() const
A pair of the local and global cause for non-collective I/O.
Definition H5PropertyList_misc.hpp:446
uint32_t getLocalCause() const
The local cause for a non-collective I/O.
Definition H5PropertyList_misc.hpp:438
Definition H5Object.hpp:36
Base Class for Property lists, providing global default.
Definition H5PropertyList.hpp:120
PropertyListBase() noexcept
Definition H5PropertyList_misc.hpp:54
static const PropertyListBase & Default() noexcept
Definition H5PropertyList.hpp:124
HDF5 property Lists.
Definition H5PropertyList.hpp:138
void _initializeIfNeeded()
Definition H5PropertyList_misc.hpp:59
static PropertyList< T > Empty()
Definition H5PropertyList.hpp:164
static const PropertyList< T > & Default() noexcept
Return the Default property type object.
Definition H5PropertyList.hpp:155
constexpr PropertyType getType() const noexcept
return the type of this PropertyList
Definition H5PropertyList.hpp:142
void add(const P &property)
Definition H5PropertyList_misc.hpp:68
Definition H5PropertyList.hpp:194
void add(const F &funct, const Args &... args)
Definition H5PropertyList_misc.hpp:75
Definition H5PropertyList.hpp:520
Definition H5PropertyList.hpp:505
unsigned getPixelsPerBlock() const
Definition H5PropertyList_misc.hpp:334
unsigned getOptionsMask() const
Definition H5PropertyList_misc.hpp:330
Definition H5PropertyList.hpp:590
bool isCollective() const
Does the property request collective IO?
Definition H5PropertyList_misc.hpp:426
PropertyType
Types of property lists.
Definition H5PropertyList.hpp:89
PropertyList< PropertyType::FILE_ACCESS > FileAccessProps
Definition H5PropertyList.hpp:176
Definition assert_compatible_spaces.hpp:15
Definition H5PropertyList.hpp:635
_creation_order
Definition H5PropertyList.hpp:636
@ Tracked
Definition H5PropertyList.hpp:637
@ Indexed
Definition H5PropertyList.hpp:638