Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Design limitations in the frontend resulting in unexpected behaviours (segfaults, premature destructor calls) #534

Open
franzpoeschel opened this issue Jul 22, 2019 · 8 comments

Comments

@franzpoeschel
Copy link
Contributor

After following around a segmentation fault when using the openPMD API, I came to the conclusion that there is a relatively deeply-nested issue with the design of the frontend's classes.
Most of those classes have been designed as handles to some underlying data so that users can take a lightweight copy (instead of a reference or pointer) and still interact with the same shared data.
Key to this is the class Container that wraps a shared_ptr to an internal container (e.g. std::map). Most classes exposed in the public API store their payload behind a Container (e.g. in Series or Iteration) or directly behind a shared_ptr (e.g. in Attributable).

The issue arises because atm there is no sufficiently clear separation between (1) functionality of copyable handles and (2) functionality that should be restricted to the unique non-copy internal data.
So far, I have found two issues falling in this category:

(1) Destructor calls
This issue has limited extent, fortunately, since most classes use a default destructor. But also the root class of the openPMD tree Series has been designed as a handle, so its destructor should not really perform a flush.

(2) Going upward in the openPMD hierarchy
More problematic is the fact that the openPMD tree is not a tree of unique objects but a tree of the mentioned handles. The tree is linked (in upward direction) using the classes Writable and Attributable, using raw pointers in order to break reference cycles. (More idiomatic would be weak pointers, but this is not the issue here). This linkage is later used again to go upward in the openPMD hierarchy.
When doing this, in principle the handle that has been stored as a parent can already be invalidated while the underlying data is still present.

Fortunately enough, it is currently difficult to trigger this behavior. The following rather constructed examples show the issue:

    {
        std::unique_ptr< openPMD::Series > series_ptr;
        {
            openPMD::Series series( "sample%T.json", openPMD::AccessType::CREATE );
            series_ptr = std::unique_ptr< openPMD::Series >(
                new openPMD::Series( series ) );
            // i am the marked line
        }
        series_ptr->iterations[0].meshes["E"]["x"].makeEmpty< int >( 1 );
    }

Destructor runs at the marked line. No iteration is present yet, so flushing in file-based mode throws an exception. It seems surprising that the series is flushed.

    {
        std::unique_ptr< openPMD::Series > series_ptr;
        {
            openPMD::Series series( "sample%T.json", openPMD::AccessType::CREATE );
            series_ptr = std::unique_ptr< openPMD::Series >(
                new openPMD::Series( series ) );
            series_ptr->iterations[0].meshes["E"]["x"].makeEmpty< int >( 1 );
        }
        // i am the marked line
    }

We define the data earlier, so the first flush passes. Since the original handle has been destroyed, the second flush at the marked line fails with a segmentation fault.

The issue is not currently critical since triggering it requires writing rather esoteric programs, but for my current implementation of streaming this is becoming increasingly difficult to handle since re-parsing the openPMD hierarchy is necessary and I need to pay attention to not link to any copied handles but the original one instead.

I can currently work around the problem, but these issues should be considered in an upcoming refactoring of openPMD's frontend.

franzpoeschel added a commit to franzpoeschel/openPMD-api that referenced this issue Jul 23, 2019
franzpoeschel added a commit to franzpoeschel/openPMD-api that referenced this issue Jul 23, 2019
This has been a massive performance drain.
openPMD#534

This should be extended to further levels of the openPMD hierarchy.
@ax3l
Copy link
Member

ax3l commented Jul 23, 2019

Thanks for the assessment and I agree with the design issues.

To add on your analysis, I think the use of (user-facing) handles is fine and the underlying issues reside in the business logic (internally linked handles/parents that you mention) at the following points.

First of all, the logic of openPMD logic (defaults, etc.) is not separated from data "container" objects. This is problematic as we have already seen and makes upgrades way more complicated than they should be. We should refactor all defaults, including sub-object creation out of the data storage. (If you want, e.g. MVC without the V ;) is a pattern to follow, or related approaches.)

Furthermore, the logic between handles from parents to childs is a directed tree, which is very cumbersome when dealing with construction, destruction and defaults. This can be solved with refactoring the first part, I think.

@ax3l
Copy link
Member

ax3l commented Aug 18, 2019

cc-ing @C0nsultant for ideas/feedback :)

@franzpoeschel
Copy link
Contributor Author

Furthermore, the logic between handles from parents to childs is a directed tree, which is very cumbersome when dealing with construction, destruction and defaults

On the one hand, since openPMD is a hierarchical format, we should retain this logic from the user side, but I think we have seen that building our memory layout off of this is not the best way to go.
There is no clear “ownership” of data since some operations will require walking up and some walking down the tree.

I would suggest splitting the Series object into a unique (per Series) internal object and a handle class to that object that is exposed to the user. The internal object can then become the “sentinel” object of the Series, something that we currently do not really have. Instead of handling memory in the current ad-hoc way, this object can then be used for (1) administering the objects of the openPMD hierarchy and also for (2) non-trivial destructors, default handling etc.

Within the hierarchy itself, we should then use std::weak_ptrs (and maybe even retain std::shared_ptrs in downward direction), but drop usage of raw pointers.

@ax3l
Copy link
Member

ax3l commented Aug 27, 2019

On the one hand, since openPMD is a hierarchical format ...

Yes exactly, also I am not sure our (physical) hierarchy will always be a simple DAG tree in openPMD. We might relax that in newer versions of the standard.

There is no clear “ownership” of data since some operations will require walking up and some walking down the tree.

Fully agreed, the one-direction linking makes it even harder to keep track. Not speeking of the map< shared_ptr< string > things for handles o.0

I would suggest splitting the Series object into a unique (per Series) internal object and a handle class to that object that is exposed to the user.

I think that's a good idea and would allow us furthermore to expose this handle object in two public headers: one with MPI includes pulled in and one without. Potentially create it via two free standing functions?

franzpoeschel added a commit to franzpoeschel/picongpu that referenced this issue Sep 25, 2019
franzpoeschel added a commit to franzpoeschel/openPMD-api that referenced this issue Sep 27, 2019
franzpoeschel added a commit to franzpoeschel/openPMD-api that referenced this issue Sep 27, 2019
This has been a massive performance drain.
openPMD#534

This should be extended to further levels of the openPMD hierarchy.
franzpoeschel added a commit to franzpoeschel/openPMD-api that referenced this issue Sep 28, 2019
franzpoeschel added a commit to franzpoeschel/openPMD-api that referenced this issue Sep 28, 2019
This has been a massive performance drain.
openPMD#534

This should be extended to further levels of the openPMD hierarchy.
franzpoeschel added a commit to franzpoeschel/openPMD-api that referenced this issue Oct 4, 2019
franzpoeschel added a commit to franzpoeschel/openPMD-api that referenced this issue Oct 4, 2019
This has been a massive performance drain.
openPMD#534

This should be extended to further levels of the openPMD hierarchy.
franzpoeschel added a commit to franzpoeschel/openPMD-api that referenced this issue Oct 10, 2019
franzpoeschel added a commit to franzpoeschel/openPMD-api that referenced this issue Oct 10, 2019
This has been a massive performance drain.
openPMD#534

This should be extended to further levels of the openPMD hierarchy.
franzpoeschel added a commit to franzpoeschel/openPMD-api that referenced this issue Oct 10, 2019
franzpoeschel added a commit to franzpoeschel/openPMD-api that referenced this issue Oct 10, 2019
This has been a massive performance drain.
openPMD#534

This should be extended to further levels of the openPMD hierarchy.
franzpoeschel added a commit to franzpoeschel/openPMD-api that referenced this issue Oct 10, 2019
franzpoeschel added a commit to franzpoeschel/openPMD-api that referenced this issue Oct 10, 2019
This has been a massive performance drain.
openPMD#534

This should be extended to further levels of the openPMD hierarchy.
franzpoeschel added a commit to franzpoeschel/openPMD-api that referenced this issue Oct 10, 2019
franzpoeschel added a commit to franzpoeschel/openPMD-api that referenced this issue Oct 10, 2019
This has been a massive performance drain.
openPMD#534

This should be extended to further levels of the openPMD hierarchy.
@franzpoeschel franzpoeschel mentioned this issue Oct 10, 2019
5 tasks
franzpoeschel pushed a commit to franzpoeschel/openPMD-api that referenced this issue Jan 10, 2020
Do not set `-Werror` during Spack/dependency install phase.

README: Author Contributions

Acknowledgements in the README, not only in meta-data :)

JSON Backend: Throw if Missing

In case the JSON backend is voluntarily disabled, we should throw
as in other I/O backends about missing support.

Allow choosing ADIOS2 Engine type from the frontend

Implemented by allowing to specify generic settings in form of a map<string,string>.

Set options via JSON

Set engine parameters from JSON

Do not expose JSON library publicly

Fix passing of parameters in MPI mode

Remove notifyOption from ADIOS2IOHandler

also some formatting

Add advance method to Writable class

Move advance logic from Writable to Series

Simple implementation for starting a next step in ADIOS2

Remove path field from ADVANCE task

To be handled in the standard way by OPEN_FILE et al.

Differentiate read and write advance modes

Remember written chunks during writing

Setup frontend for inquiring a record component for available chunks

Remove trailing blanks

Add support for inquiring chunks in ADIOS2 backend

write a chunk table per rank and dataset

this allows to have workflows where single ranks write different numbers of chunks without introducing unnecessary mpi communication

Introduce own datatype for return type of BaseRecordComponent::availableChunks

Add OVER to AdvanceStatus

Fix a number of bugs concerning the processing of futures

Differentiate when to end step manually upon destruction

Allow workflows where one rank contributes nothing to a dataset

Re-read the hierarchy tree after advance

Two small fixes

Turn advance into a no-op in non-streaming mode

Current implementation breaks ADIOS2 file-based engines, this is preliminary up until a more sensible implementation for file-based engines.

Allow to call advance at the end of writing without opening new step

Fix passing of parameters in MPI mode

Return OVER on advance in read- and file-based mode

Let simulations explicitly set an iteration as finalized

