Skip to content

Bump finufft to 2.5.0#1374

Open
garrettwrong wants to merge 3 commits intodevelopfrom
fi25
Open

Bump finufft to 2.5.0#1374
garrettwrong wants to merge 3 commits intodevelopfrom
fi25

Conversation

@garrettwrong
Copy link
Copy Markdown
Collaborator

Running our latest code with finufft==2.5.0 through our CI; disregard the "Ready for Review". Still testing to do locally and some basic comparisons etc.

@garrettwrong garrettwrong self-assigned this Mar 27, 2026
@garrettwrong garrettwrong requested a review from janden as a code owner March 27, 2026 19:31
@garrettwrong garrettwrong added enhancement New feature or request CI Continuous Integration extern Relating to external changes dependencies Pull requests that update a dependency file labels Mar 27, 2026
@codecov
Copy link
Copy Markdown

codecov bot commented Mar 27, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.20%. Comparing base (09e8301) to head (3223d4c).

Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #1374      +/-   ##
===========================================
- Coverage    90.21%   90.20%   -0.01%     
===========================================
  Files          135      135              
  Lines        14658    14658              
===========================================
- Hits         13223    13222       -1     
- Misses        1435     1436       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@garrettwrong
Copy link
Copy Markdown
Collaborator Author

Still need to use 2.3.0 for darwin (probably fine, until we start hitting any significant API/accuracy changes....).

Ribosome recon is running (gpu) to see if we have any unexpected changes there. If not we can probably merge this guy.

@garrettwrong
Copy link
Copy Markdown
Collaborator Author

Some interesting initial results. The ribo recon using cufinufft 2.5.0 seems to have improved (6.2A, a 1-2A improvement). However, it took much longer (20 hours instead of 8-10). I'm not sure if it is because the GPU was running something else or the package itself. Running it again on an empty GPU.

I'll also launch another run with the only difference being cufinufft at 2.4.0; a few other things changed recently.

@garrettwrong
Copy link
Copy Markdown
Collaborator Author

After more careful timing and scoring, things are not as bad as I thought initially, but they are still different... 9.5 hour vs 8 hour. Visually recons are similar, can't say one is characteristically better than other IMO. My remark above about 6A was incorrect, I had used the wrong cutoff (0.143).

Using the latest code (3223d4c)... just manually installing 2.4.0 in the one case. (both on 13x, etc all else same).

cufinufft 2.5.0 took 9:24:23.30 to yield an FSC (0.5cutoff) of 9.56

cufinufft 2.4.0 took 7:56:09.41 to yield an FSC (0.5cutoff) of 9.85

@garrettwrong
Copy link
Copy Markdown
Collaborator Author

Confirmed change is from cufinufft 2.5.0 (tried 2.4.0 and 2.4.1). I'll post something similar to the FI repo. It is significant on the A100 we use.

(fi25) ➜  experiments git:(fi25) ✗ python time_nufft.py
epsilon: 1.1920928955078125e-07
Plan setup 0.051321435952559114.
setpts (2, 16020): 0.0004255539970472455
1000 repeats cufinufft transform calls, stack len 1, size (179, 179): 0.8731139439623803
(fi25) ➜  experiments git:(fi25) ✗ pip install "cufinufft==2.4.0"
Collecting cufinufft==2.4.0
  Using cached cufinufft-2.4.0-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (2.0 kB)
Requirement already satisfied: numpy in /scratch/gbwright/miniconda3/envs/fi25/lib/python3.12/site-packages (from cufinufft==2.4.0) (2.4.3)
Requirement already satisfied: packaging in /scratch/gbwright/miniconda3/envs/fi25/lib/python3.12/site-packages (from cufinufft==2.4.0) (26.0)
Using cached cufinufft-2.4.0-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (53.4 MB)
Installing collected packages: cufinufft
  Attempting uninstall: cufinufft
    Found existing installation: cufinufft 2.5.0
    Uninstalling cufinufft-2.5.0:
      Successfully uninstalled cufinufft-2.5.0
Successfully installed cufinufft-2.4.0
(fi25) ➜  experiments git:(fi25) ✗ python time_nufft.py          
epsilon: 1.1920928955078125e-07
Plan setup 0.036377289914526045.
setpts (2, 16020): 0.00041027506813406944
1000 repeats cufinufft transform calls, stack len 1, size (179, 179): 0.024845666950568557
(fi25) ➜  experiments git:(fi25) ✗
from time import perf_counter
import numpy as np
import cupy as cp
from cufinufft import Plan

n = 1000 # timing repeats
x = np.load('x.npy')
freqs = np.load('freqs.npy')


# # Sanity check ASPIRE wrapper, which is slower when includes copies etc etc
# from aspire.nufft import nufft
# t0 = perf_counter()
# for _ in range(n):
#     y = nufft(x, freqs)
# t1 = perf_counter()
# print("nufft calls:", t1-t0)


dt = np.float32
cdt = np.complex64
assert dt == x.dtype, "confirm dtypes"
eps = max(1e-8, np.finfo(dt).eps)  # epsilon logic from ASPIRE
print(f"epsilon: {eps}")

sz = (x.shape[-1],) * freqs.shape[0]
# host to device
cp_freqs = cp.mod(cp.array(freqs) + cp.pi, 2 * cp.pi) - cp.pi        
cp_x = cp.array(x, dtype=cdt)

t0 = perf_counter()
plan = Plan(2, sz, len(cp_x), eps, -1, dtype=cdt)
t1 = perf_counter()
plan.setpts(*cp_freqs)
t2 = perf_counter()
print(f"Plan setup {t1-t0}.\nsetpts {freqs.shape}: {t2-t1}")

t0 = perf_counter()
for _ in range(n):
    y = plan.execute(cp_x) # transform
t1 = perf_counter()
print(f"{n} repeats cufinufft transform calls, stack len {len(x)}, size {sz}:", t1-t0)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CI Continuous Integration dependencies Pull requests that update a dependency file enhancement New feature or request extern Relating to external changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant