-
Notifications
You must be signed in to change notification settings - Fork 6
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
Convolution support #33
Comments
Hello The convolutions code design is 3 years old, I mostly did the things needed for my Master's thesis with them then - matrix vector convolutions for multidimensional systems. So not all things have been fully implemented - R2C convolutions breaking for 1D is expected as I didn't know how to combine all the things (R2C decomposition and convolution) in one kernel then. It will be easier to implement now with the new modular structure. The 3D convolutions not working seems to be a bug that I think I have fixed on the dev branch (the modified test 51 passes now). The numberBatches should work the same as coordinateFeatures now as well (unless you use the matrix-vector functionality). |
Thanks ! I am almost finished with the release (needed to update the conda packages), so I can look at this. The 3D convolutions work nicely, thanks ! I was wondering (since I do not yet completely understand how the It can be very useful to compute the cross-correlation of N images vs a single reference, or for near-field propagation (this is practically a 2D convolution of stacks of array, with the same kernel). |
coordinateFeatures should behave the same as numberBatches, unless you do matrix-vector multiplication convolutions (kernel is a matrix, system is a vector). It is a second form of batching (both work at the same time), since omitDimension is not working with convolutions right now. As for multiple input - single kernel convolutions, I have only implemented reverse so far (one system, multiple kernels, multiple outputs). I can make it work for this case as well, as using the reverse option should have worse performance. |
Yes, this would be very interesting e.g. for multiple (batched) images alignment vs a single reference: 1 batch of 2D images and a single reference image |
@vincefn I have added an option to do this functionality and an example that shows how to set it up (53). It didn't require any big changes, so, hopefully, it will work straight away. |
Hi @DTolm, I've now updated the code to support various types of batch transforms, e.g. an array shape of (nbatch, ny, nx) with the same kernel shape, or a smaller kernel shape e.g. (ny, nx) using Now I have found issues with some odd transforms, e.g. (on my mac) a 1D+convolution transform of shape 3*7 fails with a compilation error (same for many odd transforms with small primes). It's true for a C2C but also R2C, regardless of other parameters (in/out, batched or not,..). Also, in-place R2C transforms work for 2D and 3D, but not out-of-place. I guess it's not be possible since the complex array needs 1 or 2 extra bytes, and I don't think there's an easy way around this. (incidentally this is related to the discussion in DTolm/VkFFT#159) |
Hi @DTolm, I've updated the code so I can use batch convolution also for cuda, and also the systematic command-line test can be used for convolution. I've also clarified the systems which work (c2c, inplace r2c ndim>1, radix, single upload only). Here's an example of test between 2 and 128 for c2c out-of-place where we can see which radix sizes are failing (here using cuda on an A4500) - always compilation errors, some missing }. (there are odd and even sizes contrary to my previous message):
|
Hello, Sorry for the long reply, I am currently busy with another project. I will investigate the systems failing in the near future. Thank you for reporting them. Best regards, |
Hi @DTolm , now that the release is out, I made some tests with on-the-fly convolution following Osamu's email exchange which picked my curiosity.
There is now a branch with convolution support
What I have seen (but I made so far a very limited number of tests):
config->coordinateFeatures = n_batch
instead ofnumberBatches
, I assume that's the proper wayThe tests are all visible on the pyvkfft-convolve notebook.
The text was updated successfully, but these errors were encountered: