Skip to content

loadChunk: zero extent #957

Open
Open
@ax3l

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

# FIXME: implement handling of zero-slices in Record_Component
# https://github.com/openPMD/openPMD-api/issues/957
all_zero = True
for s in slices:
if s != np.s_[0:0]:
all_zero = False
if all_zero:
return np.array([], dtype=self.dtype)

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.

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions