-
Notifications
You must be signed in to change notification settings - Fork 85
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
complex-to-real inverse 2D FFT: incorrect results #128
Comments
I think I encountered the same problem (incorrect results for inverse FFT Hermitian to real). I can confirm that I've checked
|
I am able to reproduce this; the host code in the library appears ok, it generates the correct parameters for the kernel, bug has to be in one the kernels. |
I have a fix for 2D and 3D: develop...ex-rzr:fix_hermitian_inverse The resulting matrix was correct only for 1D (only x index was computed for conjugates, y and z were not changed). It seems that I'm not sure that my fix is completely correct (and it's probably not optimal), but Another question is why all rocFFT tests pass even without the fix. I haven't checked them very deeply but there are tests of Hermitian-to-real for 1D and 2D that compare results against FFTW. |
@ex-rzr Good to see you may have been working on this as well. |
@nodwellmtt Complex FFTs have no special restrictions, hence it is not always valid to compare complex and real FFTs |
@bragadeesh There is nothing particularly difficult about the multi-dimensional case, except knowing how the data are laid out, which is a matter of convention. In any case I am glad this issue is being addressed. |
@nodwellmtt |
Will do! I should have a chance to get to that this afternoon or tomorrow. |
@bragadeesh
|
@nodwellmtt |
@bragadeesh diff --git a/library/src/device/complex2real.cpp b/library/src/device/complex2real.cpp
index 56e6806..3b64dce 100644
--- a/library/src/device/complex2real.cpp
+++ b/library/src/device/complex2real.cpp
@@ -244,7 +244,7 @@ void hermitian2complex(const void *data_p, void *back_p)
std::cout << "Error: dimension larger than 3, which is not handled" << std::endl;
size_t dim_1 = 1, dim_2 = 1;
- if(data->node->length.size() == 2)
+ if(data->node->length.size() >= 2)
dim_1 = data->node->length[1];
if(data->node->length.size() == 3)
dim_2 = data->node->length[2];
@@ -258,10 +258,10 @@ void hermitian2complex(const void *data_p, void *back_p)
hipStream_t rocfft_stream = data->rocfft_stream;
- float2* tmp; tmp = (float2*)malloc(sizeof(float2)*input_distance*batch);
+ /*float2* tmp; tmp = (float2*)malloc(sizeof(float2)*input_distance*batch);
hipMemcpy(tmp, input_buffer, sizeof(float2)*input_distance*batch, hipMemcpyDeviceToHost);
- /*printf("herm size %d, dim0 %d, dim1 %d, dim2 %d\n", hermitian_size, dim_0, dim_1, dim_2);
+ printf("herm size %d, dim0 %d, dim1 %d, dim2 %d\n", hermitian_size, dim_0, dim_1, dim_2);
printf("input_stride %d output_stride %d input_distance %d output_distance %d\n", input_stride, output_stride, input_distance, output_distance);
//for(size_t j=0;j<data->node->length[1]; j++) |
thanks @ex-rzr |
@bragadeesh , has this been solved? |
closing this old one |
I am still seeing this issue e.g. if I modify the sample from the docs like this (also fixed error calculation, if I do not change the array the inverse is correct):
I get |
* Add unit test to ensure multi-threaded logs don't get garbled * Bump library to C++14 internally, as thread-safe logging requires it * Emit cleanup trace message before closing the log file * Import thread-safe logging code from rocBLAS. This introduces a new rocfft_ostream type that buffers data for a per-output-file worker thread, to prevent messages from being garbled when multiple threads all log to the same destination. The rocfft_ostream objects must be per-thread (even if they would log to the same place), so in rocfft_setup we now merely open file descriptors to the output files, and construct thread-local rocfft_ostream objects when the first message is emitted from each thread. * Clean up log files and layer mode during rocfft_cleanup
I am unable to get correct results from an inverse 2D Hermitian-to-real FFT. Generally I am inclined to suspect an error on my part, but after much investigation, I can't find any error, and suspect it may be in the library. If anyone is able to point out an error, I would much appreciate it.
See the attached source code, which is as brief an example as I could manage. Data is all in raw pointers to maintain transparency.
This code:
Library versions:
hipcc version: 1.5.18151
rocfft version 0.8.1
rocfft_real_inverse.cpp.txt
The text was updated successfully, but these errors were encountered: