JuliaMath / JuliaMath/NFFT.jl

Suggestion: infer plan type from `x` type

Open
#100 8 comments 0 reactions 0 assignees View on GitHub
Dominant language
Julia
Stars
156
Forks
29
Avg merge
8h 57m
Merged PRs (30d)
1

Description

If I understand correctly, the current approach is that user decides between cpu and gpu versions by either
* CPU: `p = plan_nfft(x, N)` or (currently equivalently I think) `p = plan_nfft(Array, x, N)`
* GPU: `p = plan_nfft(CuArray, x, N)`

I'd prefer that the default plan type come from the type of `x` by adding a method something like
`plan_nfft(x, N) = plan_nfft(typeof(x), x, N)`

So if `x` is a `CuArray` then by default the plan will be a GPU plan.

The reason is that then I can embed `plan_nfft` into downstream packages without forcing them to depend on CUDA.jl.
This might also "future proof" it so that someday when we have a OpenCLArray version then again it can inherit from `x`.
But I might be missing something?
And I have not really been able to test it out yet because I think the recent CUDA fixes are waiting for release updates.

I realize that if `x` is an `Adjoint` type (or a Range) then this would need additional work to get at the "base" of such types.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.