Store datasets explicitly in form of attributes

Necessary since ADIOS2 does not show variables if no data has been written to them.

Write dummy values to adios variables if they havent been touched in a step

Add utility indexing functions

Add method to automatically load all chunks that are available

Add more flexible overload to previous commit's method

Allows the user to allocate buffers himself

Revert "Store datasets explicitly in form of attributes"

This reverts commit b68895e.
Has been made obsolete by following commit (41d9e62) and causes problems when reading constant record components.

Ensure that attributes are not read too late

Fix 1: read Series' attributes before descenting the openPMD tree
Fix 2: ensure that a step is active before any reading command

Add collectStrided to TaggedChunk struct

Documentation

Resolve frontend bug concerning advance and asynchronous execution

Only reparse openPMD tree after advance has succeeded.

Make advance return faster in read mode

Do not wait until next step begins, but wait in the returned future.

Take reference of Series in advance future

Series object will call destructor so it is problematic to make a copy. (todo: open an issue for this)

Fix indexing bug in Dataset::restrictToSelection

Use ADIOS2's own BlockInfo method to extract available chunks

Remove some functions that are not needed any more since the last commit

Simplify writtenChunks member of BufferedActions struct

Only names of written variables are still of interest.

Make chain_futures more flexible

Allow to decide execution strategy for first future at compile time by template parameters.

Directly return a ConsumingFuture on advance

Link issue in Series::advance

openPMD#534

Don't re-read finalized Iterations

This has been a massive performance drain.
openPMD#534

This should be extended to further levels of the openPMD hierarchy.

Remember which variables are dummies

To avoid accidentally loading dummy chunks.

Use last commit to provide a method to ask whether var is dummy

Guard availableChunks() against dummy variables

Little refactor of BufferedActions class

make some members private and remove some stale functionality
store stream status as enum instead of several booleans

Add facility to buffer attribute maps

Use buffering of last commit

Document future

Remember whether ConsumingFuture is running or not

Fix a bug with deferred advancing in read mode

Avoid empty reads

Remember whether a record component has already been read

Do not write dummies any more

Parse datasets once only

The do (currently) not change, and reparsing may be harmful because ADIOS2 does not send variables if no data has been written in a step.

Add chunk assignment facility

Without implementation for second pass and egalitarian chunk assignment so far.

Make rank meta info more consistent

Add trivial implementation for SplitEgalitarian

Also some bugfixes

Move ranksPerHost to FirstPass base class

Add a simple implementation for the second pass

Use adios2::Variable<T>::Info::WriterID member

Split loadAvailableChunksContiguous in two functions

Internal function uses chunks passed to it and loads them.

Return to loadAvailableChunksContiguous not taking a reference to the provideBuffer functor

Add auxiliary::read_file_by_lines

Add ranksMetaInfo attribute to Series object

Make setMpiRanksMetaInfo pass if file does not exist

Add Series::setMpiRanksMetaInfoByEnvvar

Rename some methods in Series, also remember MPI Communicator

Add Series::setMpiRanksMetaInfo( std::string const & myRankInfo )

Add Wrapper for gethostname

Use Method enum to enable switching host identification method at runtime

Add function to allow allgathering var-sized strings

Add FirstPassByCuboidSlice

Correctly read rank meta info also if world size = 1

Add facility to dump times

Perform a flush when advancing in file-based mode

This is temporary until a better implementation.

Fix deadlock when one rank does not contribute data in file-based mode

Close files after Iteration::finalize()

Make MPI helper functions inlineable

(might take this commit back again, mainly to avoid linking errors for now)

Do not re-parse the Series once the stream is over

Make ADIOS2 backend usable in serial when compiled with MPI

Allow to choose time formatting more flexibly

Drop finalized iterations

This will help avoid building up huge amounts of attributes.

Frontend support for staling groups

STALE_GROUP task that will (for now) be sent as a hint to backends for iterations that are not going to be modified any longer.

Add ADIOS2 support for declaring a group stale

Some documentation for the traits in Streaming.hpp

Move CuboidSlice to SplitEgalitarian

Add ChunkTable::splitToSizeSorted

Implement SplitEgalitarianSliceIncomingChunks

Fix bug in MPI mode

Resolve compiler warnings about control flow reaching end of non-void functions

Merge SecondPass and SplitEgalitarian

Name things more orderly and add first pass that does nothing

Temporarily workaround the changed behaviour of AvailableAttributes

To remove this workaround, create for each hierarchical group in the openPMD hierarchy a dummy variable so that prefixed AvailableAttributes will work again.

Adapt second_pass::SliceIncomingChunks to have provable bin usage guarantees

Buffer attributes map

Use the fact that std::map sorts string lexicographically

This allows faster lookup by prefix.

Dito for variables

Fix ADIOS2IOHandler dummy constructors if ADIOS2 is not built

Close IO object upon closing a file

Make ADIOS2 backend aware of existence of BP4 engine and set BP3 as default
franzpoeschel pushed a commit to franzpoeschel/openPMD-api that referenced this issue Jan 10, 2020
Do not set `-Werror` during Spack/dependency install phase.

README: Author Contributions

Acknowledgements in the README, not only in meta-data :)

JSON Backend: Throw if Missing

In case the JSON backend is voluntarily disabled, we should throw
as in other I/O backends about missing support.

Allow choosing ADIOS2 Engine type from the frontend

Implemented by allowing to specify generic settings in form of a map<string,string>.

Set options via JSON

Set engine parameters from JSON

Do not expose JSON library publicly

Fix passing of parameters in MPI mode

Remove notifyOption from ADIOS2IOHandler

also some formatting

Add advance method to Writable class

Move advance logic from Writable to Series

Simple implementation for starting a next step in ADIOS2

Remove path field from ADVANCE task

To be handled in the standard way by OPEN_FILE et al.

Differentiate read and write advance modes

Remember written chunks during writing

Setup frontend for inquiring a record component for available chunks

Remove trailing blanks

Add support for inquiring chunks in ADIOS2 backend

write a chunk table per rank and dataset

this allows to have workflows where single ranks write different numbers of chunks without introducing unnecessary mpi communication

Introduce own datatype for return type of BaseRecordComponent::availableChunks

Add OVER to AdvanceStatus

Fix a number of bugs concerning the processing of futures

Differentiate when to end step manually upon destruction

Allow workflows where one rank contributes nothing to a dataset

Re-read the hierarchy tree after advance

Two small fixes

Turn advance into a no-op in non-streaming mode

Current implementation breaks ADIOS2 file-based engines, this is preliminary up until a more sensible implementation for file-based engines.

Allow to call advance at the end of writing without opening new step

Fix passing of parameters in MPI mode

Return OVER on advance in read- and file-based mode

Let simulations explicitly set an iteration as finalized

Store datasets explicitly in form of attributes

Necessary since ADIOS2 does not show variables if no data has been written to them.

Write dummy values to adios variables if they havent been touched in a step

Add utility indexing functions

Add method to automatically load all chunks that are available

Add more flexible overload to previous commit's method

Allows the user to allocate buffers himself

Revert "Store datasets explicitly in form of attributes"

This reverts commit b68895e.
Has been made obsolete by following commit (41d9e62) and causes problems when reading constant record components.

Ensure that attributes are not read too late

Fix 1: read Series' attributes before descenting the openPMD tree
Fix 2: ensure that a step is active before any reading command

Add collectStrided to TaggedChunk struct

Documentation

Resolve frontend bug concerning advance and asynchronous execution

Only reparse openPMD tree after advance has succeeded.

Make advance return faster in read mode

Do not wait until next step begins, but wait in the returned future.

Take reference of Series in advance future

Series object will call destructor so it is problematic to make a copy. (todo: open an issue for this)

Fix indexing bug in Dataset::restrictToSelection

Use ADIOS2's own BlockInfo method to extract available chunks

Remove some functions that are not needed any more since the last commit

Simplify writtenChunks member of BufferedActions struct

Only names of written variables are still of interest.

Make chain_futures more flexible

Allow to decide execution strategy for first future at compile time by template parameters.

Directly return a ConsumingFuture on advance

Link issue in Series::advance

openPMD#534

Don't re-read finalized Iterations

This has been a massive performance drain.
openPMD#534

This should be extended to further levels of the openPMD hierarchy.

Remember which variables are dummies

To avoid accidentally loading dummy chunks.

Use last commit to provide a method to ask whether var is dummy

Guard availableChunks() against dummy variables

Little refactor of BufferedActions class

make some members private and remove some stale functionality
store stream status as enum instead of several booleans

Add facility to buffer attribute maps

Use buffering of last commit

Document future

Remember whether ConsumingFuture is running or not

Fix a bug with deferred advancing in read mode

Avoid empty reads

Remember whether a record component has already been read

Do not write dummies any more

Parse datasets once only

The do (currently) not change, and reparsing may be harmful because ADIOS2 does not send variables if no data has been written in a step.

Add chunk assignment facility

Without implementation for second pass and egalitarian chunk assignment so far.

Make rank meta info more consistent

Add trivial implementation for SplitEgalitarian

Also some bugfixes

Move ranksPerHost to FirstPass base class

Add a simple implementation for the second pass

Use adios2::Variable<T>::Info::WriterID member

Split loadAvailableChunksContiguous in two functions

Internal function uses chunks passed to it and loads them.

Return to loadAvailableChunksContiguous not taking a reference to the provideBuffer functor

Add auxiliary::read_file_by_lines

Add ranksMetaInfo attribute to Series object

Make setMpiRanksMetaInfo pass if file does not exist

Add Series::setMpiRanksMetaInfoByEnvvar

Rename some methods in Series, also remember MPI Communicator

Add Series::setMpiRanksMetaInfo( std::string const & myRankInfo )

Add Wrapper for gethostname

Use Method enum to enable switching host identification method at runtime

Add function to allow allgathering var-sized strings

Add FirstPassByCuboidSlice

Correctly read rank meta info also if world size = 1

Add facility to dump times

Perform a flush when advancing in file-based mode

This is temporary until a better implementation.

