Push Events

Projects RADIUSS Home

cnpetra pushed to LLNL/hiop

finished renaming to VectorSpace

View Commit

cyrush pushed to LLNL/conduit

changelog

View Commit

tgamblin pushed to spack/spack

Spec: use short-circuiting, stable comparison

Background

Spec comparison on develop used a somewhat questionable optimization to get decent spec comparison performance – instead of comparing entire spec DAGs, it put a hash() call in _cmp_iter() and compared specs by their runtime hashes. This gets us good performance abstract specs, which don’t have complex dependencies and for which hashing is cheap. But it makes the order of specs unstable and hard to reproduce.

We really need to do a full, consistent traversal over specs to compare and to get a stable ordering. Simply taking the hash out and yielding dependencies recursively (i.e. yielding dep.spec._cmp_iter() instead of a hash) goes exponential for concrete specs because it explores all paths. Traversal tracks visited nodes, but it’s expensive to set up the data structures for that, and it can slow down comparison of simple abstract specs. Abstract spec comparison performance is important for concretization (specifically setup), so we don’t want to do that.

New comparison algorithm

We can have (mostly) the best of both worlds – it’s just a bit more complicated.

This changes Spec comparison to do a proper, stable graph comparison:

  1. Spec comparison will now short-circuit whenever possible for concrete specs, when DAG hashes are known to be equal or not equal. This means that concrete spec == and != comparisons will no longer have to traverse the whole DAG.

  2. Spec comparison now traverses the graph consistently, comparing nodes and edges in breadth-first order. This means Spec sort order is stable, and it won’t vary arbitrarily from run to run.

  3. Traversal can be expensive, so we avoid it for simple specs. Specifically, if a spec has no dependencies, or if its dependencies have no dependencies, we avoid calling traverse_edges() by doing some special casing.

The _cmp_iter method for Spec now iterates over the DAG and yields nodes in BFS order. While it does that, it generates consistent ids for each node, based on traversal order. It then outputs edges in terms of these ids, along with their depflags and virtuals, so that all parts of the Spec DAG are included. The resulting total ordering of specs keys on node attributes first, then dependency nodes, then any edge differences between graphs.

Optimized cases skip the id generation and traversal, since we know the order and therefore the ids in advance.

Performance ramifications

Abstract specs

This seems to add around 7-8% overhead to concretization setup time. It’s worth the cost, because this enables concretization caching (as input to concretization was previously not stable) and setup will eventually be parallelized, at which point it will no longer be a bottleneck for solving. Together those two optimizations will cut well over 50% of the time (likely closer to 90+%) off of most solves.

Concrete specs

Comparison for concrete specs is faster than before, sometimes way faster because comparison is now guaranteed to be linear time w.r.t. DAG size. Times for comparing concrete Specs:

def compare(json):
    a = spack.spec.Spec(json)
    b = spack.spec.Spec(json)
    print(a == b)
    print(timeit.timeit(lambda: a == b, number=1))

compare("./py-black.json")
compare("./hdf5.json")
  • develop (uses our prior hash optimization):
    • py-black: 7.013e-05s
    • py-hdf5: 6.445e-05s
  • develop with full traversal and no hash:
    • py-black: 3.955s
    • py-hdf5: 0.0122s
  • This branch (full traversal, stable, short-circuiting, no hash)
    • py-black: 2.208e-06s
    • py-hdf5: 3.416e-06s

Signed-off-by: Todd Gamblin tgamblin@llnl.gov</small>

View Commit

tzanio pushed to mfem/mfem

Construct Schur complement in HybridizationExtension

View Commit

cyrush pushed to Alpine-DAV/ascent

ba: add cmake_hip_compiler

View Commit

brugger1 pushed to visit-dav/visit

Update the last test suite pass on poodle.

View Commit

rzhangbq pushed to mfem/mfem

correct default gf input

View Commit

homeomorfismo pushed to mfem/mfem

Header renaming

View Commit

victorapm pushed to hypre-space/hypre

Merge branch ‘sycl-warning’ into geos-next

View Commit

mplegendre pushed to hpc/Spindle

Merge pull request #69 from mplegendre/bugfix/procmaps_reading

Hide spindle paths found in /proc/pid/maps</small>

View Commit

adayton1 pushed to LLNL/CARE

Use SFINAE

View Commit

JustinPrivitera pushed to LLNL/conduit

mpi mesh examples module

View Commit

BradWhitlock pushed to LLNL/axom

Updated data directory version.

View Commit

artv3 pushed to LLNL/RAJA

build fixes

View Commit

nicolemarsaglia pushed to Alpine-DAV/ascent

Merge branch ‘task/2025_03_warpx_unit_test’ of https://github.com/Alpine-DAV/ascent into task/2025_03_warpx_unit_test

View Commit

emily-howell pushed to Alpine-DAV/ascent

Only run if ascent was built with rendering support

View Commit

adrienbernede pushed to LLNL/Umpire

Finish enforcing rocm suite

View Commit

adrienbernede pushed to LLNL/CHAI

Update comment

View Commit

tzanio pushed to GLVis/glvis

Merge pull request #327 from GLVis/2d3v-vis

Visualization of 2D grid functions with 3 vector dimensions</small>

View Commit

adrienbernede pushed to LLNL/CARE

Update uberenv config

View Commit

davidbeckingsale pushed to LLNL/Umpire

Add deviceconst test on Tioga

View Commit

github-actions[bot] pushed to LLNL/Umpire

Apply style updates

View Commit

mergify[bot] pushed to flux-framework/flux-sched

Merge pull request #1333 from jameshcorbett/find-by-name

evaluators: find by name and by property</small>

View Commit

lindstro pushed to LLNL/zfp

Merge pull request #264 from vicentebolea/extend-windows-builds

ci,windows: enable more opts</small>

View Commit

daboehme pushed to LLNL/Caliper

Keep input type when computing averages (#643)

View Commit

najlkin pushed to GLVis/glvis

Updated CHANGELOG.

View Commit

white238 pushed to LLNL/blt

Merge pull request #717 from LLNL/main

v0.7.0 Mergeback to develop</small>

View Commit

Jay-A pushed to GEOS-DEV/LvArray

updated src files to match develop and fixed incorrect LLNL TPL_DIR path

View Commit