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

Faster czt #43

Closed
wants to merge 4 commits into from
Closed

Faster czt #43

wants to merge 4 commits into from

Conversation

RainerHeintzmann
Copy link
Member

to speed up the czt performance. Also added support for arbitrary transform-dims.

Copy link

codecov bot commented Jun 20, 2024

Codecov Report

Attention: Patch coverage is 95.83333% with 1 line in your changes missing coverage. Please review.

Project coverage is 92.93%. Comparing base (4dcec51) to head (7435066).
Report is 1 commits behind head on main.

Files Patch % Lines
src/czt.jl 95.83% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main      #43    /-   ##
=======================================
  Coverage   92.92%   92.93%           
=======================================
  Files          18       18           
  Lines        1018     1019     1     
=======================================
  Hits          946      947     1     
  Misses         72       72           

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

@@ -267,30 269,38 @@ function czt_1d(xin, plan::CZTPlan_1D)
# which (intentionally) leads to non-real results for even-sized arrays at non-unit zoom

L = size(plan.fft_fv, plan.d)
nsz = ntuple((dd) -> (dd==plan.d) ? L : size(xin, dd), Val(ndims(xin)))
nsz = ntuple((dd) -> (dd==plan.d) ? L : size(xin, dd), Val(D)) # sizes may vary per dimension, so a new array has to be generated
# append zeros
y = zeros(eltype(plan.aw), nsz)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you want this CUDA runable, do

y = similar(xin, eltype(plan.aw), nsz)
fill!(y, 0)

In my code, I try to avoid zeros or ones.

# corner = ntuple((x)->1, Val(ndims(xin)))
# select_region(xin .* plan.aw, new_size=nsz, center=corner, dst_center=corner)

# g = ifft(fft(y, d) .* plan.fft_fv, d)
g = plan.ifftw_plan * (plan.fftw_plan * y .* plan.fft_fv)
plan.fftw_plan! * y # in-place application to y
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in general avoid comments behind lines, do better above.

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.

2 participants