Fix deadlock when one rank does not contribute data in file-based mode

Close files after Iteration::finalize()

Make MPI helper functions inlineable

(might take this commit back again, mainly to avoid linking errors for now)

Do not re-parse the Series once the stream is over

Make ADIOS2 backend usable in serial when compiled with MPI

Allow to choose time formatting more flexibly

Drop finalized iterations

This will help avoid building up huge amounts of attributes.

Frontend support for staling groups

STALE_GROUP task that will (for now) be sent as a hint to backends for iterations that are not going to be modified any longer.

Add ADIOS2 support for declaring a group stale

Some documentation for the traits in Streaming.hpp

Move CuboidSlice to SplitEgalitarian

Add ChunkTable::splitToSizeSorted

Implement SplitEgalitarianSliceIncomingChunks

Fix bug in MPI mode

Resolve compiler warnings about control flow reaching end of non-void functions

Merge SecondPass and SplitEgalitarian

Name things more orderly and add first pass that does nothing

Temporarily workaround the changed behaviour of AvailableAttributes

To remove this workaround, create for each hierarchical group in the openPMD hierarchy a dummy variable so that prefixed AvailableAttributes will work again.

Adapt second_pass::SliceIncomingChunks to have provable bin usage guarantees

Buffer attributes map

Use the fact that std::map sorts string lexicographically

This allows faster lookup by prefix.

Dito for variables

Fix ADIOS2IOHandler dummy constructors if ADIOS2 is not built

Close IO object upon closing a file

Make ADIOS2 backend aware of existence of BP4 engine and set BP3 as default
franzpoeschel pushed a commit to franzpoeschel/openPMD-api that referenced this issue Jan 13, 2020
Do not set `-Werror` during Spack/dependency install phase.

README: Author Contributions

Acknowledgements in the README, not only in meta-data :)

JSON Backend: Throw if Missing

In case the JSON backend is voluntarily disabled, we should throw
as in other I/O backends about missing support.

Allow choosing ADIOS2 Engine type from the frontend

Implemented by allowing to specify generic settings in form of a map<string,string>.

Set options via JSON

Set engine parameters from JSON

Do not expose JSON library publicly

Fix passing of parameters in MPI mode

Remove notifyOption from ADIOS2IOHandler

also some formatting

Add advance method to Writable class

Move advance logic from Writable to Series

Simple implementation for starting a next step in ADIOS2

Remove path field from ADVANCE task

To be handled in the standard way by OPEN_FILE et al.

Differentiate read and write advance modes

Remember written chunks during writing

Setup frontend for inquiring a record component for available chunks

Remove trailing blanks

Add support for inquiring chunks in ADIOS2 backend

write a chunk table per rank and dataset

this allows to have workflows where single ranks write different numbers of chunks without introducing unnecessary mpi communication

Introduce own datatype for return type of BaseRecordComponent::availableChunks

Add OVER to AdvanceStatus

Fix a number of bugs concerning the processing of futures

Differentiate when to end step manually upon destruction

Allow workflows where one rank contributes nothing to a dataset

Re-read the hierarchy tree after advance

Two small fixes

Turn advance into a no-op in non-streaming mode

Current implementation breaks ADIOS2 file-based engines, this is preliminary up until a more sensible implementation for file-based engines.

Allow to call advance at the end of writing without opening new step

Fix passing of parameters in MPI mode

Return OVER on advance in read- and file-based mode

Let simulations explicitly set an iteration as finalized

Store datasets explicitly in form of attributes

Necessary since ADIOS2 does not show variables if no data has been written to them.

Write dummy values to adios variables if they havent been touched in a step

Add utility indexing functions

Add method to automatically load all chunks that are available

Add more flexible overload to previous commit's method

Allows the user to allocate buffers himself

Revert "Store datasets explicitly in form of attributes"

This reverts commit b68895e.
Has been made obsolete by following commit (41d9e62) and causes problems when reading constant record components.

Ensure that attributes are not read too late

Fix 1: read Series' attributes before descenting the openPMD tree
Fix 2: ensure that a step is active before any reading command

Add collectStrided to TaggedChunk struct

Documentation

Resolve frontend bug concerning advance and asynchronous execution

Only reparse openPMD tree after advance has succeeded.

Make advance return faster in read mode

Do not wait until next step begins, but wait in the returned future.

Take reference of Series in advance future

Series object will call destructor so it is problematic to make a copy. (todo: open an issue for this)

Fix indexing bug in Dataset::restrictToSelection

Use ADIOS2's own BlockInfo method to extract available chunks

Remove some functions that are not needed any more since the last commit

Simplify writtenChunks member of BufferedActions struct

Only names of written variables are still of interest.

Make chain_futures more flexible

Allow to decide execution strategy for first future at compile time by template parameters.

Directly return a ConsumingFuture on advance

Link issue in Series::advance

openPMD#534

Don't re-read finalized Iterations

This has been a massive performance drain.
openPMD#534

This should be extended to further levels of the openPMD hierarchy.

Remember which variables are dummies

To avoid accidentally loading dummy chunks.

Use last commit to provide a method to ask whether var is dummy

Guard availableChunks() against dummy variables

Little refactor of BufferedActions class

make some members private and remove some stale functionality
store stream status as enum instead of several booleans

Add facility to buffer attribute maps

Use buffering of last commit

Document future

Remember whether ConsumingFuture is running or not

Fix a bug with deferred advancing in read mode

Avoid empty reads

Remember whether a record component has already been read

Do not write dummies any more

Parse datasets once only

The do (currently) not change, and reparsing may be harmful because ADIOS2 does not send variables if no data has been written in a step.

Add chunk assignment facility

Without implementation for second pass and egalitarian chunk assignment so far.

Make rank meta info more consistent

Add trivial implementation for SplitEgalitarian

Also some bugfixes

Move ranksPerHost to FirstPass base class

Add a simple implementation for the second pass

Use adios2::Variable<T>::Info::WriterID member

Split loadAvailableChunksContiguous in two functions

Internal function uses chunks passed to it and loads them.

Return to loadAvailableChunksContiguous not taking a reference to the provideBuffer functor

Add auxiliary::read_file_by_lines

Add ranksMetaInfo attribute to Series object

Make setMpiRanksMetaInfo pass if file does not exist

Add Series::setMpiRanksMetaInfoByEnvvar

Rename some methods in Series, also remember MPI Communicator

Add Series::setMpiRanksMetaInfo( std::string const & myRankInfo )

Add Wrapper for gethostname

Use Method enum to enable switching host identification method at runtime

Add function to allow allgathering var-sized strings

Add FirstPassByCuboidSlice

Correctly read rank meta info also if world size = 1

Add facility to dump times

Perform a flush when advancing in file-based mode

This is temporary until a better implementation.

Fix deadlock when one rank does not contribute data in file-based mode

Close files after Iteration::finalize()

Make MPI helper functions inlineable

(might take this commit back again, mainly to avoid linking errors for now)

Do not re-parse the Series once the stream is over

Make ADIOS2 backend usable in serial when compiled with MPI

Allow to choose time formatting more flexibly

Drop finalized iterations

This will help avoid building up huge amounts of attributes.

Frontend support for staling groups

STALE_GROUP task that will (for now) be sent as a hint to backends for iterations that are not going to be modified any longer.

Add ADIOS2 support for declaring a group stale

Some documentation for the traits in Streaming.hpp

Move CuboidSlice to SplitEgalitarian

Add ChunkTable::splitToSizeSorted

Implement SplitEgalitarianSliceIncomingChunks

Fix bug in MPI mode

Resolve compiler warnings about control flow reaching end of non-void functions

Merge SecondPass and SplitEgalitarian

Name things more orderly and add first pass that does nothing

Temporarily workaround the changed behaviour of AvailableAttributes

To remove this workaround, create for each hierarchical group in the openPMD hierarchy a dummy variable so that prefixed AvailableAttributes will work again.

Adapt second_pass::SliceIncomingChunks to have provable bin usage guarantees

Buffer attributes map

Use the fact that std::map sorts string lexicographically

This allows faster lookup by prefix.

Dito for variables

Fix ADIOS2IOHandler dummy constructors if ADIOS2 is not built

Close IO object upon closing a file

Make ADIOS2 backend aware of existence of BP4 engine and set BP3 as default
franzpoeschel pushed a commit to franzpoeschel/openPMD-api that referenced this issue Jan 13, 2020
Do not set `-Werror` during Spack/dependency install phase.

README: Author Contributions

Acknowledgements in the README, not only in meta-data :)

JSON Backend: Throw if Missing

In case the JSON backend is voluntarily disabled, we should throw
as in other I/O backends about missing support.

Allow choosing ADIOS2 Engine type from the frontend

Implemented by allowing to specify generic settings in form of a map<string,string>.

Set options via JSON

Set engine parameters from JSON

Do not expose JSON library publicly

Fix passing of parameters in MPI mode

Remove notifyOption from ADIOS2IOHandler

also some formatting

Add advance method to Writable class

Move advance logic from Writable to Series

Simple implementation for starting a next step in ADIOS2

Remove path field from ADVANCE task

To be handled in the standard way by OPEN_FILE et al.

Differentiate read and write advance modes

Remember written chunks during writing

Setup frontend for inquiring a record component for available chunks

Remove trailing blanks

Add support for inquiring chunks in ADIOS2 backend

write a chunk table per rank and dataset

this allows to have workflows where single ranks write different numbers of chunks without introducing unnecessary mpi communication

Introduce own datatype for return type of BaseRecordComponent::availableChunks

Add OVER to AdvanceStatus

Fix a number of bugs concerning the processing of futures

Differentiate when to end step manually upon destruction

Allow workflows where one rank contributes nothing to a dataset

Re-read the hierarchy tree after advance

Two small fixes

Turn advance into a no-op in non-streaming mode

Current implementation breaks ADIOS2 file-based engines, this is preliminary up until a more sensible implementation for file-based engines.

Allow to call advance at the end of writing without opening new step

Fix passing of parameters in MPI mode

Return OVER on advance in read- and file-based mode

Let simulations explicitly set an iteration as finalized

