Commit 8700469d authored by Oliver Bock's avatar Oliver Bock
Browse files

Added feature to use an input data file instead of random values

parent 8409f6fd
...@@ -374,7 +374,7 @@ void convertInterleavedToSplit(clFFT_SplitComplex *result_split, clFFT_Complex * ...@@ -374,7 +374,7 @@ void convertInterleavedToSplit(clFFT_SplitComplex *result_split, clFFT_Complex *
} }
} }
int runTest(clFFT_Dim3 n, int batchSize, clFFT_Direction dir, clFFT_Dimension dim, int runTest(FILE *input, clFFT_Dim3 n, int batchSize, clFFT_Direction dir, clFFT_Dimension dim,
clFFT_DataFormat dataFormat, int numIter, clFFT_TestType testType, int debugEnabled) clFFT_DataFormat dataFormat, int numIter, clFFT_TestType testType, int debugEnabled)
{ {
cl_int err = CL_SUCCESS; cl_int err = CL_SUCCESS;
...@@ -457,6 +457,18 @@ int runTest(clFFT_Dim3 n, int batchSize, clFFT_Direction dir, clFFT_Dimension di ...@@ -457,6 +457,18 @@ int runTest(clFFT_Dim3 n, int batchSize, clFFT_Direction dir, clFFT_Dimension di
data_oref.imag[i] = data_iref.imag[i]; data_oref.imag[i] = data_iref.imag[i];
} }
} }
else if(NULL != input) {
for(i = 0; i < length; i++) {
fscanf(input, "%f\n", &data_i[i].real);
data_i[i].imag = 0.0f;
data_cl[i].real = 0.0f;
data_cl[i].imag = 0.0f;
data_iref.real[i] = data_i[i].real;
data_iref.imag[i] = data_i[i].imag;
data_oref.real[i] = data_iref.real[i];
data_oref.imag[i] = data_iref.imag[i];
}
}
else { else {
for(i = 0; i < length; i++) for(i = 0; i < length; i++)
{ {
...@@ -731,6 +743,7 @@ int main (int argc, char * const argv[]) { ...@@ -731,6 +743,7 @@ int main (int argc, char * const argv[]) {
test_start(); test_start();
FILE *inputData = NULL;
cl_ulong gMemSize; cl_ulong gMemSize;
clFFT_Direction dir = clFFT_Forward; clFFT_Direction dir = clFFT_Forward;
int numIter = 1; int numIter = 1;
...@@ -922,7 +935,7 @@ int main (int argc, char * const argv[]) { ...@@ -922,7 +935,7 @@ int main (int argc, char * const argv[]) {
char delim[] = " \n"; char delim[] = " \n";
char tmpStr[100]; char tmpStr[100];
char line[200]; char line[500];
char *param, *val; char *param, *val;
int total_errors = 0; int total_errors = 0;
if(argc == 1) { if(argc == 1) {
...@@ -944,7 +957,7 @@ int main (int argc, char * const argv[]) { ...@@ -944,7 +957,7 @@ int main (int argc, char * const argv[]) {
test_finish(); test_finish();
return -3; return -3;
} }
while(fgets(line, 199, paramFile)) { while(fgets(line, 499, paramFile)) {
if(!strcmp(line, "") || !strcmp(line, "\n") || ifLineCommented(line)) if(!strcmp(line, "") || !strcmp(line, "\n") || ifLineCommented(line))
continue; continue;
param = strtok(line, delim); param = strtok(line, delim);
...@@ -991,6 +1004,16 @@ int main (int argc, char * const argv[]) { ...@@ -991,6 +1004,16 @@ int main (int argc, char * const argv[]) {
else if(!strcmp(tmpStr, "in-place")) else if(!strcmp(tmpStr, "in-place"))
testType = clFFT_IN_PLACE; testType = clFFT_IN_PLACE;
} }
else if(!strcmp(param, "-inputdatafile")) {
sscanf(val, "%s", tmpStr);
inputData = fopen (tmpStr, "r");
if(!inputData) {
printf("ERROR: Couldn't open input data file (%s)! Using random data instead...\n", val);
}
else {
printf("INFO: Using input data file \"%s\"...\n", val);
}
}
param = strtok(NULL, delim); param = strtok(NULL, delim);
} }
...@@ -999,7 +1022,7 @@ int main (int argc, char * const argv[]) { ...@@ -999,7 +1022,7 @@ int main (int argc, char * const argv[]) {
continue; continue;
} }
err = runTest(n, batchSize, dir, dim, dataFormat, numIter, testType, debugEnabled); err = runTest(inputData, n, batchSize, dir, dim, dataFormat, numIter, testType, debugEnabled);
if (err) if (err)
total_errors++; total_errors++;
} }
......
-n 256 1 1 -batchsize 1 -dir forward -dim 1D -format interleaved -numiter 1 -testtype in-place -n 256 1 1 -batchsize 1 -dir forward -dim 1D -format interleaved -numiter 1 -testtype in-place -inputdatafile test_waveform.dat
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