A qusetion about the FiNUFFT “guru” interface of the function "finufft1d1" #753
Replies: 2 comments
-
|
Dear Letian, I'm not sure what you mean by " this assertion remains uncertain" :) I remember sending you the above code on 4/29/24. If you're looking for how to do this with guru, and what is the associated speedup, here you go. % MCE for zengletian, on repeated 1d NUFFTs with new NU pts.
% Apparently a SAR application.
% Note you needed data_in for it to run. I tidied it up.
% Barnett 10/31/25
clear
maxNumCompThreads(1); % better since transforms so small
% note it's neater to have a single variable control sizes...
N = 6144; % num modes
M = N; % num 1D k-space points, weirdly same as modes (ie, square xform)
nx = 1200; % number of 1D transforms
tol = 1e-12;
kr = ([-M/2:M/2-1].'/M * 1.2 + 33.33) *(4.0 * pi); % 6144x1 column vect
kx = (33.33 + [-nx/2:nx/2-1]./nx * 4.0) *(2.0 * pi); % 1x1200 row vector
data_in = rand(M,nx) + 1i*rand(M,nx); % stack of complex data at k pts
c = zeros(N,nx,'like',data_in); % allocate for complex output
% 1) naive repeated FINUFFT calls... slow
tic
for k = 1:nx
x = (sqrt(kr.^2 - kx(k)^2) - 362.27)/(15.98)*pi; % N 1D k-space pts
c(:,k) = finufft1d1(x, data_in(:,k),-1, tol, N);
end
toc % 0.60 sec
% 2) Guru interface...
tic
ntrans = 1; % since you only do one transform for each set of x pts
opts = struct(); % opts.nthreads=1; opts.debug=2;
p = finufft_plan(1,N,-1,ntrans,tol,opts);
for k = 1:nx
x = (sqrt(kr.^2 - kx(k)^2) - 362.27)/(15.98)*pi; % N 1D k-space pts
p.setpts(x);
c(:,k) = p.execute(data_in(:,k));
end
p.delete;
toc % 0.28 sec: 2x speedupI hope you can learn from this example. Then you could also parallelize over It would be pretty easy to try the first one out in matlab. Let me know how it goes, Alex |
Beta Was this translation helpful? Give feedback.
-
|
Dear Alex, |
Beta Was this translation helpful? Give feedback.

Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Dear developers:
For the function “finufft1d1(x, c,+1,1e-12,1024)”, suppose the input parameter “c” be a double-precision matrix with 6144 rows and 1200 columns. Suppose the input parameter “x” be a column vector with 6144 rows and 1 column that represents the source non-uniform points but varies for each column of “c”. Does the FiNUFFT “guru” interface “finufft_plan” work for this situation?
I will provide a MCE (minimally complete example code) as follows written by MATLAB code:
kr = ([-3072 : 3071].'/6144 * 1.2 + 33.33) *(4.0 * pi); // 6144×1 column vector
kx = (33.33 + [-600: 599]./1200 * 4.0) *(2.0 * pi); // 1×1200 row vector
c = zeros(6144,1200);
for k = 1 : 1200
c(:,k) = finufft1d1((sqrt(kr.^2 - kx(k).^2) - 362.27)/(15.98)*pi, data_in(:,k),-1,1e-12,6144);
end
Note that data_in is a 6144×1200 matrix of double-precision type (such as SAR data). In the above code, the term “sqrt(kr.^2 - kx(k).^2) - 362.27)/(15.98)*pi” varies with “k”. That is, the source non-uniform points are different each transfer, so the FiNUFFT “vectorized” interface does not work.
We refrence to the finufft-readthedocs-io-en-latest on the website https://finufft.readthedocs.io/en/latest/matlab.html , the screenshot of which are as follows:

As demonstrated in the screenshot, the FiNUFFT "guru" interface is capable of handling the situations previously mentioned. However, the validity of this assertion remains uncertain.
Thanks very much!
Beta Was this translation helpful? Give feedback.
All reactions