Store datasets explicitly in form of attributes

Necessary since ADIOS2 does not show variables if no data has been written to them.

Write dummy values to adios variables if they havent been touched in a step

Add utility indexing functions

Add method to automatically load all chunks that are available

Add more flexible overload to previous commit's method

Allows the user to allocate buffers himself

Revert "Store datasets explicitly in form of attributes"

This reverts commit b68895e.
Has been made obsolete by following commit (41d9e62) and causes problems when reading constant record components.

Ensure that attributes are not read too late

Fix 1: read Series' attributes before descenting the openPMD tree
Fix 2: ensure that a step is active before any reading command

Add collectStrided to TaggedChunk struct

Documentation

Resolve frontend bug concerning advance and asynchronous execution

Only reparse openPMD tree after advance has succeeded.

Make advance return faster in read mode

Do not wait until next step begins, but wait in the returned future.

Take reference of Series in advance future

Series object will call destructor so it is problematic to make a copy. (todo: open an issue for this)

Fix indexing bug in Dataset::restrictToSelection

Use ADIOS2's own BlockInfo method to extract available chunks

Remove some functions that are not needed any more since the last commit

Simplify writtenChunks member of BufferedActions struct

Only names of written variables are still of interest.

Make chain_futures more flexible

Allow to decide execution strategy for first future at compile time by template parameters.

Directly return a ConsumingFuture on advance

Link issue in Series::advance

openPMD#534

Don't re-read finalized Iterations

This has been a massive performance drain.
openPMD#534

This should be extended to further levels of the openPMD hierarchy.

Remember which variables are dummies

To avoid accidentally loading dummy chunks.

Use last commit to provide a method to ask whether var is dummy

Guard availableChunks() against dummy variables

Little refactor of BufferedActions class

make some members private and remove some stale functionality
store stream status as enum instead of several booleans

Add facility to buffer attribute maps

Use buffering of last commit

Document future

Remember whether ConsumingFuture is running or not

Fix a bug with deferred advancing in read mode

Avoid empty reads

Remember whether a record component has already been read

Do not write dummies any more

Parse datasets once only

The do (currently) not change, and reparsing may be harmful because ADIOS2 does not send variables if no data has been written in a step.

Add chunk assignment facility

Without implementation for second pass and egalitarian chunk assignment so far.

Make rank meta info more consistent

Add trivial implementation for SplitEgalitarian

Also some bugfixes

Move ranksPerHost to FirstPass base class

Add a simple implementation for the second pass

Use adios2::Variable<T>::Info::WriterID member

Split loadAvailableChunksContiguous in two functions

Internal function uses chunks passed to it and loads them.

Return to loadAvailableChunksContiguous not taking a reference to the provideBuffer functor

Add auxiliary::read_file_by_lines

Add ranksMetaInfo attribute to Series object

Make setMpiRanksMetaInfo pass if file does not exist

Add Series::setMpiRanksMetaInfoByEnvvar

Rename some methods in Series, also remember MPI Communicator

Add Series::setMpiRanksMetaInfo( std::string const & myRankInfo )

Add Wrapper for gethostname

Use Method enum to enable switching host identification method at runtime

Add function to allow allgathering var-sized strings

Add FirstPassByCuboidSlice

Correctly read rank meta info also if world size = 1

Add facility to dump times

Perform a flush when advancing in file-based mode

This is temporary until a better implementation.

Fix deadlock when one rank does not contribute data in file-based mode

Close files after Iteration::finalize()

Make MPI helper functions inlineable

(might take this commit back again, mainly to avoid linking errors for now)

Do not re-parse the Series once the stream is over

Make ADIOS2 backend usable in serial when compiled with MPI

Allow to choose time formatting more flexibly

Drop finalized iterations

This will help avoid building up huge amounts of attributes.

Frontend support for staling groups

STALE_GROUP task that will (for now) be sent as a hint to backends for iterations that are not going to be modified any longer.

Add ADIOS2 support for declaring a group stale

Some documentation for the traits in Streaming.hpp

Move CuboidSlice to SplitEgalitarian

Add ChunkTable::splitToSizeSorted

Implement SplitEgalitarianSliceIncomingChunks

Fix bug in MPI mode

Resolve compiler warnings about control flow reaching end of non-void functions

Merge SecondPass and SplitEgalitarian

Name things more orderly and add first pass that does nothing

Temporarily workaround the changed behaviour of AvailableAttributes

To remove this workaround, create for each hierarchical group in the openPMD hierarchy a dummy variable so that prefixed AvailableAttributes will work again.

Adapt second_pass::SliceIncomingChunks to have provable bin usage guarantees

Buffer attributes map

Use the fact that std::map sorts string lexicographically

This allows faster lookup by prefix.

Dito for variables

Fix ADIOS2IOHandler dummy constructors if ADIOS2 is not built

Close IO object upon closing a file

Make ADIOS2 backend aware of existence of BP4 engine and set BP3 as default
franzpoeschel pushed a commit to franzpoeschel/openPMD-api that referenced this issue Jan 13, 2020
Do not set `-Werror` during Spack/dependency install phase.

README: Author Contributions

Acknowledgements in the README, not only in meta-data :)

JSON Backend: Throw if Missing

In case the JSON backend is voluntarily disabled, we should throw
as in other I/O backends about missing support.

Allow choosing ADIOS2 Engine type from the frontend

Implemented by allowing to specify generic settings in form of a map<string,string>.

Set options via JSON

Set engine parameters from JSON

Do not expose JSON library publicly

Fix passing of parameters in MPI mode

Remove notifyOption from ADIOS2IOHandler

also some formatting

Add advance method to Writable class

Move advance logic from Writable to Series

Simple implementation for starting a next step in ADIOS2

Remove path field from ADVANCE task

To be handled in the standard way by OPEN_FILE et al.

Differentiate read and write advance modes

Remember written chunks during writing

Setup frontend for inquiring a record component for available chunks

Remove trailing blanks

Add support for inquiring chunks in ADIOS2 backend

write a chunk table per rank and dataset

this allows to have workflows where single ranks write different numbers of chunks without introducing unnecessary mpi communication

Introduce own datatype for return type of BaseRecordComponent::availableChunks

Add OVER to AdvanceStatus

Fix a number of bugs concerning the processing of futures

Differentiate when to end step manually upon destruction

Allow workflows where one rank contributes nothing to a dataset

Re-read the hierarchy tree after advance

Two small fixes

Turn advance into a no-op in non-streaming mode

Current implementation breaks ADIOS2 file-based engines, this is preliminary up until a more sensible implementation for file-based engines.

Allow to call advance at the end of writing without opening new step

Fix passing of parameters in MPI mode

Return OVER on advance in read- and file-based mode

Let simulations explicitly set an iteration as finalized

Store datasets explicitly in form of attributes

Necessary since ADIOS2 does not show variables if no data has been written to them.

Write dummy values to adios variables if they havent been touched in a step

Add utility indexing functions

Add method to automatically load all chunks that are available

Add more flexible overload to previous commit's method

Allows the user to allocate buffers himself

Revert "Store datasets explicitly in form of attributes"

This reverts commit b68895e.
Has been made obsolete by following commit (41d9e62) and causes problems when reading constant record components.

Ensure that attributes are not read too late

Fix 1: read Series' attributes before descenting the openPMD tree
Fix 2: ensure that a step is active before any reading command

Add collectStrided to TaggedChunk struct

Documentation

Resolve frontend bug concerning advance and asynchronous execution

Only reparse openPMD tree after advance has succeeded.

Make advance return faster in read mode

Do not wait until next step begins, but wait in the returned future.

Take reference of Series in advance future

Series object will call destructor so it is problematic to make a copy. (todo: open an issue for this)

Fix indexing bug in Dataset::restrictToSelection

Use ADIOS2's own BlockInfo method to extract available chunks

Remove some functions that are not needed any more since the last commit

Simplify writtenChunks member of BufferedActions struct

Only names of written variables are still of interest.

Make chain_futures more flexible

Allow to decide execution strategy for first future at compile time by template parameters.

Directly return a ConsumingFuture on advance

Link issue in Series::advance

openPMD#534

Don't re-read finalized Iterations

This has been a massive performance drain.
openPMD#534

This should be extended to further levels of the openPMD hierarchy.

Remember which variables are dummies

To avoid accidentally loading dummy chunks.

Use last commit to provide a method to ask whether var is dummy

Guard availableChunks() against dummy variables

Little refactor of BufferedActions class

make some members private and remove some stale functionality
store stream status as enum instead of several booleans

Add facility to buffer attribute maps

Use buffering of last commit

Document future

Remember whether ConsumingFuture is running or not

Fix a bug with deferred advancing in read mode

Avoid empty reads

Remember whether a record component has already been read

Do not write dummies any more

Parse datasets once only

The do (currently) not change, and reparsing may be harmful because ADIOS2 does not send variables if no data has been written in a step.

Add chunk assignment facility

Without implementation for second pass and egalitarian chunk assignment so far.

Make rank meta info more consistent

Add trivial implementation for SplitEgalitarian

Also some bugfixes

Move ranksPerHost to FirstPass base class

Add a simple implementation for the second pass

Use adios2::Variable<T>::Info::WriterID member

Split loadAvailableChunksContiguous in two functions

Internal function uses chunks passed to it and loads them.

Return to loadAvailableChunksContiguous not taking a reference to the provideBuffer functor

Add auxiliary::read_file_by_lines

Add ranksMetaInfo attribute to Series object

Make setMpiRanksMetaInfo pass if file does not exist

Add Series::setMpiRanksMetaInfoByEnvvar

Rename some methods in Series, also remember MPI Communicator

Add Series::setMpiRanksMetaInfo( std::string const & myRankInfo )

Add Wrapper for gethostname

Use Method enum to enable switching host identification method at runtime

Add function to allow allgathering var-sized strings

Add FirstPassByCuboidSlice

Correctly read rank meta info also if world size = 1

Add facility to dump times

Perform a flush when advancing in file-based mode

This is temporary until a better implementation.

