Bugfix for regressions when loading sidre files in VisIt#1792
Bugfix for regressions when loading sidre files in VisIt#1792kennyweiss merged 10 commits intodevelopfrom
Conversation
…eViewString()` with allocators
sidre::View's State enum removed the "SCALAR" type in favor of "TUPLE" and VisIt does not yet recognize these files. This commit adds a shim to output SCALAR for TUPLE types.
This will output "SCALAR" instead of "TUPLE" for tuple views in support of downstream readers of sidre files, like VisIt. We expect to phase this option out over time as application adopt the tuple type.
The functionality was moved into the hpp file a long time ago when templates were added to the class, but this file was not deleted.
src/axom/sidre/core/SidreTypes.hpp
Outdated
| inline constexpr int getInvalidAllocatorID() noexcept { return axom::INVALID_ALLOCATOR_ID; } | ||
|
|
||
| /*! | ||
| * \brief Return Axom's malloc allocator id sentinel. |
There was a problem hiding this comment.
IIRC, the way allocator's work in Sidre is that you can attach one to a Group or View in the hierarchy and then it will be used for data allocation in the entire subtree rooted at the group (unless another allocator is attached to Group in the subtree) or View, respectively. Is this sentinel the default allocator if none is associated with a Group or View as I've described?
There was a problem hiding this comment.
The default is INVALID_ALLOCATOR_ID which eventually maps to Umpire's default (when using Umpire) or malloc (when not using Umpire.
See:
axom/src/axom/core/memory_management.hpp
Lines 114 to 127 in 676ca97
and
axom/src/axom/sidre/core/Group.cpp
Lines 2285 to 2311 in 676ca97
rhornung67
left a comment
There was a problem hiding this comment.
One question about concept clarification.
| // data (setScalar()) was serialized as "SCALAR". Some downstream readers | ||
| // (e.g. VisIt's Blueprint database plugin) still expect that string. | ||
| #if defined(AXOM_SIDRE_IO_USE_SCALAR_STATE_STRING) | ||
| if(m_state == TUPLE && isScalar()) return "SCALAR"; |
There was a problem hiding this comment.
If we save a tuple that is actually an array - VisIt's released logic would still likely work if you also use "SCALAR".
TUPLE as array could happen for some Mesh metadata -- not sure the probability of it occurring.
There was a problem hiding this comment.
I think that is true, it wasn't possible before -- but it is possible now -- in the past they would be attached to a buffer, but now they could be tagged TUPLE.
If tagged with SCALAR for the output file -- it may work in VisIt b/c that case we simply set using the inline values.
However the visit logic does not apply a schema, like it would the buffer case.
There was a problem hiding this comment.
I think that before #1510 anything with more than 1 element is an array (unless it's a string), so it's stored in a BUFFER (unless it's external).
|
Also, should the default be ON for the write option? |
I was thinking it would be opt-in. Do you think we should enable it by default now and then disable it later when people are on the new VisIt? Update: I changed it to |
src/cmake/AxomOptions.cmake
Outdated
| # Sidre will serialize these views with state="TUPLE". | ||
| option(AXOM_SIDRE_IO_USE_SCALAR_STATE_STRING | ||
| "Write sidre View scalars with state='SCALAR' (legacy compatibility); default writes state='TUPLE'." | ||
| OFF) |
There was a problem hiding this comment.
I prefer default ON because the need for OFF (that is, using "TUPLE" instead of "SCALAR") is a small new population. The old default should keep working for everyone else, correct? Keeping the old default but letting those who need it set the new behavior is the gentlest way forward. Plus it allows us to test in a somewhat more controlled manner.
Arlie-Capps
left a comment
There was a problem hiding this comment.
@kennyweiss , thank you for this expeditious and thorough PR. Please consider having AXOM_SIDRE_IO_USE_SCALAR_STATE_STRING default to ON: more discussion at AxomOptions.cmake.
Based on reviewer feedback, this seems like the safest strategy until there is better adoption of the TUPLE construct
Summary
This PR contains bugfixes for regressions we noticed when saving visualization files from Sidre following the mesh blueprint convention.
In Deep copy from Sidre to Conduit #1510, Sidre's View class changed its internal state representation for non-array types from "SCALAR" to "TUPLE" and removed an internal
sidre::View::State::SCALARtype.This caused a problem loading these files into VisIt
This PR adds a config variable
AXOM_SIDRE_IO_USE_SCALAR_STATE_STRINGfor backward compatibility until VisIt can load Sidre files with "TUPLE" types. This option isOFFONby default. When enabled, it will use "SCALAR" instead of "TUPLE" for views containing a single item.TUPLEconstruct.The following VisIt PR will add support for "TUPLE": add support to blueprint plugin to read sidre tuple views visit-dav/visit#20811 (thanks @cyrush !)
This PR also updates the Sidre Fortran interface for
sidre::Group::createViewScalar()andsidre::Group::createViewString()to allow users to specify an allocator ID for the view's memory. These overloads were added in the same PR (Deep copy from Sidre to Conduit #1510)