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

Add multiple CUDA streams support #10

Open
mxmlnkn opened this issue Mar 28, 2016 · 4 comments
Open

Add multiple CUDA streams support #10

mxmlnkn opened this issue Mar 28, 2016 · 4 comments

Comments

@mxmlnkn
Copy link
Contributor

mxmlnkn commented Mar 28, 2016

Currently there seems to be no support for cufftSetStream.

@Flamefire
Copy link
Contributor

This is correct. The reason for this is, that only a common subset of all libraries functionality can be used. There is no such thing as streams in the MKL or FFTW so I did not want to introduce something library specific like streams. If you have an idea how to cleanly add this, I'd be grateful.

@mxmlnkn
Copy link
Contributor Author

mxmlnkn commented Apr 1, 2016

Well, the includes are already library specific, so as a workaround may you could use the same preprocessor branching for setting the stream:

#ifdef ALPAKA_ACC_GPU_CUDA_ENABLED
#   include "foobar/libraries/cuFFT/cuFFT.hpp"
#   define makeFftPlan(...) makeFFT< libraries::cuFFT::CuFFT<> >( __VA_ARGS__ )
#else
#   include "foobar/libraries/fftw/FFTW.hpp"
#   define makeFftPlan(...) makeFFT< libraries::fftw::FFTW<> >( __VA_ARGS__ )
#endif
[...]
#ifdef ALPAKA_ACC_GPU_CUDA_ENABLED
    cufftSetStream( ftPlan, rStream );
#endif

The problem here is that ftPlan would need to be the raw plan, not the abstraction provided by HaLT.

@Flamefire
Copy link
Contributor

What if I do expose a setStream method on the plan? It could be an empty default implementation but possibly overwritten for e.g. CUDA. For other backends it might be something different. Or a method to get the plan itself. Could be useful for fine-tuning of other things too, although this is against the single-interface design of the library where you just change the backend at one place (instead of the define you can just put a using FFT_Backend = libraries::fftw::FFTW<> there)

@mxmlnkn
Copy link
Contributor Author

mxmlnkn commented Apr 1, 2016

A setStream method sounds good to me.

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

No branches or pull requests

2 participants