Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
12a8e53
Switch compute from recursive to looped
f0uriest Feb 2, 2025
0732219
Merge branch 'master' into rc/compute_tiers
dpanici Mar 26, 2025
75a72cf
Merge branch 'master' into rc/compute_tiers
dpanici Apr 9, 2026
e0fff1d
Merge branch 'master' into rc/compute_tiers
YigitElma Apr 17, 2026
6a66f85
use topological order computed in build_data_index instead of tiers
YigitElma Apr 17, 2026
a75ec0c
fix _compute, remove set_tiers
YigitElma Apr 17, 2026
e5916d2
move topo_order to data_index
YigitElma Apr 17, 2026
ab47753
remove recursion in _get_deps, remove redundant deps, fix data issue …
YigitElma Apr 19, 2026
1a959bc
remove _get_deps_1_key and other redundant functions, data_index will…
YigitElma Apr 19, 2026
abff730
minor comments
YigitElma Apr 19, 2026
377a30e
skip extra get_data_deps calls, remove redundant functions
YigitElma Apr 19, 2026
662b157
Merge branch 'master' into rc/compute_tiers
YigitElma Apr 19, 2026
293bcba
Merge branch 'master' into rc/compute_tiers
YigitElma Apr 19, 2026
1a49974
Merge branch 'master' into rc/compute_tiers
YigitElma Apr 30, 2026
54efa1b
Merge branch 'master' into rc/compute_tiers
YigitElma May 2, 2026
5b4ee74
Merge branch 'master' into rc/compute_tiers
YigitElma May 4, 2026
be2728b
try more interesting objective
YigitElma May 14, 2026
2151b83
try to fix the test
YigitElma May 28, 2026
e3473a6
Merge branch 'master' into rc/compute_tiers
YigitElma May 28, 2026
329032f
Merge branch 'master' into rc/compute_tiers
YigitElma Jun 10, 2026
0fb61d9
Merge branch 'master' into rc/compute_tiers
daniel-dudt Jun 25, 2026
e104579
Merge branch 'master' into rc/compute_tiers
YigitElma Jul 1, 2026
3a6e8c7
Merge branch 'master' into rc/compute_tiers
YigitElma Jul 13, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 2 additions & 28 deletions desc/compute/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
_stability,
_surface,
)
from .data_index import all_kwargs, allowed_kwargs, data_index
from .data_index import _topological_order, all_kwargs, allowed_kwargs, data_index
Comment thread
ddudt marked this conversation as resolved.
from .utils import (
compute,
get_data_deps,
Expand Down Expand Up @@ -143,6 +143,7 @@ def _collect_deps(p, all_deps):
# The deps are stored in topological order (not alphabetical) so that
# iterating over them computes quantities in valid dependency order.
topo_index = {key: i for i, key in enumerate(order)}
_topological_order[p] = topo_index
for key in order:
d = data_index[p][key]
deps_info = d["dependencies"]
Expand Down Expand Up @@ -211,30 +212,3 @@ def _collect_deps(p, all_deps):


_build_data_index()


def set_tier(name, p):
"""Determine how deep in the dependency tree a given name is.

tier of 0 means no dependencies on other data,
tier of 1 means it depends on only tier 0 stuff,
tier of 2 means it depends on tier 0 and tier 1, etc etc.

Designed such that if you compute things in the order determined by tiers,
all dependencies will always be computed in the correct order.
"""
if "tier" in data_index[p][name]:
return
if len(data_index[p][name]["full_with_axis_dependencies"]["data"]) == 0:
data_index[p][name]["tier"] = 0
else:
thistier = 0
for name1 in data_index[p][name]["full_with_axis_dependencies"]["data"]:
set_tier(name1, p)
thistier = max(thistier, data_index[p][name1]["tier"])
data_index[p][name]["tier"] = thistier + 1


for par in data_index.keys():
for name in data_index[par]:
set_tier(name, par)
1 change: 1 addition & 0 deletions desc/compute/data_index.py
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,7 @@ def _decorator(func):
],
"desc.magnetic_fields._core.OmnigenousField": [],
}
_topological_order = {}
data_index = {p: {} for p in _class_inheritance.keys()}
all_kwargs = {p: {} for p in _class_inheritance.keys()}
allowed_kwargs = {"basis"}
Expand Down
Loading
Loading