Fix deadlock when one rank does not contribute data in file-based mode

Close files after Iteration::finalize()

Make MPI helper functions inlineable

(might take this commit back again, mainly to avoid linking errors for now)

Do not re-parse the Series once the stream is over

Make ADIOS2 backend usable in serial when compiled with MPI

Allow to choose time formatting more flexibly

Drop finalized iterations

This will help avoid building up huge amounts of attributes.

Frontend support for staling groups

STALE_GROUP task that will (for now) be sent as a hint to backends for iterations that are not going to be modified any longer.

Add ADIOS2 support for declaring a group stale

Some documentation for the traits in Streaming.hpp

Move CuboidSlice to SplitEgalitarian

Add ChunkTable::splitToSizeSorted

Implement SplitEgalitarianSliceIncomingChunks

Fix bug in MPI mode

Resolve compiler warnings about control flow reaching end of non-void functions

Merge SecondPass and SplitEgalitarian

Name things more orderly and add first pass that does nothing

Temporarily workaround the changed behaviour of AvailableAttributes

To remove this workaround, create for each hierarchical group in the openPMD hierarchy a dummy variable so that prefixed AvailableAttributes will work again.

Adapt second_pass::SliceIncomingChunks to have provable bin usage guarantees

Buffer attributes map

Use the fact that std::map sorts string lexicographically

This allows faster lookup by prefix.

Dito for variables

Fix ADIOS2IOHandler dummy constructors if ADIOS2 is not built

Close IO object upon closing a file

Make ADIOS2 backend aware of existence of BP4 engine and set BP3 as default
@ax3l
Copy link
Member

ax3l commented Jan 28, 2020

flush() is painfully implemented, we have to urgently change its meaning.
The only thing flush() shall do is:

For flush() is shall not be relevant:

  • that a physical file is created (cannot be guaranteed anyway) or that data was received - it's just not under the callers control anymore
  • that the written data structures are already openPMD compliant (default attributes and records can be added on Record::finalize(), Iteration::finalize() or Series::finalize()).

Currently Series::flush() tries to achieve the latter on top of its actual task - and it's a mess.

Consequently, in MPI-context the Series::flush() call must be non-collective (can be blocking, as long as a progress guarantee is ensured). The newly added ::finalize() members can (must) be collective and blocking.

franzpoeschel added a commit to franzpoeschel/picongpu that referenced this issue Mar 3, 2020
franzpoeschel added a commit to franzpoeschel/picongpu that referenced this issue Mar 3, 2020
franzpoeschel added a commit to franzpoeschel/picongpu that referenced this issue Mar 3, 2020
franzpoeschel added a commit to franzpoeschel/picongpu that referenced this issue Mar 4, 2020
franzpoeschel added a commit to franzpoeschel/picongpu that referenced this issue Mar 25, 2020
Create openPMDWriter based on ADIOSWriter (WIP)

Adapt CountParticles partially to openPMD

Adapt WriteSpecies to openPMD

Translate WriteMeta.hpp to openPMD

Add function "asStandardVector()"

Translate NDScalars.hpp to openPMD

Adapt everything to openPMD except for the main file (openPMDWriter.hpp)

Adapt openPMDWriter.hpp to openPMD WIP

Change management of openPMD Series

Further adapt openPMDWriter to openPMD

Add openPMD to CMake

Add openPMD to version formatting

Properly acquaint openPMD plugin with build and help system

Make openPMD namespacing explicit

Remove adios-specific fields from ThreadParams

First successfull run with LaserWakeField example

Cleanup

Use clang-format

Update licensing information

Separate basename and filename extension into two separate help parameters

Refactor dataset creation

Use Mesh::setTimeOffset() template

Causes a linker error with the current version of openPMD API, a fix will be merged soon on the dev branch.

Clean up some leftovers

Use ASCII characters to spell my name

Remove unnecessary whitespaces

Adapt to removal of pmacc::forward

Remove accidentally versioned config file

Make checkpoints usable

Fix a number of bugs concerning the reading of checkpoints
Still problematic is the attribute "timeOffset", currently mitigated by uncommenting the sanity check in the openPMD API. Needs further investigation.

Remove CollectFieldsSizes

Legacy from ADIOS writer, not necessary in openPMD.

Remove ParticleAttributeSize and openPMDCountParticles

Legacy from ADIOS Writer

Use clang-format

Adhere to openPMD requirements before flushing

For a given particle species, the openPMD API requires that required records (such as "position", "positionOffset") and their contained components be defined (not necessarily written). Make sure to define all such datasets before issuing the first flush.

Maybe open an issue in the openPMD API to allow for a more flexible usage.

Fix an indexing bug

Eliminate dataset preparation for NDScalars

Also fix a bug where particles were named wrongly in checkpoints.

Do not write empty particle datasets

Treat non-existing datasets as empty in reading

Remove prepared datasets

Remove WithWindow struct

Use transform to enable ADIOS1 compression

Remove accidentally versioned files

Rename LoadParticleAttributesFromADIOS to LoadParticleAttributesFromOpenPMD

Remove traces of the old ADIOS plugin

mostly the word "adios" from comments

Take copies and not references of openPMD handles

Fix autoformatting

Require newer openPMD API

Also add ADIOS2_ROOT to CMAKE_PREFIX_PATH

Add version label to format string only if present

Replace typedefs with using

Remove further indexing bug

in writing particles_info table

Cleanup restart

Remove dataset preparation

Commit 0b50561 reintroduced a reduced form of dataset preparation in order to adhere to requirements (restrictions) of the openPMD API. This workaround results in dummy dataset writes (likely a bug in the openPMD API), hence this commit reverts those changes.
The corresponding pull request in the openPMD API to relax this restriction can be found at openPMD/openPMD-api#518.

Postpone writing of meta attributes

Due to a bug in the ADIOS1 backend of the openPMD API, the first dataset needs to be written before the first flush. This works around the problem by first defining all the fields and particles.
Bug report will follow.

Resolve counting bug during particle writing

Fix whitespaces

Separate ADIOS and HDF5 particle writing strategies

Allow choosing strategy as runtime parameter

Cleanup

Fix openPMD version formatting

Update examples to use openPMD

Refactor passing of filename and extension

Reassemble filename and extension upon opening the series.

Fix some missing includes

Do not skip writing empty datasets

See openPMD PR: openPMD/openPMD-api#529
This allows to write empty datasets

Remove debugging leftovers

Write timeOffset for particles in a standard-compliant way

Do not declare zero-sized arrays

C++ standard requires that array size evaluate to a value greater than zero.

Do not use storeChunk on empty datasets

centralize initialization of thread params from config

Fix undefined identifier in assert statements

Error passes silently in release builds.

Pass JSON config to openPMD::Series ctor

Do not copy Series object

see openPMD/openPMD-api#534

Allow NULL as configuration infix to denote empty string

Adapt to changes in pmacc etc.

Enable use of group-based layout as well

Requires keeping openPMD Series open. Since openPMD currently has no
explicit call to close a file, we implement this only for group-based
layout for now.

Do not use deprecated Series::setSoftwareVersion call

Apply commit b797c0a to openPMD backend

Formatting in .cfg files

Fix an uninitialized value and an indexing bug

Implement reviewers' comments concerning CMakeLists
franzpoeschel added a commit to franzpoeschel/picongpu that referenced this issue Mar 25, 2020
Create openPMDWriter based on ADIOSWriter (WIP)

Adapt CountParticles partially to openPMD

Adapt WriteSpecies to openPMD

Translate WriteMeta.hpp to openPMD

Add function "asStandardVector()"

Translate NDScalars.hpp to openPMD

Adapt everything to openPMD except for the main file (openPMDWriter.hpp)

Adapt openPMDWriter.hpp to openPMD WIP

Change management of openPMD Series

Further adapt openPMDWriter to openPMD

Add openPMD to CMake

Add openPMD to version formatting

Properly acquaint openPMD plugin with build and help system

Make openPMD namespacing explicit

Remove adios-specific fields from ThreadParams

First successfull run with LaserWakeField example

Cleanup

Use clang-format

Update licensing information

Separate basename and filename extension into two separate help parameters

Refactor dataset creation

Use Mesh::setTimeOffset() template

Causes a linker error with the current version of openPMD API, a fix will be merged soon on the dev branch.

Clean up some leftovers

Use ASCII characters to spell my name

Remove unnecessary whitespaces

Adapt to removal of pmacc::forward

Remove accidentally versioned config file

Make checkpoints usable

Fix a number of bugs concerning the reading of checkpoints
Still problematic is the attribute "timeOffset", currently mitigated by uncommenting the sanity check in the openPMD API. Needs further investigation.

Remove CollectFieldsSizes

Legacy from ADIOS writer, not necessary in openPMD.

Remove ParticleAttributeSize and openPMDCountParticles

Legacy from ADIOS Writer

Use clang-format

Adhere to openPMD requirements before flushing

For a given particle species, the openPMD API requires that required records (such as "position", "positionOffset") and their contained components be defined (not necessarily written). Make sure to define all such datasets before issuing the first flush.

Maybe open an issue in the openPMD API to allow for a more flexible usage.

Fix an indexing bug

Eliminate dataset preparation for NDScalars

Also fix a bug where particles were named wrongly in checkpoints.

Do not write empty particle datasets

Treat non-existing datasets as empty in reading

Remove prepared datasets

Remove WithWindow struct

Use transform to enable ADIOS1 compression

Remove accidentally versioned files

Rename LoadParticleAttributesFromADIOS to LoadParticleAttributesFromOpenPMD

Remove traces of the old ADIOS plugin

mostly the word "adios" from comments

Take copies and not references of openPMD handles

Fix autoformatting

Require newer openPMD API

Also add ADIOS2_ROOT to CMAKE_PREFIX_PATH

Add version label to format string only if present

Replace typedefs with using

Remove further indexing bug

in writing particles_info table

Cleanup restart

Remove dataset preparation

