Commit 1c88b7b0 authored by Oliver Bock's avatar Oliver Bock
Browse files

Add simple debug option (for all platforms)

parent 4022245c
...@@ -376,7 +376,7 @@ void convertInterleavedToSplit(clFFT_SplitComplex *result_split, clFFT_Complex * ...@@ -376,7 +376,7 @@ void convertInterleavedToSplit(clFFT_SplitComplex *result_split, clFFT_Complex *
} }
int runTest(clFFT_Dim3 n, int batchSize, clFFT_Direction dir, clFFT_Dimension dim, int runTest(clFFT_Dim3 n, int batchSize, clFFT_Direction dir, clFFT_Dimension dim,
clFFT_DataFormat dataFormat, int numIter, clFFT_TestType testType) clFFT_DataFormat dataFormat, int numIter, clFFT_TestType testType, int debugEnabled)
{ {
cl_int err = CL_SUCCESS; cl_int err = CL_SUCCESS;
int iter; int iter;
...@@ -614,25 +614,27 @@ int runTest(clFFT_Dim3 n, int batchSize, clFFT_Direction dir, clFFT_Dimension di ...@@ -614,25 +614,27 @@ 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 #endif
log_info("Output power spectrum for manual validation (normalized):\n");
if(dataFormat != clFFT_SplitComplexFormat) { if(debugEnabled) {
clFFT_SplitComplex result_split; log_info("Output power spectrum for manual validation (normalized):\n");
result_split.real = (float *) malloc(length*sizeof(float)); if(dataFormat != clFFT_SplitComplexFormat) {
result_split.imag = (float *) malloc(length*sizeof(float)); clFFT_SplitComplex result_split;
convertInterleavedToSplit(&result_split, data_cl, length); result_split.real = (float *) malloc(length*sizeof(float));
for(int i = 0; i < length; ++i) { result_split.imag = (float *) malloc(length*sizeof(float));
printf("%f\n", normFactor * (result_split.real[i]*result_split.real[i] + result_split.imag[i]*result_split.imag[i])); 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);
} }
free(result_split.real); else {
free(result_split.imag); 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]));
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
cleanup: cleanup:
clFFT_DestroyPlan(plan); clFFT_DestroyPlan(plan);
...@@ -740,6 +742,8 @@ int main (int argc, char * const argv[]) { ...@@ -740,6 +742,8 @@ int main (int argc, char * const argv[]) {
clFFT_TestType testType = clFFT_OUT_OF_PLACE; clFFT_TestType testType = clFFT_OUT_OF_PLACE;
cl_device_id device_ids[MAX_DEVICES]; cl_device_id device_ids[MAX_DEVICES];
int debugEnabled = 0;
FILE *paramFile; FILE *paramFile;
cl_int err, status; cl_int err, status;
...@@ -928,6 +932,10 @@ int main (int argc, char * const argv[]) { ...@@ -928,6 +932,10 @@ int main (int argc, char * const argv[]) {
return -1; return -1;
} }
if(4 == argc && 1 == !strcmp(argv[3], "debug")) {
debugEnabled = 1;
}
if(argc >= 2) { // arguments are supplied in a file with arguments for a single run are all on the same line if(argc >= 2) { // arguments are supplied in a file with arguments for a single run are all on the same line
paramFile = fopen(argv[1], "r"); paramFile = fopen(argv[1], "r");
if(!paramFile) { if(!paramFile) {
...@@ -992,7 +1000,7 @@ int main (int argc, char * const argv[]) { ...@@ -992,7 +1000,7 @@ int main (int argc, char * const argv[]) {
continue; continue;
} }
err = runTest(n, batchSize, dir, dim, dataFormat, numIter, testType); err = runTest(n, batchSize, dir, dim, dataFormat, numIter, testType, debugEnabled);
if (err) if (err)
total_errors++; total_errors++;
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment