[clfft] 26/32: RMSE comparison changed to be adaptive to problem size, adding more directed tests
Ghislain Vaillant
ghisvail-guest at moszumanska.debian.org
Tue Apr 26 08:34:11 UTC 2016
This is an automated email from the git hooks/post-receive script.
ghisvail-guest pushed a commit to branch master
in repository clfft.
commit 5ad84fcab944183bc23fbdf056d087489e81183e
Author: bragadeesh <bragadeesh.natarajan at amd>
Date: Sun Apr 10 17:54:35 2016 -0700
RMSE comparison changed to be adaptive to problem size, adding more directed tests
---
src/tests/accuracy_test_directed.cpp | 12 ++++++
src/tests/buffer.h | 76 +++++++++++++++++-------------------
src/tests/gtest_main.cpp | 7 ++++
src/tests/test_constants.h | 1 +
4 files changed, 56 insertions(+), 40 deletions(-)
diff --git a/src/tests/accuracy_test_directed.cpp b/src/tests/accuracy_test_directed.cpp
index f2613f6..10cf465 100644
--- a/src/tests/accuracy_test_directed.cpp
+++ b/src/tests/accuracy_test_directed.cpp
@@ -568,11 +568,23 @@ INSTANTIATE_TEST_CASE_P(
);
INSTANTIATE_TEST_CASE_P(
+ clfft_DirectedTest_pow2_single_1d_inv,
+ accuracy_test_directed_real,
+ ::testing::ValuesIn(DirectedTest::TestListGenerator_Pow2<DirectedTest::ParametersPackedRealInplaceInterleaved>().parameter_sets(CLFFT_1D, CLFFT_BACKWARD, CLFFT_SINGLE, 3))
+ );
+
+INSTANTIATE_TEST_CASE_P(
clfft_DirectedTest_pow2_double_1d_fwd,
accuracy_test_directed_real,
::testing::ValuesIn(DirectedTest::TestListGenerator_Pow2<DirectedTest::ParametersPackedRealInplaceInterleaved>().parameter_sets(CLFFT_1D, CLFFT_FORWARD, CLFFT_DOUBLE, 3))
);
+INSTANTIATE_TEST_CASE_P(
+ clfft_DirectedTest_pow2_double_1d_inv,
+ accuracy_test_directed_real,
+ ::testing::ValuesIn(DirectedTest::TestListGenerator_Pow2<DirectedTest::ParametersPackedRealInplaceInterleaved>().parameter_sets(CLFFT_1D, CLFFT_BACKWARD, CLFFT_DOUBLE, 3))
+ );
+
#endif
diff --git a/src/tests/buffer.h b/src/tests/buffer.h
index 4ca2722..beaad2c 100644
--- a/src/tests/buffer.h
+++ b/src/tests/buffer.h
@@ -490,68 +490,64 @@ private:
{
//RMS accuracy judgement
- // Find maximum magnitude
- double maxMag = 0.0, maxMagInv = 1.0;
- for( size_t batch = 0; batch < batch_size(); batch++ ) {
- for( size_t z = 0; z < length(dimz); z++) {
- for( size_t y = 0; y < length(dimy); y++) {
- for( size_t x = 0; x < length(dimx); x++) {
- double ex_r, ex_i, mag;
- ex_r = other_buffer.real(x, y, z, batch);
+ size_t problem_size_per_transform = length(dimx) * length(dimy) * length(dimz);
+ double rmse_tolerance_this = rmse_tolerance * sqrt((double)problem_size_per_transform / 4096.0);
- if( other_buffer.is_complex() || other_buffer.is_hermitian() )
- ex_i = other_buffer.imag(x, y, z, batch);
- else
- ex_i = 0;
+ for (size_t batch = 0; batch < batch_size(); batch++) {
- mag = ex_r*ex_r + ex_i*ex_i;
- maxMag = (mag > maxMag) ? mag : maxMag;
- }
- }
- }
- }
+ double maxMag = 0.0, maxMagInv = 1.0;
- if(maxMag > magnitude_lower_limit)
- {
- maxMagInv = 1.0/maxMag;
- }
+ // Compute RMS error relative to maximum magnitude
+ double rms = 0;
- // Compute RMS error relative to maximum magnitude
- double rms = 0;
- for( size_t batch = 0; batch < batch_size(); batch++ ) {
- for( size_t z = 0; z < length(dimz); z++) {
- for( size_t y = 0; y < length(dimy); y++) {
- for( size_t x = 0; x < length(dimx); x++) {
+ for (size_t z = 0; z < length(dimz); z++) {
+ for (size_t y = 0; y < length(dimy); y++) {
+ for (size_t x = 0; x < length(dimx); x++) {
double ex_r, ex_i, ac_r, ac_i;
+ double mag;
ex_r = other_buffer.real(x, y, z, batch);
ac_r = real(x, y, z, batch);
- if( other_buffer.is_complex() || other_buffer.is_hermitian() )
+ if (other_buffer.is_complex() || other_buffer.is_hermitian())
ex_i = other_buffer.imag(x, y, z, batch);
else
ex_i = 0;
- if( other_buffer.is_complex() || other_buffer.is_hermitian() )
+ if (other_buffer.is_complex() || other_buffer.is_hermitian())
ac_i = imag(x, y, z, batch);
else
ac_i = 0;
- rms += ((ex_r - ac_r)*(ex_r - ac_r) + (ex_i - ac_i)*(ex_i - ac_i))*maxMagInv;
+ // find maximum magnitude
+ mag = ex_r*ex_r + ex_i*ex_i;
+ maxMag = (mag > maxMag) ? mag : maxMag;
+
+ // compute square error
+ rms += ((ex_r - ac_r)*(ex_r - ac_r) + (ex_i - ac_i)*(ex_i - ac_i));
}
}
}
- }
- rms = sqrt(rms);
- if ( fabs(rms) > tolerance )
- {
- if( suppress_output == false )
- std::cout << std::endl <<"RMS accuracy judgement failure -- RMS = "<< std::dec << rms << std::endl;
- return 1;
+ if (maxMag > magnitude_lower_limit)
+ {
+ maxMagInv = 1.0 / maxMag;
+ }
+
+ rms = sqrt(rms*maxMagInv);
+
+ if (fabs(rms) > rmse_tolerance_this)
+ {
+ if (suppress_output == false)
+ std::cout << std::endl << "RMSE accuracy judgement failure -- RMSE = " << std::dec << rms <<
+ ", maximum allowed RMSE = " << std::dec << rmse_tolerance_this << std::endl;
+ return 1;
+ }
+ else
+ return 0;
}
- else
- return 0;
+
+ return 0;
}
}
diff --git a/src/tests/gtest_main.cpp b/src/tests/gtest_main.cpp
index 8fb9548..09fb1eb 100644
--- a/src/tests/gtest_main.cpp
+++ b/src/tests/gtest_main.cpp
@@ -27,6 +27,7 @@ namespace po = boost::program_options;
size_t number_of_random_tests;
time_t random_test_parameter_seed;
float tolerance;
+double rmse_tolerance;
bool verbose;
#if defined( MSVC_VER )
@@ -120,6 +121,11 @@ int main( int argc, char **argv )
( "medium,m", "Run all radices; no random testing" )
;
+ // this rmse_tolerance is not absolute; it is for a 4096-point single precision transform
+ // the actual rmse tolerance is this value times sqrt(problem-size/4096)
+ rmse_tolerance = 0.00005;
+
+
// Parse the command line options, ignore unrecognized options and collect them into a vector of strings
po::variables_map vm;
po::parsed_options parsed = po::command_line_parser( argc, argv ).options( desc ).allow_unregistered( ).run( );
@@ -274,6 +280,7 @@ int main( int argc, char **argv )
int myArgc = static_cast< int >( myArgv.size( ) );
std::cout << "Result comparison tolerance is " << tolerance << std::endl;
+ std::cout << "Result comparison RMSE relative tolerance is " << rmse_tolerance << std::endl;
::testing::InitGoogleTest( &myArgc, const_cast< char** >( &myArgv[ 0 ] ) );
diff --git a/src/tests/test_constants.h b/src/tests/test_constants.h
index 4b0d9ca..b882ead 100644
--- a/src/tests/test_constants.h
+++ b/src/tests/test_constants.h
@@ -209,6 +209,7 @@ const size_t max_dimension = 3;
const double magnitude_lower_limit = 1.0E-100;
extern float tolerance;
+extern double rmse_tolerance;
extern cl_device_type g_device_type;
extern cl_int g_device_id;
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/clfft.git
More information about the debian-science-commits
mailing list