Skip to content

Python simple cuda #685

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

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

MaximEremenko
Copy link

This pull request introduces a simplified Python interface for Type 3 NUFFTs (nonuniform-to-nonuniform) in 1D, 2D, and 3D within the cufinufft library. The new functions—nufft1d3, nufft2d3, and nufft3d3—allow users to perform Type 3 transforms with minimal setup, similar to the existing Type 1 and Type 2 interfaces.
Changes

  • Added nufft1d3, nufft2d3, and nufft3d3 to cufinufft/_simple.py, providing user-friendly access to Type 3 NUFFTs.
  • Updated cufinufft/init.py to include the new functions in the module’s public API.
  • Modified _invoke_plan to correctly handle Type 3 parameters (s, t, u) and plan creation for Type 3 transforms.

With this update, all NUFFT types (1, 2, and 3) now offer a consistent and simplified Python interface.

@DiamonDinoia DiamonDinoia requested a review from janden May 24, 2025 20:16
@DiamonDinoia
Copy link
Collaborator

This looks great.

I would ask @janden to review.

My suggestion it to extend https://github.com/flatironinstitute/finufft/blob/master/python/cufinufft/tests/test_simple.py with type3

@DiamonDinoia
Copy link
Collaborator

Hi @MaximEremenko,

I noticed the tests failing do you need help with it?

@MaximEremenko
Copy link
Author

MaximEremenko commented May 28, 2025

Hi @DiamonDinoia ,
I have version that can pass tests. Problem is here:
in function: verify_type3

ind = (int(0.1789 * n_target_pts),) and assert type3_rel_err < 100 * tol

Original CPU code looks a little different.

I made verify_type3 to ind = tuple(n-1 for n in n_tr + (int(0.1789 *n_pts),)) and it works but it looks like GPU version gives bigger error compare to CPU and general test case tuple(np.random.randint(0, n) for n in n_tr + (n_pts,)) does not work correctly.

@ahbarnett
Copy link
Collaborator

ahbarnett commented May 28, 2025 via email

@DiamonDinoia
Copy link
Collaborator

Hi @MaximEremenko,

Yes, let's leave something sensible that passes here.
@janden might want to change the tests to align to C++/matlab in a different PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants