Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
einsteinathome
libclfft
Commits
8700469d
Commit
8700469d
authored
May 20, 2011
by
Oliver Bock
Browse files
Added feature to use an input data file instead of random values
parent
8409f6fd
Changes
2
Show whitespace changes
Inline
Side-by-side
example/main.cpp
View file @
8700469d
...
...
@@ -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
)
{
cl_int
err
=
CL_SUCCESS
;
...
...
@@ -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
];
}
}
else
if
(
NULL
!=
input
)
{
for
(
i
=
0
;
i
<
length
;
i
++
)
{
fscanf
(
input
,
"%f
\n
"
,
&
data_i
[
i
].
real
);
data_i
[
i
].
imag
=
0.0
f
;
data_cl
[
i
].
real
=
0.0
f
;
data_cl
[
i
].
imag
=
0.0
f
;
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
{
for
(
i
=
0
;
i
<
length
;
i
++
)
{
...
...
@@ -731,6 +743,7 @@ int main (int argc, char * const argv[]) {
test_start
();
FILE
*
inputData
=
NULL
;
cl_ulong
gMemSize
;
clFFT_Direction
dir
=
clFFT_Forward
;
int
numIter
=
1
;
...
...
@@ -922,7 +935,7 @@ int main (int argc, char * const argv[]) {
char
delim
[]
=
"
\n
"
;
char
tmpStr
[
100
];
char
line
[
2
00
];
char
line
[
5
00
];
char
*
param
,
*
val
;
int
total_errors
=
0
;
if
(
argc
==
1
)
{
...
...
@@ -944,7 +957,7 @@ int main (int argc, char * const argv[]) {
test_finish
();
return
-
3
;
}
while
(
fgets
(
line
,
1
99
,
paramFile
))
{
while
(
fgets
(
line
,
4
99
,
paramFile
))
{
if
(
!
strcmp
(
line
,
""
)
||
!
strcmp
(
line
,
"
\n
"
)
||
ifLineCommented
(
line
))
continue
;
param
=
strtok
(
line
,
delim
);
...
...
@@ -991,6 +1004,16 @@ int main (int argc, char * const argv[]) {
else
if
(
!
strcmp
(
tmpStr
,
"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
);
}
...
...
@@ -999,7 +1022,7 @@ int main (int argc, char * const argv[]) {
continue
;
}
err
=
runTest
(
n
,
batchSize
,
dir
,
dim
,
dataFormat
,
numIter
,
testType
,
debugEnabled
);
err
=
runTest
(
inputData
,
n
,
batchSize
,
dir
,
dim
,
dataFormat
,
numIter
,
testType
,
debugEnabled
);
if
(
err
)
total_errors
++
;
}
...
...
example/test.single
View file @
8700469d
-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
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment