Skip to content
Snippets Groups Projects
Commit d807fa2b authored by Oliver Bock's avatar Oliver Bock
Browse files

Output normalized power spectrum as means for manual validation on Linux and Windows

parent cc87961b
No related branches found
No related tags found
No related merge requests found
...@@ -393,6 +393,7 @@ int runTest(clFFT_Dim3 n, int batchSize, clFFT_Direction dir, clFFT_Dimension di ...@@ -393,6 +393,7 @@ int runTest(clFFT_Dim3 n, int batchSize, clFFT_Direction dir, clFFT_Dimension di
#endif #endif
int length = n.x * n.y * n.z * batchSize; int length = n.x * n.y * n.z * batchSize;
float normFactor = 1.0 / (n.x * n.y * n.z);
clFFT_SplitComplex data_i_split = (clFFT_SplitComplex) { NULL, NULL }; clFFT_SplitComplex data_i_split = (clFFT_SplitComplex) { NULL, NULL };
clFFT_SplitComplex data_cl_split = (clFFT_SplitComplex) { NULL, NULL }; clFFT_SplitComplex data_cl_split = (clFFT_SplitComplex) { NULL, NULL };
...@@ -613,6 +614,26 @@ int runTest(clFFT_Dim3 n, int batchSize, clFFT_Direction dir, clFFT_Dimension di ...@@ -613,6 +614,26 @@ int runTest(clFFT_Dim3 n, int batchSize, clFFT_Direction dir, clFFT_Dimension di
free(result_split.real); free(result_split.real);
free(result_split.imag); free(result_split.imag);
} }
#else
log_info("Output power spectrum for manual validation (normalized):\n");
printf("n: %u, length: %i\n", n.x * n.y * n.z, length);
if(dataFormat != clFFT_SplitComplexFormat) {
clFFT_SplitComplex result_split;
result_split.real = (float *) malloc(length*sizeof(float));
result_split.imag = (float *) malloc(length*sizeof(float));
convertInterleavedToSplit(&result_split, data_cl, length);
for(int i = 0; i < length; ++i) {
printf("%f\n", normFactor * (result_split.real[i]*result_split.real[i] + result_split.imag[i]*result_split.imag[i]));
}
free(result_split.real);
free(result_split.imag);
}
else {
for(int i = 0; i < length; ++i) {
printf("%f\n", normFactor * (data_cl_split.real[i]*data_cl_split.real[i] + data_cl_split.imag[i]*data_cl_split.imag[i]));
}
}
#endif #endif
cleanup: cleanup:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment