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

Bug in plan_r2r! leads to false results for multiple threads #297

Open
annuges opened this issue Feb 29, 2024 · 0 comments · May be fixed by #298
Open

Bug in plan_r2r! leads to false results for multiple threads #297

annuges opened this issue Feb 29, 2024 · 0 comments · May be fixed by #298

Comments

@annuges
Copy link

annuges commented Feb 29, 2024

There is a typo in the code for creating a plan_r2r! with numthreads != nothing.
The function returns an out of place plan_r2r in this case (the plan_r2r is missing the ! )

function plan_r2r!(X::StridedArray{T,N}, kinds, region;
                   flags::Integer=ESTIMATE,
                   timelimit::Real=NO_TIMELIMIT,
                   num_threads::Union{Nothing, Integer} = nothing) where {T<:fftwNumber,N}
    if num_threads !== nothing
        plan = set_num_threads(num_threads) do
            plan_r2r(X, kinds, region; flags = flags, timelimit = timelimit)
        end
        return plan
    end
    r2rFFTWPlan{T,Any,true,N}(X, X, region, kinds, flags, timelimit)
end

If the plan is now out of place this silently breaks code relying on P*x acting in place on x since the out of place plan now does not modify x.

perhaps this is additional motivation to require lmul!(P,x) syntax for applying in place plans

@stevengj stevengj linked a pull request Mar 1, 2024 that will close this issue
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 a pull request may close this issue.

1 participant