Skip to content

Commit

Permalink
resize ducc thread pool in comps2vis
Browse files Browse the repository at this point in the history
  • Loading branch information
landmanbester committed Sep 26, 2024
1 parent 1a61ca9 commit df9c779
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 27 deletions.
3 changes: 3 additions & 0 deletions pfb/operators/gridder.py
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,9 @@ def _comps2vis_impl(uvw,
ncorr_out=4,
freq_min=-np.inf,
freq_max=np.inf):
# why is this necessary?
resize_thread_pool(nthreads)

# adjust for chunking
# need a copy here if using multiple row chunks
rbin_idx2 = rbin_idx - rbin_idx.min()
Expand Down
51 changes: 24 additions & 27 deletions pfb/opt/pcg.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,27 +186,25 @@ def M(x): return x
ti = time()
rnorm = np.vdot(r, y)
alpha = rnorm / np.vdot(p, Ap)
# import ipdb; ipdb.set_trace()
# rnorm, alpha = alpha_update(r, y, p, Ap)
tvdot += (time() - ti)
ti = time()
# x = xp + alpha * p
# r = rp + alpha * Ap
# ne.evaluate('xp + alpha*p',
# out=x,
# local_dict={
# 'xp': xp,
# 'alpha': alpha,
# 'p': p},
# casting='unsafe')
# ne.evaluate('rp + alpha*Ap',
# out=r,
# local_dict={
# 'rp': rp,
# 'alpha': alpha,
# 'Ap': Ap},
# casting='unsafe')
x, r = update(x, xp, r, rp, p, Ap, alpha)
ne.evaluate('xp + alpha*p',
out=x,
local_dict={
'xp': xp,
'alpha': alpha,
'p': p},
casting='unsafe')
ne.evaluate('rp + alpha*Ap',
out=r,
local_dict={
'rp': rp,
'alpha': alpha,
'Ap': Ap},
casting='unsafe')
# x, r = update(x, xp, r, rp, p, Ap, alpha)
tupdate += (time() - ti)
y = M(r)

Expand All @@ -220,17 +218,16 @@ def M(x): return x
ti = time()
rnorm_next = np.vdot(r, y)
beta = rnorm_next / rnorm
# ne.evaluate('beta*p-y',
# out=p,
# local_dict={
# 'beta': beta,
# 'p': p,
# 'y': y},
# casting='unsafe')

ne.evaluate('beta*p-y',
out=p,
local_dict={
'beta': beta,
'p': p,
'y': y},
casting='unsafe')
# p = beta * p - y
p *= beta
p -= y
# p *= beta
# p -= y
# rnorm, p = beta_update(r, y, p, rnorm)
tp += (time() - ti)
rnorm = rnorm_next
Expand Down

0 comments on commit df9c779

Please sign in to comment.