Commit 0b50561 reintroduced a reduced form of dataset preparation in order to adhere to requirements (restrictions) of the openPMD API. This workaround results in dummy dataset writes (likely a bug in the openPMD API), hence this commit reverts those changes.
The corresponding pull request in the openPMD API to relax this restriction can be found at openPMD/openPMD-api#518.

Postpone writing of meta attributes

Due to a bug in the ADIOS1 backend of the openPMD API, the first dataset needs to be written before the first flush. This works around the problem by first defining all the fields and particles.
Bug report will follow.

Resolve counting bug during particle writing

Fix whitespaces

Separate ADIOS and HDF5 particle writing strategies

Allow choosing strategy as runtime parameter

Cleanup

Fix openPMD version formatting

Update examples to use openPMD

Refactor passing of filename and extension

Reassemble filename and extension upon opening the series.

Fix some missing includes

Do not skip writing empty datasets

See openPMD PR: openPMD/openPMD-api#529
This allows to write empty datasets

Remove debugging leftovers

Write timeOffset for particles in a standard-compliant way

Do not declare zero-sized arrays

C++ standard requires that array size evaluate to a value greater than zero.

Do not use storeChunk on empty datasets

centralize initialization of thread params from config

Fix undefined identifier in assert statements

Error passes silently in release builds.

Pass JSON config to openPMD::Series ctor

Do not copy Series object

see openPMD/openPMD-api#534

Allow NULL as configuration infix to denote empty string

Adapt to changes in pmacc etc.

Enable use of group-based layout as well

Requires keeping openPMD Series open. Since openPMD currently has no
explicit call to close a file, we implement this only for group-based
layout for now.

Do not use deprecated Series::setSoftwareVersion call

Apply commit b797c0a to openPMD backend

Formatting in .cfg files

Fix an uninitialized value and an indexing bug

Implement reviewers' comments concerning CMakeLists
franzpoeschel added a commit to franzpoeschel/picongpu that referenced this issue Mar 26, 2020
Create openPMDWriter based on ADIOSWriter (WIP)

Adapt CountParticles partially to openPMD

Adapt WriteSpecies to openPMD

Translate WriteMeta.hpp to openPMD

Add function "asStandardVector()"

Translate NDScalars.hpp to openPMD

Adapt everything to openPMD except for the main file (openPMDWriter.hpp)

Adapt openPMDWriter.hpp to openPMD WIP

Change management of openPMD Series

Further adapt openPMDWriter to openPMD

Add openPMD to CMake

Add openPMD to version formatting

Properly acquaint openPMD plugin with build and help system

Make openPMD namespacing explicit

Remove adios-specific fields from ThreadParams

First successfull run with LaserWakeField example

Cleanup

Use clang-format

Update licensing information

Separate basename and filename extension into two separate help parameters

Refactor dataset creation

Use Mesh::setTimeOffset() template

Causes a linker error with the current version of openPMD API, a fix will be merged soon on the dev branch.

Clean up some leftovers

Use ASCII characters to spell my name

Remove unnecessary whitespaces

Adapt to removal of pmacc::forward

Remove accidentally versioned config file

Make checkpoints usable

Fix a number of bugs concerning the reading of checkpoints
Still problematic is the attribute "timeOffset", currently mitigated by uncommenting the sanity check in the openPMD API. Needs further investigation.

Remove CollectFieldsSizes

Legacy from ADIOS writer, not necessary in openPMD.

Remove ParticleAttributeSize and openPMDCountParticles

Legacy from ADIOS Writer

Use clang-format

Adhere to openPMD requirements before flushing

For a given particle species, the openPMD API requires that required records (such as "position", "positionOffset") and their contained components be defined (not necessarily written). Make sure to define all such datasets before issuing the first flush.

Maybe open an issue in the openPMD API to allow for a more flexible usage.

Fix an indexing bug

Eliminate dataset preparation for NDScalars

Also fix a bug where particles were named wrongly in checkpoints.

Do not write empty particle datasets

Treat non-existing datasets as empty in reading

Remove prepared datasets

Remove WithWindow struct

Use transform to enable ADIOS1 compression

Remove accidentally versioned files

Rename LoadParticleAttributesFromADIOS to LoadParticleAttributesFromOpenPMD

Remove traces of the old ADIOS plugin

mostly the word "adios" from comments

Take copies and not references of openPMD handles

Fix autoformatting

Require newer openPMD API

Also add ADIOS2_ROOT to CMAKE_PREFIX_PATH

Add version label to format string only if present

Replace typedefs with using

Remove further indexing bug

in writing particles_info table

Cleanup restart

Remove dataset preparation

Commit 0b50561 reintroduced a reduced form of dataset preparation in order to adhere to requirements (restrictions) of the openPMD API. This workaround results in dummy dataset writes (likely a bug in the openPMD API), hence this commit reverts those changes.
The corresponding pull request in the openPMD API to relax this restriction can be found at openPMD/openPMD-api#518.

Postpone writing of meta attributes

Due to a bug in the ADIOS1 backend of the openPMD API, the first dataset needs to be written before the first flush. This works around the problem by first defining all the fields and particles.
Bug report will follow.

Resolve counting bug during particle writing

Fix whitespaces

Separate ADIOS and HDF5 particle writing strategies

Allow choosing strategy as runtime parameter

Cleanup

Fix openPMD version formatting

Update examples to use openPMD

Refactor passing of filename and extension

Reassemble filename and extension upon opening the series.

Fix some missing includes

Do not skip writing empty datasets

See openPMD PR: openPMD/openPMD-api#529
This allows to write empty datasets

Remove debugging leftovers

Write timeOffset for particles in a standard-compliant way

Do not declare zero-sized arrays

C++ standard requires that array size evaluate to a value greater than zero.

Do not use storeChunk on empty datasets

centralize initialization of thread params from config

Fix undefined identifier in assert statements

Error passes silently in release builds.

Pass JSON config to openPMD::Series ctor

Do not copy Series object

see openPMD/openPMD-api#534

Allow NULL as configuration infix to denote empty string

Adapt to changes in pmacc etc.

Enable use of group-based layout as well

Requires keeping openPMD Series open. Since openPMD currently has no
explicit call to close a file, we implement this only for group-based
layout for now.

Do not use deprecated Series::setSoftwareVersion call

Apply commit b797c0a to openPMD backend

Formatting in .cfg files

Fix an uninitialized value and an indexing bug

Implement reviewers' comments concerning CMakeLists
franzpoeschel added a commit to franzpoeschel/picongpu that referenced this issue Apr 4, 2020
Create openPMDWriter based on ADIOSWriter (WIP)

Adapt CountParticles partially to openPMD

Adapt WriteSpecies to openPMD

Translate WriteMeta.hpp to openPMD

Add function "asStandardVector()"

Translate NDScalars.hpp to openPMD

Adapt everything to openPMD except for the main file (openPMDWriter.hpp)

Adapt openPMDWriter.hpp to openPMD WIP

Change management of openPMD Series

Further adapt openPMDWriter to openPMD

Add openPMD to CMake

Add openPMD to version formatting

Properly acquaint openPMD plugin with build and help system

Make openPMD namespacing explicit

Remove adios-specific fields from ThreadParams

First successfull run with LaserWakeField example

Cleanup

Use clang-format

Update licensing information

Separate basename and filename extension into two separate help parameters

Refactor dataset creation

Use Mesh::setTimeOffset() template

Causes a linker error with the current version of openPMD API, a fix will be merged soon on the dev branch.

Clean up some leftovers

Use ASCII characters to spell my name

Remove unnecessary whitespaces

Adapt to removal of pmacc::forward

Remove accidentally versioned config file

Make checkpoints usable

Fix a number of bugs concerning the reading of checkpoints
Still problematic is the attribute "timeOffset", currently mitigated by uncommenting the sanity check in the openPMD API. Needs further investigation.

Remove CollectFieldsSizes

Legacy from ADIOS writer, not necessary in openPMD.

Remove ParticleAttributeSize and openPMDCountParticles

Legacy from ADIOS Writer

Use clang-format

Adhere to openPMD requirements before flushing

For a given particle species, the openPMD API requires that required records (such as "position", "positionOffset") and their contained components be defined (not necessarily written). Make sure to define all such datasets before issuing the first flush.

Maybe open an issue in the openPMD API to allow for a more flexible usage.

Fix an indexing bug

Eliminate dataset preparation for NDScalars

Also fix a bug where particles were named wrongly in checkpoints.

Do not write empty particle datasets

Treat non-existing datasets as empty in reading

Remove prepared datasets

Remove WithWindow struct

Use transform to enable ADIOS1 compression

Remove accidentally versioned files

Rename LoadParticleAttributesFromADIOS to LoadParticleAttributesFromOpenPMD

Remove traces of the old ADIOS plugin

mostly the word "adios" from comments

Take copies and not references of openPMD handles

Fix autoformatting

Require newer openPMD API

Also add ADIOS2_ROOT to CMAKE_PREFIX_PATH

Add version label to format string only if present

Replace typedefs with using

Remove further indexing bug

in writing particles_info table

Cleanup restart

Remove dataset preparation

Commit 0b50561 reintroduced a reduced form of dataset preparation in order to adhere to requirements (restrictions) of the openPMD API. This workaround results in dummy dataset writes (likely a bug in the openPMD API), hence this commit reverts those changes.
The corresponding pull request in the openPMD API to relax this restriction can be found at openPMD/openPMD-api#518.

Postpone writing of meta attributes

Due to a bug in the ADIOS1 backend of the openPMD API, the first dataset needs to be written before the first flush. This works around the problem by first defining all the fields and particles.
Bug report will follow.

Resolve counting bug during particle writing

Fix whitespaces

Separate ADIOS and HDF5 particle writing strategies

Allow choosing strategy as runtime parameter

Cleanup

Fix openPMD version formatting

Update examples to use openPMD

Refactor passing of filename and extension

Reassemble filename and extension upon opening the series.

Fix some missing includes

Do not skip writing empty datasets

See openPMD PR: openPMD/openPMD-api#529
This allows to write empty datasets

Remove debugging leftovers

Write timeOffset for particles in a standard-compliant way

Do not declare zero-sized arrays

