Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Institute of Technical Acoustics (ITA)
ITAConvolution
Commits
9b21ce1d
Commit
9b21ce1d
authored
Mar 09, 2018
by
Dipl.-Ing. Jonas Stienen
Browse files
Adding NUP conv benchmark
parent
0a5cdd8b
Changes
3
Hide whitespace changes
Inline
Side-by-side
benchmarks/CMakeLists.txt
View file @
9b21ce1d
...
...
@@ -4,3 +4,36 @@ project( ITAConvolutionBenchmarks )
list
(
APPEND CMAKE_MODULE_PATH
"$ENV{VISTA_CMAKE_COMMON}"
)
include
(
VistaCommon
)
vista_use_package
(
ITABase REQUIRED FIND_DEPENDENCIES
)
vista_use_package
(
ITAConvolution REQUIRED FIND_DEPENDENCIES
)
vista_use_package
(
ITADataSources REQUIRED FIND_DEPENDENCIES
)
if
(
ITA_CORE_LIBS_BUILD_STATIC
)
add_definitions
(
-DITA_BASE_STATIC -DITA_DSP_STATIC -DITA_DATA_SOURCES_STATIC -DITA_CONVOLUTION_STATIC
)
endif
(
)
if
(
ITA_VISTA_BUILD_STATIC
)
add_definitions
(
-DVISTATOOLS_STATIC -DVISTABASE_STATIC -DVISTAMATH_STATIC -DVISTAASPECTS_STATIC -DVISTAINTERPROCCOMM_STATIC
)
endif
(
)
#add_executable( ITAConvolution_BM_UPCFilterComponent NUPCFilterComponentBenchmark.h NUPCFilterComponentBenchmark.cpp )
#target_link_libraries( ITAConvolution_BM_UPCFilterComponent ${VISTA_USE_PACKAGE_LIBRARIES} )
#vista_configure_app( ITAConvolution_BM_UPCFilterComponent )
#vista_install( ITAConvolution_BM_UPCFilterComponent )
#vista_create_default_info_file( ITAConvolution_BM_UPCFilterComponent )
#set_property( TARGET ITAConvolution_BM_UPCFilterComponent PROPERTY FOLDER "ITACoreLibs/Benchmarks/ITAConvolution" )
add_executable
(
ITAConvolution_BM_UPConv ITAConvolution_BM_UPConv.cpp
)
target_link_libraries
(
ITAConvolution_BM_UPConv
${
VISTA_USE_PACKAGE_LIBRARIES
}
)
vista_configure_app
(
ITAConvolution_BM_UPConv
)
vista_install
(
ITAConvolution_BM_UPConv
)
vista_create_default_info_file
(
ITAConvolution_BM_UPConv
)
set_property
(
TARGET ITAConvolution_BM_UPConv PROPERTY FOLDER
"ITACoreLibs/Benchmarks/ITAConvolution"
)
benchmarks/ITAConvolution_BM_UPConv.cpp
0 → 100644
View file @
9b21ce1d
/*
* ----------------------------------------------------------------
*
* ITA core libs
* (c) Copyright Institute of Technical Acoustics (ITA)
* RWTH Aachen University, Germany, 2015-2017
*
* ----------------------------------------------------------------
* ____ __________ _______
* // / //__ ___/ // _ |
* // / // / // /_| |
* // / // / // ___ |
* //__/ //__/ //__/ |__|
*
* ----------------------------------------------------------------
*
* Benchmark uniform partitioned convolution
*
*/
#include
<ITAUPConvolution.h>
#include
<ITAUPFilter.h>
#include
<ITAStringUtils.h>
#include
<ITAAudiofileWriter.h>
#include
<ITASampleBuffer.h>
#include
<ITASampleFrame.h>
#include
<ITAStopWatch.h>
#include
<ITAConfigUtils.h>
#include
<ITAStreamFunctionGenerator.h>
#include
<ITAFileDataSource.h>
#include
<ITAStreamInfo.h>
#include
<iostream>
#include
<math.h>
#include
<vector>
#include
<stdio.h>
using
namespace
std
;
const
std
::
string
sBMFilePath
=
"ITAConvolution_BM_UPConv.ini"
;
struct
ParameterSet
{
unsigned
int
iBlockLength
;
double
dSampleRate
;
string
sWAVOutFilePath
;
unsigned
long
iNumFrames
;
int
iFilterLength
;
int
iScalingApproximation
;
inline
void
SetSomeDefaults
()
{
dSampleRate
=
44.1e3
;
#ifdef DEBUG
iNumFrames
=
100
;
#else
iNumFrames
=
1e3
;
#endif
iScalingApproximation
=
128
;
};
inline
void
SetSomeDependentParameters
()
{
iFilterLength
=
2
*
iBlockLength
;
};
inline
void
WriteToINIFile
()
const
{
INIFileWriteInt
(
"BlockLength"
,
iBlockLength
);
INIFileWriteDouble
(
"SampleRate"
,
dSampleRate
);
INIFileWriteInt
(
"FilterLength"
,
iFilterLength
);
INIFileWriteInt
(
"NumFrames"
,
iNumFrames
);
INIFileWriteString
(
"WAVOutFilePath"
,
sWAVOutFilePath
);
INIFileWriteDouble
(
"BlockTimeSeconds"
,
iBlockLength
/
dSampleRate
);
INIFileWriteString
(
"BlockTime"
,
timeToString
(
iBlockLength
/
dSampleRate
)
);
INIFileWriteInt
(
"ScalingApproximation"
,
iScalingApproximation
);
};
};
void
run_benchmark
(
const
ParameterSet
&
,
const
std
::
string
&
);
int
main
(
int
,
char
**
)
{
cout
<<
"Starting uniformly partitioned block convolution benchmark"
<<
endl
;
INIFileUseFile
(
sBMFilePath
);
ParameterSet
pm
;
pm
.
SetSomeDefaults
();
for
(
auto
BL
:
{
32
,
64
,
128
,
256
}
)
{
for
(
auto
BM
:
{
1
,
2
,
4
,
8
,
16
}
)
{
stringstream
ss
;
ss
<<
"ITAConvolution_BM_NUPConv_L"
<<
BL
<<
"_M"
<<
BL
*
BM
;
string
sBMID
=
ss
.
str
();
pm
.
iBlockLength
=
BL
;
pm
.
iFilterLength
=
BL
*
BM
;
pm
.
sWAVOutFilePath
=
sBMID
+
".wav"
;
pm
.
SetSomeDependentParameters
();
cout
<<
"
\t
Starting "
<<
sBMID
<<
" "
;
run_benchmark
(
pm
,
sBMID
);
cout
<<
"
\t
done."
<<
endl
;
}
}
cout
<<
"All done."
<<
endl
;
return
255
;
}
void
run_benchmark
(
const
ParameterSet
&
pm
,
const
std
::
string
&
sName
)
{
INIFileUseSection
(
sName
);
pm
.
WriteToINIFile
();
ITAStreamFunctionGenerator
sinesignal
(
1
,
pm
.
dSampleRate
,
pm
.
iBlockLength
,
ITAStreamFunctionGenerator
::
SINE
,
500.0
f
,
0.9
f
,
true
);
ITADatasource
*
pIntputStream
=
&
sinesignal
;
ITAUPConvolution
*
pFIRFilterEnginge
=
new
ITAUPConvolution
(
pm
.
iBlockLength
,
pm
.
iFilterLength
);
ITAUPFilter
*
pFIRFilter
=
pFIRFilterEnginge
->
RequestFilter
();
pFIRFilter
->
identity
();
pFIRFilterEnginge
->
ExchangeFilter
(
pFIRFilter
);
pFIRFilter
->
Release
();
ITAAudiofileProperties
props_out
;
props_out
.
iChannels
=
1
;
props_out
.
dSampleRate
=
pm
.
dSampleRate
;
props_out
.
eQuantization
=
ITAQuantization
::
ITA_FLOAT
;
props_out
.
eDomain
=
ITADomain
::
ITA_TIME_DOMAIN
;
props_out
.
iLength
=
pm
.
iNumFrames
*
(
unsigned
int
)
(
pm
.
iBlockLength
);
props_out
.
iChannels
=
1
;
ITAAudiofileWriter
*
writer_out
=
ITAAudiofileWriter
::
create
(
pm
.
sWAVOutFilePath
,
props_out
);
ITAStreamInfo
oState
;
ITASampleBuffer
*
psbInput
=
new
ITASampleBuffer
(
pm
.
iBlockLength
,
true
);
ITASampleFrame
sfTemp
(
1
,
pm
.
iBlockLength
,
true
);
ITAStopWatch
swBenchmark
;
long
unsigned
int
n
=
0
;
while
(
n
<
int
(
pm
.
iNumFrames
)
)
{
// Add new samples
psbInput
->
write
(
pIntputStream
->
GetBlockPointer
(
0
,
&
oState
),
pm
.
iBlockLength
);
swBenchmark
.
start
();
pFIRFilterEnginge
->
Process
(
psbInput
->
GetData
(),
sfTemp
[
0
].
GetData
()
);
swBenchmark
.
stop
();
INIFileWriteDouble
(
"ComputationMean"
,
swBenchmark
.
mean
()
);
INIFileWriteDouble
(
"ComputationStdDev"
,
swBenchmark
.
std_deviation
()
);
INIFileWriteDouble
(
"ComputationMinimum"
,
swBenchmark
.
minimum
()
);
INIFileWriteDouble
(
"ComputationMaximum"
,
swBenchmark
.
maximum
()
);
INIFileWriteDouble
(
"ComputationScalingApproximation"
,
swBenchmark
.
mean
()
*
pm
.
iScalingApproximation
);
writer_out
->
write
(
&
sfTemp
,
sfTemp
.
GetLength
()
);
n
++
;
pIntputStream
->
IncrementBlockPointer
();
if
(
n
%
(
pm
.
iNumFrames
/
10
)
==
0
)
cout
<<
"."
;
}
delete
writer_out
;
delete
psbInput
;
}
benchmarks/NUPCFilterComponentBenchmark.cpp
View file @
9b21ce1d
#include
"
ITA
NUPCFilterComponentBenchmark.h"
#include
"NUPCFilterComponentBenchmark.h"
#include
<cmath>
#include
<ITAFastMath.h>
...
...
@@ -76,7 +76,7 @@ void benchmarkFilterComponentCreation()
pfLeft
[
k
]
=
pfRight
[
k
]
=
(
float
)
rand
()
/
(
float
)
RAND_MAX
;
// Filterkomponente erzeugen
ITANUPC
::
C
FilterComponent
*
pFC
=
pConv
->
createFilterComponent
(
0
,
l
,
0
,
0
,
0
,
0
);
ITANUPC
::
C
*
pFC
=
pConv
->
createFilterComponent
(
0
,
l
,
0
,
0
,
0
,
0
);
// Mess-Vorlauf zur Einspielung des Systems
for
(
k
=
0
;
k
<
3
;
k
++
);
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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