Repository navigation
VTK algorithms: Statistics, Entropy and Integrate; the dataset cache's observers kept reachable - #301
Merged
Conversation
…ped at the next use The cache of Tack datasets per VTK dataset drops an entry from a DeleteEvent observer, a function only the VTK object referred to. When Python's collector freed such a dataset in a reference cycle made after it was read (a failing test's traceback holding its frames), it took the observer for garbage too and cleared its globals and closure first; the deletion then called it, and Python segfaulted (_PyEval_EvalFrameDefault from vtkPythonCommand::Execute, from vtkObject::ObjectFinalize, from the collector). VTK 9.7.1 and master both; a VTK-only reproduction is VTK bugs 19 in the vault. The observers are now kept in a module-level dict until they fire, and do no more than note the address; the cache drops the entry, and the observer, at its next use, outside whatever freed the dataset. The regression test makes the cycle after the dataset was read, as the crash needs; it segfaulted before.
… the input The summaries reduce everything they are given -- every dataset of a partitioned dataset or a tree, on every MPI rank (the run's world) -- to one answer, as VTK's vtkDescriptiveStatistics and vtkIntegrateAttributes reduce composite data; every rank gets it. - Statistics: a vtkTable, a row per field and a vector field's components one by one (ExtractComponent), columns field, where, component, td.statistics' values under Tack's names, and the unit. - Entropy: the same rows, with the entropy in bits over `bins` bins. - Integrate: vtkIntegrateAttributes' output, one vertex at the measure-weighted centroid (the integral of position over the measure), each point field's integral as point data and each cell field's as cell data, the measure as Length, Area or Volume by the cells' dimension. - Fields: `fields`, SetInputArrayToProcess, or every field. Held to td.statistics and td.entropy called directly, Integrate to vtkIntegrateAttributes (centroid, volume, a point and a vector cell field), pieces and trees to the whole (each shared point counted once where GhostCells or GenerateGlobalIds mark its owner), a surface's measure to its area, and 3 MPI ranks to the whole.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stacked on #295 (its commits show here until it merges; this merges after it). The fifth step of the VTK algorithms plan, and a crash fix in the dataset cache from #290.
Statistics,Entropy,Integrate. They reduce all their input -- every dataset of a partitioned dataset or a tree, on every MPI rank -- to one answer, as VTK'svtkDescriptiveStatisticsandvtkIntegrateAttributesdo; every rank gets it.StatisticsandEntropy: avtkTable, a row per field and a vector field's components one by one;td.statistics' values under Tack's names (kurtosisis not the excess).Integrate:vtkIntegrateAttributes' output, one vertex at the centroid, each field's integral on it, the measure asLength,AreaorVolume. On VTK's wavelet: VTK's volume and centroid, the integral within 3e-9.fields,SetInputArrayToProcess, or every field. A point pieces share counts once whereGhostCellsorGenerateGlobalIdsmarks its owner (the guide says so).Fixed: a segfault in Python's collector (separate commit). The cache of Tack datasets per VTK dataset dropped an entry from a
DeleteEventobserver that only the VTK object referred to. When the collector freed such a dataset in a reference cycle (a failing test's traceback; an exception in a script), it cleared the observer as garbage first, then the deletion called it:_PyEval_EvalFrameDefaultfromvtkPythonCommand::Executefrom the collector. A VTK bug, VTK-only reproduction on 9.7.1 and master (the vault's VTK bugs 19). The observers are kept reachable until they fire and only note the deletion; the cache drops the entry at its next use. The regression test segfaulted before.Tested: the summaries against
td.statistics/td.entropyandvtkIntegrateAttributes, pieces and trees against the whole, a surface's area, and 3 MPI ranks against the whole. VTK tests 200 passed on the 9.7.1 wheel and 216 on a local VTK master; quick tier 3080 passed; lint, docs build andvalidate.py --vtkclean.🤖 Generated with Claude Code