C++ standard requires that array size evaluate to a value greater than zero.

Do not use storeChunk on empty datasets

centralize initialization of thread params from config

Fix undefined identifier in assert statements

Error passes silently in release builds.

Pass JSON config to openPMD::Series ctor

Do not copy Series object

see openPMD/openPMD-api#534

Allow NULL as configuration infix to denote empty string

Adapt to changes in pmacc etc.

Enable use of group-based layout as well

Requires keeping openPMD Series open. Since openPMD currently has no
explicit call to close a file, we implement this only for group-based
layout for now.

Do not use deprecated Series::setSoftwareVersion call

Apply commit b797c0a to openPMD backend

Formatting in .cfg files

Fix an uninitialized value and an indexing bug

Implement reviewers' comments concerning CMakeLists
franzpoeschel added a commit to franzpoeschel/picongpu that referenced this issue Apr 25, 2020
Create openPMDWriter based on ADIOSWriter (WIP)

Adapt CountParticles partially to openPMD

Adapt WriteSpecies to openPMD

Translate WriteMeta.hpp to openPMD

Add function "asStandardVector()"

Translate NDScalars.hpp to openPMD

Adapt everything to openPMD except for the main file (openPMDWriter.hpp)

Adapt openPMDWriter.hpp to openPMD WIP

Change management of openPMD Series

Further adapt openPMDWriter to openPMD

Add openPMD to CMake

Add openPMD to version formatting

Properly acquaint openPMD plugin with build and help system

Make openPMD namespacing explicit

Remove adios-specific fields from ThreadParams

First successfull run with LaserWakeField example

Cleanup

Use clang-format

Update licensing information

Separate basename and filename extension into two separate help parameters

Refactor dataset creation

Use Mesh::setTimeOffset() template

Causes a linker error with the current version of openPMD API, a fix will be merged soon on the dev branch.

Clean up some leftovers

Use ASCII characters to spell my name

Remove unnecessary whitespaces

Adapt to removal of pmacc::forward

Remove accidentally versioned config file

Make checkpoints usable

Fix a number of bugs concerning the reading of checkpoints
Still problematic is the attribute "timeOffset", currently mitigated by uncommenting the sanity check in the openPMD API. Needs further investigation.

Remove CollectFieldsSizes

Legacy from ADIOS writer, not necessary in openPMD.

Remove ParticleAttributeSize and openPMDCountParticles

Legacy from ADIOS Writer

Use clang-format

Adhere to openPMD requirements before flushing

For a given particle species, the openPMD API requires that required records (such as "position", "positionOffset") and their contained components be defined (not necessarily written). Make sure to define all such datasets before issuing the first flush.

Maybe open an issue in the openPMD API to allow for a more flexible usage.

Fix an indexing bug

Eliminate dataset preparation for NDScalars

Also fix a bug where particles were named wrongly in checkpoints.

Do not write empty particle datasets

Treat non-existing datasets as empty in reading

Remove prepared datasets

Remove WithWindow struct

Use transform to enable ADIOS1 compression

Remove accidentally versioned files

Rename LoadParticleAttributesFromADIOS to LoadParticleAttributesFromOpenPMD

Remove traces of the old ADIOS plugin

mostly the word "adios" from comments

Take copies and not references of openPMD handles

Fix autoformatting

Require newer openPMD API

Also add ADIOS2_ROOT to CMAKE_PREFIX_PATH

Add version label to format string only if present

Replace typedefs with using

Remove further indexing bug

in writing particles_info table

Cleanup restart

Remove dataset preparation

Commit 0b50561 reintroduced a reduced form of dataset preparation in order to adhere to requirements (restrictions) of the openPMD API. This workaround results in dummy dataset writes (likely a bug in the openPMD API), hence this commit reverts those changes.
The corresponding pull request in the openPMD API to relax this restriction can be found at openPMD/openPMD-api#518.

Postpone writing of meta attributes

Due to a bug in the ADIOS1 backend of the openPMD API, the first dataset needs to be written before the first flush. This works around the problem by first defining all the fields and particles.
Bug report will follow.

Resolve counting bug during particle writing

Fix whitespaces

Separate ADIOS and HDF5 particle writing strategies

Allow choosing strategy as runtime parameter

Cleanup

Fix openPMD version formatting

Update examples to use openPMD

Refactor passing of filename and extension

Reassemble filename and extension upon opening the series.

Fix some missing includes

Do not skip writing empty datasets

See openPMD PR: openPMD/openPMD-api#529
This allows to write empty datasets

Remove debugging leftovers

Write timeOffset for particles in a standard-compliant way

Do not declare zero-sized arrays

C++ standard requires that array size evaluate to a value greater than zero.

Do not use storeChunk on empty datasets

centralize initialization of thread params from config

Fix undefined identifier in assert statements

Error passes silently in release builds.

Pass JSON config to openPMD::Series ctor

Do not copy Series object

see openPMD/openPMD-api#534

Allow NULL as configuration infix to denote empty string

Adapt to changes in pmacc etc.

Enable use of group-based layout as well

Requires keeping openPMD Series open. Since openPMD currently has no
explicit call to close a file, we implement this only for group-based
layout for now.

Do not use deprecated Series::setSoftwareVersion call

Apply commit b797c0a to openPMD backend

Formatting in .cfg files

Fix an uninitialized value and an indexing bug

Implement reviewers' comments concerning CMakeLists
franzpoeschel added a commit to franzpoeschel/picongpu that referenced this issue May 6, 2020
Create openPMDWriter based on ADIOSWriter (WIP)

Adapt CountParticles partially to openPMD

Adapt WriteSpecies to openPMD

Translate WriteMeta.hpp to openPMD

Add function "asStandardVector()"

Translate NDScalars.hpp to openPMD

Adapt everything to openPMD except for the main file (openPMDWriter.hpp)

Adapt openPMDWriter.hpp to openPMD WIP

Change management of openPMD Series

Further adapt openPMDWriter to openPMD

Add openPMD to CMake

Add openPMD to version formatting

Properly acquaint openPMD plugin with build and help system

Make openPMD namespacing explicit

Remove adios-specific fields from ThreadParams

First successfull run with LaserWakeField example

Cleanup

Use clang-format

Update licensing information

Separate basename and filename extension into two separate help parameters

Refactor dataset creation

Use Mesh::setTimeOffset() template

Causes a linker error with the current version of openPMD API, a fix will be merged soon on the dev branch.

Clean up some leftovers

Use ASCII characters to spell my name

Remove unnecessary whitespaces

Adapt to removal of pmacc::forward

Remove accidentally versioned config file

Make checkpoints usable

Fix a number of bugs concerning the reading of checkpoints
Still problematic is the attribute "timeOffset", currently mitigated by uncommenting the sanity check in the openPMD API. Needs further investigation.

Remove CollectFieldsSizes

Legacy from ADIOS writer, not necessary in openPMD.

Remove ParticleAttributeSize and openPMDCountParticles

Legacy from ADIOS Writer

Use clang-format

Adhere to openPMD requirements before flushing

For a given particle species, the openPMD API requires that required records (such as "position", "positionOffset") and their contained components be defined (not necessarily written). Make sure to define all such datasets before issuing the first flush.

Maybe open an issue in the openPMD API to allow for a more flexible usage.

Fix an indexing bug

Eliminate dataset preparation for NDScalars

Also fix a bug where particles were named wrongly in checkpoints.

Do not write empty particle datasets

Treat non-existing datasets as empty in reading

Remove prepared datasets

Remove WithWindow struct

Use transform to enable ADIOS1 compression

Remove accidentally versioned files

Rename LoadParticleAttributesFromADIOS to LoadParticleAttributesFromOpenPMD

Remove traces of the old ADIOS plugin

mostly the word "adios" from comments

Take copies and not references of openPMD handles

Fix autoformatting

Require newer openPMD API

Also add ADIOS2_ROOT to CMAKE_PREFIX_PATH

Add version label to format string only if present

Replace typedefs with using

Remove further indexing bug

in writing particles_info table

Cleanup restart

Remove dataset preparation

Commit 0b50561 reintroduced a reduced form of dataset preparation in order to adhere to requirements (restrictions) of the openPMD API. This workaround results in dummy dataset writes (likely a bug in the openPMD API), hence this commit reverts those changes.
The corresponding pull request in the openPMD API to relax this restriction can be found at openPMD/openPMD-api#518.

Postpone writing of meta attributes

Due to a bug in the ADIOS1 backend of the openPMD API, the first dataset needs to be written before the first flush. This works around the problem by first defining all the fields and particles.
Bug report will follow.

Resolve counting bug during particle writing

Fix whitespaces

Separate ADIOS and HDF5 particle writing strategies

Allow choosing strategy as runtime parameter

Cleanup

Fix openPMD version formatting

Update examples to use openPMD

Refactor passing of filename and extension

Reassemble filename and extension upon opening the series.

Fix some missing includes

Do not skip writing empty datasets

See openPMD PR: openPMD/openPMD-api#529
This allows to write empty datasets

Remove debugging leftovers

Write timeOffset for particles in a standard-compliant way

Do not declare zero-sized arrays

C++ standard requires that array size evaluate to a value greater than zero.

Do not use storeChunk on empty datasets

centralize initialization of thread params from config

Fix undefined identifier in assert statements

Error passes silently in release builds.

Pass JSON config to openPMD::Series ctor

Do not copy Series object

see openPMD/openPMD-api#534

Allow NULL as configuration infix to denote empty string

Adapt to changes in pmacc etc.

Enable use of group-based layout as well

Requires keeping openPMD Series open. Since openPMD currently has no
explicit call to close a file, we implement this only for group-based
layout for now.

Do not use deprecated Series::setSoftwareVersion call

Apply commit b797c0a to openPMD backend

Formatting in .cfg files

Fix an uninitialized value and an indexing bug

Implement reviewers' comments concerning CMakeLists

Fix some bugs and remove unneeded parameters

Some ADIOS-specific parameters have been remove that haven't been
implemented anyway and are going to be implemented via JSON.

Don't set compression if set to "none".

Also, I missed a small part when porting b797c0a to this plugin.

