Repository navigation
Adding cupyx.scipy.signal.fftconvolve - #3828
Conversation
leofang
left a comment
There was a problem hiding this comment.
Could you post benchmark results? Thanks!
| def _freq_domain_conv(in1, in2, axes, shape, calc_fast_len=False): | ||
| # See scipy's documentation in scipy.signal.signaltools | ||
| # TODO: cupyx.scipy.fftpack.get_fft_plan may be useful, however: | ||
| # * only complex-to-complex planning is possible |
There was a problem hiding this comment.
This is not true. We've supported all kinds on planning in get_fft_plan.
There was a problem hiding this comment.
I wrote this function a few months ago, maybe back then it only worked for complex-to-complex or I was misusing it. I will remove that comment.
There was a problem hiding this comment.
Ah yes, I think the R2C/C2R Nd plan was supported also recently. Though I think they are harder to reuse by nature and perhaps my plan cache #3730 would serve better than explicitly managing plans here.
|
This is run on a Titan V GPU and an Intel Xeon Gold 5122 (3.6 GHz). Some benchmarks (in seconds) are as follows for a
Clearly the FFT methods are faster and On the small side with
For numpy/scipy the FFT method is faster but in |
| return axes | ||
|
|
||
|
|
||
| def _freq_domain_conv(in1, in2, axes, shape, calc_fast_len=False): |
There was a problem hiding this comment.
However, I have also written up oaconvolve this does pass calc_fast_len as False. I could remove it for now just to add it back when oaconvolve is added.
|
Jenkins, test this please. |
|
Jenkins CI test (for commit add37ef, target branch master) failed with status FAILURE. |
|
@coderforlife Could you check the Jenkins failure? |
|
It looks like there are 2 tests that fail, both when using |
|
@coderforlife Any updates? |
|
Jenkins, test this please. |
|
Jenkins CI test (for commit bb4d644, target branch master) failed with status FAILURE. |
|
I forgot which values were off by and by how much and Jenkins info was removed due to being too long ago. Was able to use the newest results and hopefully will pass this one last time. Thanks! |
Hi @coderforlife, in case you don't know already, or if needed, it is now possible to set tolerance per dtype: #4269. |
|
I should the reset the tolerances so it is more strict for the float64, don't run the code through Jenkins yet, I will update soon. |
|
It should be better now! Can we run it on Jenkins (which needs different tolerances than on my machine in some cases so may fail even though it is working on my own machine). Thanks! |
|
Happy to help! (I haven't read the changes as I am not in a right condition.) Jenkins, test this please |
|
One question about the next step when I add else:
try:
iter(axes)
except TypeError:
axes = axes, |
|
Jenkins CI test (for commit 9d7bc1e, target branch master) succeeded! |
It is because numpy does not support non-tuple axes. More specifically, for 2-dim |
|
LGTM! |
Okay! Thanks, fixed the |
This adds
cupyx.scipy.signal.fftconvolvealong with support formethod='fft'incupyx.scipy.signal.convolveandcupyx.scipy.signal.correlate. This function fully supports n-dimensional data.This PR does not include adjustments to
choose_conv_methodor_fftconv_fasterto intelligently choose between the two methods, that will be done in a future PR.