Skip to content

Commit

Permalink
uniform removal of sink sites
Browse files Browse the repository at this point in the history
  • Loading branch information
lehner committed Jan 2, 2025
1 parent 9b051ba commit daf7397
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 10 deletions.
22 changes: 12 additions & 10 deletions lib/gpt/qcd/sparse_propagator.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,13 +92,8 @@ def __init__(self, array, cache_size, cache_line_size):
self.cache_hits = 0
self.cache_misses = 0

self.sink_domain_update()

def sink_domain_update(self):
def sink_domain_update(self, min_source_sampled_sites):
self.cache = []
min_source_sampled_sites = min(
[flav.source_domain.sampled_sites for fac, flav in self.array]
)
self.coordinates = self.sink_domain.coordinates
self.ec = self.sink_domain.sdomain.unique_embedded_coordinates(
self.coordinates[0:min_source_sampled_sites]
Expand Down Expand Up @@ -296,14 +291,21 @@ def flavor(roots, *cache_param):

ret.append(prp)

# make common sink domain
# select common sink domain
common_sink_domain = ret[0].sink_domain
for flav in ret[1:]:
common_sink_domain.restrict(flav.sink_domain)
max_ec_size = max(
[
min([flav.source_domain.sampled_sites for fac, flav in flav_mult.array])
for flav_mult in ret
]
)

# prepare common sink domain
for flav in ret:
if flav.sink_domain is not common_sink_domain:
flav.sink_domain = common_sink_domain
flav.sink_domain_update()
flav.sink_domain = common_sink_domain
flav.sink_domain_update(max_ec_size)

if len(ret) == 1:
ret = ret[0]
Expand Down
3 changes: 3 additions & 0 deletions tests/qcd/sparse_propagator.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,9 @@
quark_l.sink_domain.sdomain.kernel.local_coordinates,
)

assert len(quark_s.coordinates) == len(quark_l.coordinates)
assert len(quark_s.ec) == len(quark_l.ec)

for i in range(quark_sml.source_domain.sampled_sites):
qs_i = quark_s[i]
ql_i = quark_l[i]
Expand Down

0 comments on commit daf7397

Please sign in to comment.