HighFive 2.7.1
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
28enum class PropertyType : int {
44};
45
46namespace details {
47template <typename T, typename U>
48T get_plist(const U& obj, hid_t (*f)(hid_t)) {
49 auto hid = f(obj.getId());
50 if (hid < 0) {
51 HDF5ErrMapper::ToException<PropertyException>("Unable to get property list");
52 }
53 T t{};
54 t._hid = hid;
55 return t;
56}
57} // namespace details
58
61class PropertyListBase: public Object {
62 public:
63 PropertyListBase() noexcept;
64
65 static const PropertyListBase& Default() noexcept {
66 static const PropertyListBase plist{};
67 return plist;
68 }
69
70 private:
71 template <typename T, typename U>
72 friend T details::get_plist(const U&, hid_t (*f)(hid_t));
73};
74
78template <PropertyType T>
80 public:
83 constexpr PropertyType getType() const noexcept {
84 return T;
85 }
86
92 template <typename P>
93 void add(const P& property);
94
97 static const PropertyList<T>& Default() noexcept {
98 return static_cast<const PropertyList<T>&>(PropertyListBase::Default());
99 }
100
101 protected:
102 void _initializeIfNeeded();
103};
104
120
125template <PropertyType T>
127 public:
128 template <typename F, typename... Args>
129 void add(const F& funct, const Args&... args);
130};
131
132#ifdef H5_HAVE_PARALLEL
140 public:
141 MPIOFileAccess(MPI_Comm comm, MPI_Info info);
142
143 private:
144 friend FileAccessProps;
145 void apply(const hid_t list) const;
146
147 MPI_Comm _comm;
148 MPI_Info _info;
149};
150
157 public:
158 explicit MPIOCollectiveMetadata(bool collective = true);
159 explicit MPIOCollectiveMetadata(const FileAccessProps& plist);
160
161 bool isCollectiveRead() const;
162 bool isCollectiveWrite() const;
163
164
165 private:
166 friend FileAccessProps;
167 void apply(hid_t plist) const;
168
169 bool collective_read_;
170 bool collective_write_;
171};
172
187 public:
188 explicit MPIOCollectiveMetadataRead(bool collective = true);
189 explicit MPIOCollectiveMetadataRead(const FileAccessProps& plist);
190
191 bool isCollective() const;
192
193 private:
194 friend FileAccessProps;
196
197 void apply(hid_t plist) const;
198
199 bool collective_;
200};
201
213 public:
214 explicit MPIOCollectiveMetadataWrite(bool collective = true);
215 explicit MPIOCollectiveMetadataWrite(const FileAccessProps& plist);
216
217 bool isCollective() const;
218
219 private:
220 friend FileAccessProps;
222
223 void apply(hid_t plist) const;
224
225 bool collective_;
226};
227
228#endif
229
247 public:
248 FileVersionBounds(H5F_libver_t low, H5F_libver_t high);
249 explicit FileVersionBounds(const FileAccessProps& fapl);
250
251 std::pair<H5F_libver_t, H5F_libver_t> getVersion() const;
252
253 private:
254 friend FileAccessProps;
255 void apply(const hid_t list) const;
256
257 H5F_libver_t _low;
258 H5F_libver_t _high;
259};
260
267 public:
268 explicit MetadataBlockSize(hsize_t size);
269 explicit MetadataBlockSize(const FileAccessProps& fapl);
270
271 hsize_t getSize() const;
272
273 private:
274 friend FileAccessProps;
275 void apply(const hid_t list) const;
276 hsize_t _size;
277};
278
279#if H5_VERSION_GE(1, 10, 1)
286class FileSpaceStrategy {
287 public:
294 FileSpaceStrategy(H5F_fspace_strategy_t strategy, hbool_t persist, hsize_t threshold);
295 explicit FileSpaceStrategy(const FileCreateProps& fcpl);
296
297 H5F_fspace_strategy_t getStrategy() const;
298 hbool_t getPersist() const;
299 hsize_t getThreshold() const;
300
301 private:
302 friend FileCreateProps;
303
304 void apply(const hid_t list) const;
305
306 H5F_fspace_strategy_t _strategy;
307 hbool_t _persist;
308 hsize_t _threshold;
309};
310
320class FileSpacePageSize {
321 public:
326 explicit FileSpacePageSize(hsize_t page_size);
327 explicit FileSpacePageSize(const FileCreateProps& fcpl);
328
329 hsize_t getPageSize() const;
330
331 private:
332 friend FileCreateProps;
333 void apply(const hid_t list) const;
334
335 hsize_t _page_size;
336};
337
338#ifndef H5_HAVE_PARALLEL
350class PageBufferSize {
351 public:
357 explicit PageBufferSize(size_t page_buffer_size,
358 unsigned min_meta_percent = 0,
359 unsigned min_raw_percent = 0);
360
361 explicit PageBufferSize(const FileAccessProps& fapl);
362
363 size_t getPageBufferSize() const;
364 unsigned getMinMetaPercent() const;
365 unsigned getMinRawPercent() const;
366
367 private:
368 friend FileAccessProps;
369
370 void apply(hid_t list) const;
371
372 size_t _page_buffer_size;
373 unsigned _min_meta;
374 unsigned _min_raw;
375};
376#endif
377#endif
378
382 public:
387 explicit EstimatedLinkInfo(unsigned entries, unsigned length);
388
389 explicit EstimatedLinkInfo(const GroupCreateProps& gcpl);
390
392 unsigned getEntries() const;
393
395 unsigned getNameLength() const;
396
397 private:
398 friend GroupCreateProps;
399 void apply(hid_t hid) const;
400 unsigned _entries;
401 unsigned _length;
402};
403
404
405class Chunking {
406 public:
407 explicit Chunking(const std::vector<hsize_t>& dims);
408 Chunking(const std::initializer_list<hsize_t>& items);
409
410 template <typename... Args>
411 explicit Chunking(hsize_t item, Args... args);
412
413 explicit Chunking(DataSetCreateProps& plist, size_t max_dims = 32);
414
415 const std::vector<hsize_t>& getDimensions() const noexcept;
416
417 private:
418 friend DataSetCreateProps;
419 void apply(hid_t hid) const;
420 std::vector<hsize_t> _dims;
421};
422
423class Deflate {
424 public:
425 explicit Deflate(unsigned level);
426
427 private:
428 friend DataSetCreateProps;
429 friend GroupCreateProps;
430 void apply(hid_t hid) const;
431 const unsigned _level;
432};
433
434class Szip {
435 public:
436 explicit Szip(unsigned options_mask = H5_SZIP_EC_OPTION_MASK,
437 unsigned pixels_per_block = H5_SZIP_MAX_PIXELS_PER_BLOCK);
438
439 unsigned getOptionsMask() const;
440 unsigned getPixelsPerBlock() const;
441
442 private:
443 friend DataSetCreateProps;
444 void apply(hid_t hid) const;
445 const unsigned _options_mask;
446 const unsigned _pixels_per_block;
447};
448
449class Shuffle {
450 public:
451 Shuffle() = default;
452
453 private:
454 friend DataSetCreateProps;
455 void apply(hid_t hid) const;
456};
457
464 public:
465 explicit AllocationTime(H5D_alloc_time_t alloc_time);
466 explicit AllocationTime(const DataSetCreateProps& dcpl);
467
468 H5D_alloc_time_t getAllocationTime();
469
470 private:
471 friend DataSetCreateProps;
472 void apply(hid_t dcpl) const;
473
474 H5D_alloc_time_t _alloc_time;
475};
476
479class Caching {
480 public:
483 Caching(const size_t numSlots,
484 const size_t cacheSize,
485 const double w0 = static_cast<double>(H5D_CHUNK_CACHE_W0_DEFAULT));
486
487 explicit Caching(const DataSetCreateProps& dcpl);
488
489 size_t getNumSlots() const;
490 size_t getCacheSize() const;
491 double getW0() const;
492
493 private:
494 friend DataSetAccessProps;
495 void apply(hid_t hid) const;
496 size_t _numSlots;
497 size_t _cacheSize;
498 double _w0;
499};
500
502 public:
503 explicit CreateIntermediateGroup(bool create = true);
504
505 explicit CreateIntermediateGroup(const ObjectCreateProps& ocpl);
507
508 bool isSet() const;
509
510 protected:
511 void fromPropertyList(hid_t hid);
512
513 private:
514 friend ObjectCreateProps;
515 friend LinkCreateProps;
516 void apply(hid_t hid) const;
517 bool _create;
518};
519
520#ifdef H5_HAVE_PARALLEL
522 public:
523 explicit UseCollectiveIO(bool enable = true);
524
525 explicit UseCollectiveIO(const DataTransferProps& dxpl);
526
528 bool isCollective() const;
529
530 private:
531 friend DataTransferProps;
532 void apply(hid_t hid) const;
533 bool _enable;
534};
535
536
544 public:
545 explicit MpioNoCollectiveCause(const DataTransferProps& dxpl);
546
548 bool wasCollective() const;
549
551 uint32_t getLocalCause() const;
552
554 uint32_t getGlobalCause() const;
555
557 std::pair<uint32_t, uint32_t> getCause() const;
558
559 private:
560 friend DataTransferProps;
561 uint32_t _local_cause;
562 uint32_t _global_cause;
563};
564#endif
565
568 Tracked = H5P_CRT_ORDER_TRACKED,
569 Indexed = H5P_CRT_ORDER_INDEXED,
570 };
571};
572
579 public:
584 explicit LinkCreationOrder(unsigned flags)
585 : _flags(flags) {}
586
587 explicit LinkCreationOrder(const FileCreateProps& fcpl);
588 explicit LinkCreationOrder(const GroupCreateProps& gcpl);
589
590 unsigned getFlags() const;
591
592 protected:
593 void fromPropertyList(hid_t hid);
594
595 private:
596 friend FileCreateProps;
597 friend GroupCreateProps;
598 void apply(hid_t hid) const;
599 unsigned _flags;
600};
601
602} // namespace HighFive
603
When are datasets allocated?
Definition H5PropertyList.hpp:463
H5D_alloc_time_t getAllocationTime()
Definition H5PropertyList_misc.hpp:405
Definition H5PropertyList.hpp:479
size_t getNumSlots() const
Definition H5PropertyList_misc.hpp:426
size_t getCacheSize() const
Definition H5PropertyList_misc.hpp:430
double getW0() const
Definition H5PropertyList_misc.hpp:434
Definition H5PropertyList.hpp:405
const std::vector< hsize_t > & getDimensions() const noexcept
Definition H5PropertyList_misc.hpp:341
Definition H5PropertyList.hpp:501
CreateIntermediateGroup(const LinkCreateProps &lcpl)
void fromPropertyList(hid_t hid)
Definition H5PropertyList_misc.hpp:457
bool isSet() const
Definition H5PropertyList_misc.hpp:467
Definition H5PropertyList.hpp:423
Configure the version bounds for the file.
Definition H5PropertyList.hpp:246
std::pair< H5F_libver_t, H5F_libver_t > getVersion() const
Definition H5PropertyList_misc.hpp:262
Use collective MPI-IO for metadata read and write.
Definition H5PropertyList.hpp:156
bool isCollectiveWrite() const
Definition H5PropertyList_misc.hpp:207
bool isCollectiveRead() const
Definition H5PropertyList_misc.hpp:203
Use collective MPI-IO for metadata read?
Definition H5PropertyList.hpp:186
bool isCollective() const
Definition H5PropertyList_misc.hpp:218
Use collective MPI-IO for metadata write?
Definition H5PropertyList.hpp:212
bool isCollective() const
Definition H5PropertyList_misc.hpp:237
Configure MPI access for the file.
Definition H5PropertyList.hpp:139
Configure the metadata block size to use writing to files.
Definition H5PropertyList.hpp:266
hsize_t getSize() const
Definition H5PropertyList_misc.hpp:287
The cause for non-collective I/O.
Definition H5PropertyList.hpp:543
uint32_t getGlobalCause() const
The global cause for a non-collective I/O.
Definition H5PropertyList_misc.hpp:513
bool wasCollective() const
Was the datatransfer collective?
Definition H5PropertyList_misc.hpp:505
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:517
uint32_t getLocalCause() const
The local cause for a non-collective I/O.
Definition H5PropertyList_misc.hpp:509
Definition H5Object.hpp:54
Base Class for Property lists, providing global default.
Definition H5PropertyList.hpp:61
PropertyListBase() noexcept
Definition H5PropertyList_misc.hpp:58
static const PropertyListBase & Default() noexcept
Definition H5PropertyList.hpp:65
HDF5 property Lists.
Definition H5PropertyList.hpp:79
void _initializeIfNeeded()
Definition H5PropertyList_misc.hpp:63
static const PropertyList< T > & Default() noexcept
Return the Default property type object.
Definition H5PropertyList.hpp:97
constexpr PropertyType getType() const noexcept
return the type of this PropertyList
Definition H5PropertyList.hpp:83
void add(const P &property)
Definition H5PropertyList_misc.hpp:74
Definition H5PropertyList.hpp:126
void add(const F &funct, const Args &... args)
Definition H5PropertyList_misc.hpp:81
Definition H5PropertyList.hpp:449
Definition H5PropertyList.hpp:434
unsigned getPixelsPerBlock() const
Definition H5PropertyList_misc.hpp:376
unsigned getOptionsMask() const
Definition H5PropertyList_misc.hpp:372
Definition H5PropertyList.hpp:521
bool isCollective() const
Does the property request collective IO?
Definition H5PropertyList_misc.hpp:495
Definition H5_definitions.hpp:15
PropertyType
Types of property lists.
Definition H5PropertyList.hpp:28
PropertyList< PropertyType::FILE_ACCESS > FileAccessProps
Definition H5PropertyList.hpp:107
Definition H5PropertyList.hpp:566
_CreationOrder
Definition H5PropertyList.hpp:567
@ Tracked
Definition H5PropertyList.hpp:568
@ Indexed
Definition H5PropertyList.hpp:569