Add documentation for openPMD plugin [WIP]

Further write documentation

Rename data preparation strategies

adios -> doubleBuffer
hdf5  -> mappedMemory
Old names may still be used alternatively.

Fix indexing bug for non domain-bound fields

Fix indexing order in fields

Implement Reviewer's comments

Remove workaround for ADIOS1 backend

fix attributes

Mesh record component positions and unitSI
Iteration: time
ParticleAttribute unitDimension

Implement reviewer's comments (2)

Update copyright headers of files changed

Add compression to openPMD TBG example

Use openPMD::getVersion

remove unnecessary parentheses
franzpoeschel added a commit to franzpoeschel/picongpu that referenced this issue May 18, 2020
Create openPMDWriter based on ADIOSWriter (WIP)

Adapt CountParticles partially to openPMD

Adapt WriteSpecies to openPMD

Translate WriteMeta.hpp to openPMD

Add function "asStandardVector()"

Translate NDScalars.hpp to openPMD

Adapt everything to openPMD except for the main file (openPMDWriter.hpp)

Adapt openPMDWriter.hpp to openPMD WIP

Change management of openPMD Series

Further adapt openPMDWriter to openPMD

Add openPMD to CMake

Add openPMD to version formatting

Properly acquaint openPMD plugin with build and help system

Make openPMD namespacing explicit

Remove adios-specific fields from ThreadParams

First successfull run with LaserWakeField example

Cleanup

Use clang-format

Update licensing information

Separate basename and filename extension into two separate help parameters

Refactor dataset creation

Use Mesh::setTimeOffset() template

Causes a linker error with the current version of openPMD API, a fix will be merged soon on the dev branch.

Clean up some leftovers

Use ASCII characters to spell my name

Remove unnecessary whitespaces

Adapt to removal of pmacc::forward

Remove accidentally versioned config file

Make checkpoints usable

Fix a number of bugs concerning the reading of checkpoints
Still problematic is the attribute "timeOffset", currently mitigated by uncommenting the sanity check in the openPMD API. Needs further investigation.

Remove CollectFieldsSizes

Legacy from ADIOS writer, not necessary in openPMD.

Remove ParticleAttributeSize and openPMDCountParticles

Legacy from ADIOS Writer

Use clang-format

Adhere to openPMD requirements before flushing

For a given particle species, the openPMD API requires that required records (such as "position", "positionOffset") and their contained components be defined (not necessarily written). Make sure to define all such datasets before issuing the first flush.

Maybe open an issue in the openPMD API to allow for a more flexible usage.

Fix an indexing bug

Eliminate dataset preparation for NDScalars

Also fix a bug where particles were named wrongly in checkpoints.

Do not write empty particle datasets

Treat non-existing datasets as empty in reading

Remove prepared datasets

Remove WithWindow struct

Use transform to enable ADIOS1 compression

Remove accidentally versioned files

Rename LoadParticleAttributesFromADIOS to LoadParticleAttributesFromOpenPMD

Remove traces of the old ADIOS plugin

mostly the word "adios" from comments

Take copies and not references of openPMD handles

Fix autoformatting

Require newer openPMD API

Also add ADIOS2_ROOT to CMAKE_PREFIX_PATH

Add version label to format string only if present

Replace typedefs with using

Remove further indexing bug

in writing particles_info table

Cleanup restart

Remove dataset preparation

Commit 0b50561 reintroduced a reduced form of dataset preparation in order to adhere to requirements (restrictions) of the openPMD API. This workaround results in dummy dataset writes (likely a bug in the openPMD API), hence this commit reverts those changes.
The corresponding pull request in the openPMD API to relax this restriction can be found at openPMD/openPMD-api#518.

Postpone writing of meta attributes

Due to a bug in the ADIOS1 backend of the openPMD API, the first dataset needs to be written before the first flush. This works around the problem by first defining all the fields and particles.
Bug report will follow.

Resolve counting bug during particle writing

Fix whitespaces

Separate ADIOS and HDF5 particle writing strategies

Allow choosing strategy as runtime parameter

Cleanup

Fix openPMD version formatting

Update examples to use openPMD

Refactor passing of filename and extension

Reassemble filename and extension upon opening the series.

Fix some missing includes

Do not skip writing empty datasets

See openPMD PR: openPMD/openPMD-api#529
This allows to write empty datasets

Remove debugging leftovers

Write timeOffset for particles in a standard-compliant way

Do not declare zero-sized arrays

C++ standard requires that array size evaluate to a value greater than zero.

Do not use storeChunk on empty datasets

centralize initialization of thread params from config

Fix undefined identifier in assert statements

Error passes silently in release builds.

Pass JSON config to openPMD::Series ctor

Do not copy Series object

see openPMD/openPMD-api#534

Allow NULL as configuration infix to denote empty string

Adapt to changes in pmacc etc.

Enable use of group-based layout as well

Requires keeping openPMD Series open. Since openPMD currently has no
explicit call to close a file, we implement this only for group-based
layout for now.

Do not use deprecated Series::setSoftwareVersion call

Apply commit b797c0a to openPMD backend

Formatting in .cfg files

Fix an uninitialized value and an indexing bug

Implement reviewers' comments concerning CMakeLists

Fix some bugs and remove unneeded parameters

Some ADIOS-specific parameters have been remove that haven't been
implemented anyway and are going to be implemented via JSON.

Don't set compression if set to "none".

Also, I missed a small part when porting b797c0a to this plugin.

Add documentation for openPMD plugin [WIP]

Further write documentation

Rename data preparation strategies

adios -> doubleBuffer
hdf5  -> mappedMemory
Old names may still be used alternatively.

Fix indexing bug for non domain-bound fields

Fix indexing order in fields

Implement Reviewer's comments

Remove workaround for ADIOS1 backend

fix attributes

Mesh record component positions and unitSI
Iteration: time
ParticleAttribute unitDimension

Implement reviewer's comments (2)

Update copyright headers of files changed

Add compression to openPMD TBG example

Use openPMD::getVersion

remove unnecessary parentheses
@ax3l
Copy link
Member

ax3l commented Apr 21, 2021

Addressed for Series via #886 #936 #955 (user-facing).

Further classes (Iteration, Record, RecordComponent, etc.) are to do.

@eschnett
Copy link
Contributor

This issue (or a closely related one) is causing problems for me trying to wrap openPMD from Julia.

The problem I face is that many of the public openPMD types do not expose a default constructor. This makes it impossible (or at least very difficult, and I don't know how to do this for a Julia interface) to put objects of such types into STL containers. In practice, the STL really expects types to have a default constructor, and to have an "invalid" state if necessary.

Another issue I'm facing is that Julia is garbage collected, and it's thus difficult to ensure that objects are destructed and closed in any particular order. I can call close or flush on some objects, but that doesn't guarantee that other, related objects have been deallocated. Explicitly tracking an "invalid" state (instead of deallocating objects) would greatly help here.

One simple way to make all this happen is to leave the openPMD types as they are, and to essentially use std::shared_ptr<X> as user facing handles. I wouldn't mind if this type was explicitly exposed in the API – people know what shared_ptr is (copying is legal, copying is relatively cheap, no need to explicitly call a destructor, ownership is handled automatically, etc.) Of course, creating new wrapper types (as you suggest above) is also possible, assuming that the ownership/copying/cost are documented so that people know to treat these wrapper objects.

I would then also store these wrapper objects (and not actual objects) into the various std::map objects there are. This way, direct references are completely avoided. (There are also nice tricks via std::enable_shared_from_this that one can play.)

It would be important (at least for Julia wrappers) that the implementation objects are completely hidden, and do not e.g. appear via public inheritance. For example, there is currently a Series class which publicly inherits from SeriesImpl. In this case, both these objects should be wrapper objects. (This might already be true.)

@franzpoeschel
Copy link
Contributor Author

Before answering to your post specifically, be aware that we already redesigned the Series class to address the issues described above and are planning to extend the redesign to our other classes.

This issue (or a closely related one) is causing problems for me trying to wrap openPMD from Julia.

The problem I face is that many of the public openPMD types do not expose a default constructor. This makes it impossible (or at least very difficult, and I don't know how to do this for a Julia interface) to put objects of such types into STL containers. In practice, the STL really expects types to have a default constructor, and to have an "invalid" state if necessary.

We have already moved Series to a design that allows this. Since that change has not produced any issues so far (I think?), we can move on and apply this change to our other classes as well.

Another issue I'm facing is that Julia is garbage collected, and it's thus difficult to ensure that objects are destructed and closed in any particular order. I can call close or flush on some objects, but that doesn't guarantee that other, related objects have been deallocated. Explicitly tracking an "invalid" state (instead of deallocating objects) would greatly help here.

Again, Series now has operator bool() for this. On the other hand, Python is garbage-collected, too, and we do not expose that information there at all. I don't really understand destroying things in a particular order, doesn't garbage collection mean that the order is explicitly not specified?

One simple way to make all this happen is to leave the openPMD types as they are, and to essentially use std::shared_ptr<X> as user facing handles. I wouldn't mind if this type was explicitly exposed in the API – people know what shared_ptr is (copying is legal, copying is relatively cheap, no need to explicitly call a destructor, ownership is handled automatically, etc.) Of course, creating new wrapper types (as you suggest above) is also possible, assuming that the ownership/copying/cost are documented so that people know to treat these wrapper objects.

I would then also store these wrapper objects (and not actual objects) into the various std::map objects there are. This way, direct references are completely avoided.

This is exactly the plan, yes
(There are also nice tricks via std::enable_shared_from_this that one can play.)

It would be important (at least for Julia wrappers) that the implementation objects are completely hidden, and do not e.g. appear via public inheritance. For example, there is currently a Series class which publicly inherits from SeriesImpl. In this case, both these objects should be wrapper objects. (This might already be true.)

SeriesImpl is the class that defines and implements the interface. It must stay public, otherwise Series would have no member functions. Apart from this, Series basically just wraps a shared pointer to a shared resource. So, Series is the wrapper, SeriesImpl is the interface.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants