Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PoC commit for adding a prange to the fused rime, thus enabling nested parallelism #267

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Changes from all commits
Commits
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
8 changes: 5 additions & 3 deletions africanus/experimental/rime/fused/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from collections import defaultdict

import numba
from numba import generated_jit, types
from numba import generated_jit, types, set_num_threads, prange
import numpy as np

from africanus.util.patterns import Multiton
Expand All @@ -29,7 +29,7 @@


def rime_impl_factory(terms, transformers, ncorr):
@generated_jit(nopython=True, nogil=True, cache=True)
@generated_jit(nopython=True, nogil=True, cache=True, parallel=True)
def rime(names, *inargs):
if len(inargs) != 1 or not isinstance(inargs[0], types.BaseTuple):
raise TypeError(f"{inargs[0]} must be be a Tuple")
Expand Down Expand Up @@ -70,6 +70,8 @@ def impl(names, *inargs):
args = pack_transformed(args_opt_idx)
state = term_state(args)

set_num_threads(2)

nsrc, _ = args[lm_i].shape
nrow, _ = args[uvw_i].shape
nchan, = args[chan_freq_i].shape
Expand All @@ -79,7 +81,7 @@ def impl(names, *inargs):
compensation = np.zeros_like(vis)

for s in range(nsrc):
for r in range(nrow):
for r in prange(nrow):
t = state.time_index[r]
a1 = state.antenna1[r]
a2 = state.antenna2[r]
Expand Down