Skip to content

Commit a21c3ac

Browse files
Faster tile shape exploration
1 parent 774b068 commit a21c3ac

1 file changed

Lines changed: 8 additions & 7 deletions

File tree

accelforge/mapper/FFM/_make_pmappings/make_pmappings_from_templates/make_tile_shapes.py

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -906,8 +906,9 @@ def get_padded_choices(
906906
if subs in choices_padded:
907907
choices_padded[s] = choices_padded[subs]
908908
else:
909-
choices_padded[s] = ones * subs
910-
909+
choices_padded[s] = np.full(
910+
choices_enumerated.shape[0], subs, dtype=choices_enumerated.dtype
911+
)
911912
for k, v in choices_padded.items():
912913
assert isinstance(v, np.ndarray), f"{k} is not a numeric array: {v}"
913914

@@ -1781,10 +1782,10 @@ def update_symbol2goal(
17811782
# Haven't done any pruning, so valid is the # of total choices
17821783
valid = [choices_enumerated.shape[0]]
17831784

1784-
porp = sum(valid) / max(1, choices_enumerated.shape[0])
1785+
porp = int(np.sum(valid)) / max(1, choices_enumerated.shape[0])
17851786
job.log_porp_pmappings_kept(
17861787
f"{objective.name}",
1787-
sum(valid) / max(1, prev_size),
1788+
int(np.sum(valid)) / max(1, prev_size),
17881789
)
17891790
DEBUG and log_message(
17901791
f"Valid check", f"{objective.name}", f"porp={porp:.2%}"
@@ -1832,10 +1833,10 @@ def update_symbol2goal(
18321833
# Everyone valid (for counting purposes)
18331834
valid = [choices_enumerated.shape[0]]
18341835

1835-
porp = sum(valid) / max(1, choices_enumerated.shape[0])
1836+
porp = int(np.sum(valid)) / max(1, choices_enumerated.shape[0])
18361837
job.log_porp_pmappings_kept(
18371838
f"{objective.name}",
1838-
sum(valid) / max(1, prev_size),
1839+
int(np.sum(valid)) / max(1, prev_size),
18391840
)
18401841
DEBUG and log_message(
18411842
f"Valid check", f"{objective.name}", f"porp={porp:.2%}"
@@ -1980,7 +1981,7 @@ def update_symbol2goal(
19801981
prev_size = choices_enumerated.shape[0]
19811982
choices_enumerated = choices_enumerated[keep]
19821983
job.log_porp_pmappings_kept(
1983-
f"Pareto", sum(keep) / choices_enumerated.shape[0]
1984+
f"Pareto", int(np.sum(keep)) / choices_enumerated.shape[0]
19841985
)
19851986
DEBUG and log_message(
19861987
"pareto", f"size {prev_size} -> {choices_enumerated.shape[0]}"

0 commit comments

Comments
 (0)