openPMD/openPMD-api

loadChunk: zero extent

Open

#957 opened on Apr 6, 2021

 (0 comments) (0 reactions) (0 assignees)C++ (57 forks)auto 404
affects latest releasebugfrontend: C++17frontend: Python3good first issue

Repository metrics

Stars
 (160 stars)
PR merge metrics
 (PR metrics pending)

Description

Describe the bug Seen with #952: it should be allowed to load a zero-size extent.

corrupted double-linked list

This should produce an empty shared_ptr / zero-sized array (note that for numpy, only the 0:0 selected axes are set to zero-extent in the returned array).

To Reproduce

... having a hard time to write a reproducer outside of the location linked above.. https://github.com/ax3l/openPMD-api/tree/topic-zeroExtendRead https://github.com/openPMD/openPMD-api/blob/f5dc8e25fcc26b3e78857e7cd30b6056a4b9255c/src/binding/python/openpmd_api/DaskArray.py#L39-L46

Python:

import openpmd_api

# ...
data = rc[0:0]
rc.series_flush()

or C++

#include <openPMD/openPMD.hpp>

// ...

Expected behavior At the moment, this crashes (at least in Python). Instead, it should return a zero-sized variable/array.

Software Environment

  • version of openPMD-api: 0.13.2
  • installed openPMD-api via: from source
  • operating system: Ubuntu 20.04
  • machine: local laptop
  • name and version of Python implementation: CPython 3.9.2
  • version of HDF5: 1.10.6
  • version of ADIOS1: N/A
  • version of ADIOS2: 2.7.1
  • name and version of MPI: N/A

Additional context Seen with #952: This is used by Dask to "probe" the data set on initial access.

Contributor guide