Skip to content

Commit

Permalink
Optimise beam cube (#320)
Browse files Browse the repository at this point in the history
  • Loading branch information
sjperkins authored Oct 31, 2024
1 parent 4cf591c commit c9d0c93
Show file tree
Hide file tree
Showing 3 changed files with 219 additions and 164 deletions.
1 change: 1 addition & 0 deletions HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ History

0.3.8 (2024-09-29)
------------------
* Optimise the beam cube implementation (:pr:`320`)
* Support an `init_state` argument into both `Term.init_fields`
and `Transformer.init_fields` (:pr:`319`)
* Use virtualenv to setup github CI test environments (:pr:`321`)
Expand Down
13 changes: 6 additions & 7 deletions africanus/experimental/rime/fused/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def rime_impl(*args):
def nb_rime(*args):
if not len(args) > 0:
raise TypeError(
"rime must be at least be called " "with the signature argument"
"rime must be at least be called with the signature argument"
)

if not isinstance(args[0], types.Literal):
Expand Down Expand Up @@ -103,13 +103,13 @@ def impl(*args):
for ch in range(nchan):
X = term_sampler(state, s, r, t, f1, f2, a1, a2, ch)

for c, value in enumerate(numba.literal_unroll(X)):
for co, value in enumerate(numba.literal_unroll(X)):
# Kahan summation
y = value - compensation[r, ch, c]
current = vis[r, ch, c]
y = value - compensation[r, ch, co]
current = vis[r, ch, co]
x = current + y
compensation[r, ch, c] = (x - current) - y
vis[r, ch, c] = x
compensation[r, ch, co] = (x - current) - y
vis[r, ch, co] = x

return vis

Expand Down Expand Up @@ -204,7 +204,6 @@ def dask_blockwise_args(self, **kwargs):

def __call__(self, time, antenna1, antenna2, feed1, feed2, **kwargs):
keys = self.REQUIRED_ARGS_LITERAL + tuple(map(types.literal, kwargs.keys()))

args = keys + (time, antenna1, antenna2, feed1, feed2) + tuple(kwargs.values())
return self.impl(types.literal(self.rime_spec.spec_hash), *args)

Expand Down
Loading

0 comments on commit c9d0c93

Please sign in to comment.