[clfft] 58/128: Precallback - Round Trip tests
Ghislain Vaillant
ghisvail-guest at moszumanska.debian.org
Thu Oct 22 14:54:38 UTC 2015
This is an automated email from the git hooks/post-receive script.
ghisvail-guest pushed a commit to branch master
in repository clfft.
commit 317775008362bc9a1648884739c843b4675ad01a
Author: Pradeep <pradeep.rao at amd.com>
Date: Sun Sep 6 14:57:14 2015 +0530
Precallback - Round Trip tests
---
src/tests/accuracy_test_common.h | 74 +++++++++++++++++++
src/tests/accuracy_test_mixed_precallback.cpp | 100 +++++++-------------------
src/tests/accuracy_test_pow2_precallback.cpp | 45 ++++++------
src/tests/accuracy_test_pow3_precallback.cpp | 4 +-
src/tests/accuracy_test_pow5_precallback.cpp | 4 +-
5 files changed, 128 insertions(+), 99 deletions(-)
diff --git a/src/tests/accuracy_test_common.h b/src/tests/accuracy_test_common.h
index 1aba3e1..6312780 100644
--- a/src/tests/accuracy_test_common.h
+++ b/src/tests/accuracy_test_common.h
@@ -601,6 +601,80 @@ void complex_to_complex_round_trip( data_pattern pattern,
/*****************************************************/
// dimension is inferred from lengths.size()
// tightly packed is inferred from strides.empty()
+// no need to support non-unit strides and distances here
+// they are covered in plenty of other places
+// and just needlessly complicate things in this case
+template< class T, class cl_T, class fftw_T >
+void precallback_complex_to_complex_round_trip( data_pattern pattern,
+ std::vector<size_t> lengths, size_t batch,
+ layout::buffer_layout_t layout )
+{
+ placeness::placeness_t placeness = placeness::in_place;
+
+ clfft<T, cl_T> test_fft( static_cast<clfftDim>(lengths.size()), &lengths[0],
+ NULL, NULL, batch, 0, 0,
+ cl_layout(layout), cl_layout(layout),
+ cl_placeness( placeness ) );
+
+ buffer<T> expected( lengths.size(), &lengths[0], NULL, batch, 0, layout, CLFFT_OUTOFPLACE );
+
+ if( pattern == sawtooth )
+ {
+ test_fft.set_input_to_sawtooth( 1.0f );
+ expected.set_all_to_sawtooth( 1.0f );
+ }
+ else if( pattern == value )
+ {
+ test_fft.set_input_to_value( 2.0f, 2.5f );
+ expected.set_all_to_value( 2.0f, 2.5f );
+ }
+ else if( pattern == impulse )
+ {
+ test_fft.set_input_to_impulse();
+ expected.set_all_to_impulse();
+ }
+ else if( pattern == erratic )
+ {
+ test_fft.set_input_to_random();
+ expected.set_all_to_random_data( 10, super_duper_global_seed );
+ }
+ else
+ {
+ throw std::runtime_error( "invalid pattern type in complex_to_complex_round_trip()" );
+ }
+
+ // if we're starting with unequal data, we're destined for failure
+ EXPECT_EQ( true, test_fft.input_buffer() == expected );
+
+ test_fft.set_input_precallback();
+
+ //precallback user data
+ buffer<T> userdata( lengths.size(), &lengths[0], NULL, batch, 0, layout::real, CLFFT_OUTOFPLACE);
+ userdata.set_all_to_random_data(lengths[0], 10);
+
+ expected *= userdata;
+
+ test_fft.set_forward_transform();
+ test_fft.transform();
+
+ // confirm that we actually did something
+ bool stash_suppress_output = suppress_output;
+ suppress_output = true;
+ EXPECT_EQ( false, test_fft.result() == expected );
+ suppress_output = stash_suppress_output;
+
+ test_fft.refresh_plan();
+
+ test_fft.set_backward_transform();
+ test_fft.transform();
+
+ EXPECT_EQ( true, test_fft.result() == expected );
+}
+
+/*****************************************************/
+/*****************************************************/
+// dimension is inferred from lengths.size()
+// tightly packed is inferred from strides.empty()
template< class T, class cl_T, class fftw_T >
void real_to_complex_round_trip( data_pattern pattern,
std::vector<size_t> lengths, size_t batch )
diff --git a/src/tests/accuracy_test_mixed_precallback.cpp b/src/tests/accuracy_test_mixed_precallback.cpp
index bf8cd70..fe82051 100644
--- a/src/tests/accuracy_test_mixed_precallback.cpp
+++ b/src/tests/accuracy_test_mixed_precallback.cpp
@@ -100,7 +100,7 @@ INSTANTIATE_TEST_CASE_P(
::testing::ValuesIn( supported_sizes_precallback.sizes )
);
-namespace precallback
+namespace precallback_mixed
{
/**********************************************************************************************
@@ -179,6 +179,32 @@ TEST_F(accuracy_test_precallback_single, pow2_normal_1D_forward_in_place_complex
catch( const std::exception& err ) { handle_exception(err); }
}
+//Precallback with LDS
+template< class T, class cl_T, class fftw_T >
+void lds_1D_forward_64_in_place_complex_interleaved_to_complex_interleaved()
+{
+ std::vector<size_t> lengths;
+ lengths.push_back( 64 );
+ size_t batch = 1;
+ std::vector<size_t> input_strides;
+ std::vector<size_t> output_strides;
+ size_t input_distance = 0;
+ size_t output_distance = 0;
+ layout::buffer_layout_t in_layout = layout::complex_interleaved;
+ layout::buffer_layout_t out_layout = layout::complex_interleaved;
+ placeness::placeness_t placeness = placeness::in_place;
+ direction::direction_t direction = direction::forward;
+
+ data_pattern pattern = impulse;
+ precallback_complex_to_complex_lds<T, cl_T, fftw_T>( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness );
+}
+
+TEST_F(accuracy_test_precallback_single, lds_1D_forward_64_in_place_complex_interleaved_to_complex_interleaved)
+{
+ try { lds_1D_forward_64_in_place_complex_interleaved_to_complex_interleaved< float, cl_float, fftwf_complex >(); }
+ catch( const std::exception& err ) { handle_exception(err); }
+}
+
#pragma endregion
/**********************************************************************************************
@@ -275,78 +301,6 @@ TEST_P( mixed_radix_precallback, double_precision_real_to_hermitian_auto_generat
mixed_radix_real_to_hermitian<double, cl_double, fftw_complex>(problem_size);
}
-
-template< class T, class cl_T, class fftw_T >
-void pow3_normal_1D_round_trip_real_to_complex()
-{
- std::vector<size_t> lengths;
- lengths.push_back( normal3 );
- size_t batch = 1;
-
- data_pattern pattern = impulse;
- precallback_real_to_complex_round_trip<T, cl_T, fftw_T>( pattern, lengths, batch );
-}
-
-TEST_F(accuracy_test_precallback_single, pow3_normal_1D_round_trip_real_to_complex)
-{
- try { pow3_normal_1D_round_trip_real_to_complex< float, cl_float, fftwf_complex >(); }
- catch( const std::exception& err ) { handle_exception(err); }
-}
-
-TEST_F(accuracy_test_precallback_double, pow3_normal_1D_round_trip_real_to_complex)
-{
- try { pow3_normal_1D_round_trip_real_to_complex< double, cl_double, fftw_complex >(); }
- catch( const std::exception& err ) { handle_exception(err); }
-}
-
-template< class T, class cl_T, class fftw_T >
-void pow3_large_1D_round_trip_real_to_complex()
-{
- std::vector<size_t> lengths;
- lengths.push_back( large3 );
- size_t batch = 1;
-
- data_pattern pattern = impulse;
- precallback_real_to_complex_round_trip<T, cl_T, fftw_T>( pattern, lengths, batch );
-}
-
-TEST_F(accuracy_test_precallback_single, pow3_large_1D_round_trip_real_to_complex)
-{
- try { pow3_large_1D_round_trip_real_to_complex< float, cl_float, fftwf_complex >(); }
- catch( const std::exception& err ) { handle_exception(err); }
-}
-
-TEST_F(accuracy_test_precallback_double, pow3_large_1D_round_trip_real_to_complex)
-{
- try { pow3_large_1D_round_trip_real_to_complex< double, cl_double, fftw_complex >(); }
- catch( const std::exception& err ) { handle_exception(err); }
-}
-
#pragma endregion
-template< class T, class cl_T, class fftw_T >
-void lds_1D_forward_64_in_place_complex_interleaved_to_complex_interleaved()
-{
- std::vector<size_t> lengths;
- lengths.push_back( 64 );
- size_t batch = 1;
- std::vector<size_t> input_strides;
- std::vector<size_t> output_strides;
- size_t input_distance = 0;
- size_t output_distance = 0;
- layout::buffer_layout_t in_layout = layout::complex_interleaved;
- layout::buffer_layout_t out_layout = layout::complex_interleaved;
- placeness::placeness_t placeness = placeness::in_place;
- direction::direction_t direction = direction::forward;
-
- data_pattern pattern = impulse;
- precallback_complex_to_complex_lds<T, cl_T, fftw_T>( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness );
-}
-
-TEST_F(accuracy_test_precallback_single, lds_1D_forward_64_in_place_complex_interleaved_to_complex_interleaved)
-{
- try { lds_1D_forward_64_in_place_complex_interleaved_to_complex_interleaved< float, cl_float, fftwf_complex >(); }
- catch( const std::exception& err ) { handle_exception(err); }
-}
-
}
diff --git a/src/tests/accuracy_test_pow2_precallback.cpp b/src/tests/accuracy_test_pow2_precallback.cpp
index 5937d03..93db6e9 100644
--- a/src/tests/accuracy_test_pow2_precallback.cpp
+++ b/src/tests/accuracy_test_pow2_precallback.cpp
@@ -7316,7 +7316,7 @@ TEST_F(accuracy_test_pow2_precallback_double, small_3D_non_unit_stride_and_dista
catch( const std::exception& err ) { handle_exception(err); }
}
-/* TODO Round Trip
+
// *****************************************************
// *****************************************************
@@ -7329,7 +7329,7 @@ void normal_1D_round_trip_complex_to_complex()
layout::buffer_layout_t layout = layout::complex_interleaved;
data_pattern pattern = sawtooth;
- complex_to_complex_round_trip<T, cl_T, fftw_T>( pattern, lengths, batch, layout );
+ precallback_complex_to_complex_round_trip<T, cl_T, fftw_T>( pattern, lengths, batch, layout );
}
TEST_F(accuracy_test_pow2_precallback_single, normal_1D_round_trip_complex_to_complex)
@@ -7356,7 +7356,19 @@ void normal_2D_round_trip_complex_to_complex()
layout::buffer_layout_t layout = layout::complex_planar;
data_pattern pattern = sawtooth;
- complex_to_complex_round_trip<T, cl_T, fftw_T>( pattern, lengths, batch, layout );
+ precallback_complex_to_complex_round_trip<T, cl_T, fftw_T>( pattern, lengths, batch, layout );
+}
+
+TEST_F(accuracy_test_pow2_precallback_single, normal_2D_round_trip_complex_to_complex)
+{
+ try { normal_2D_round_trip_complex_to_complex< float, cl_float, fftwf_complex >(); }
+ catch( const std::exception& err ) { handle_exception(err); }
+}
+
+TEST_F(accuracy_test_pow2_precallback_double, normal_2D_round_trip_complex_to_complex)
+{
+ try { normal_2D_round_trip_complex_to_complex< double, cl_double, fftw_complex >(); }
+ catch( const std::exception& err ) { handle_exception(err); }
}
template< class T, class cl_T, class fftw_T >
@@ -7369,7 +7381,7 @@ void testcase_2D_round_trip_complex_to_complex(size_t l0, size_t l1)
layout::buffer_layout_t layout = layout::complex_planar;
data_pattern pattern = sawtooth;
- complex_to_complex_round_trip<T, cl_T, fftw_T>( pattern, lengths, batch, layout );
+ precallback_complex_to_complex_round_trip<T, cl_T, fftw_T>( pattern, lengths, batch, layout );
}
// added this regression test to catch failures seen in transposes
@@ -7379,18 +7391,6 @@ TEST_F(accuracy_test_pow2_precallback_single, testcase1_2D_round_trip_complex_to
catch( const std::exception& err ) { handle_exception(err); }
}
-TEST_F(accuracy_test_pow2_precallback_single, normal_2D_round_trip_complex_to_complex)
-{
- try { normal_2D_round_trip_complex_to_complex< float, cl_float, fftwf_complex >(); }
- catch( const std::exception& err ) { handle_exception(err); }
-}
-
-TEST_F(accuracy_test_pow2_precallback_double, normal_2D_round_trip_complex_to_complex)
-{
- try { normal_2D_round_trip_complex_to_complex< double, cl_double, fftw_complex >(); }
- catch( const std::exception& err ) { handle_exception(err); }
-}
-
// *****************************************************
// *****************************************************
template< class T, class cl_T, class fftw_T >
@@ -7404,7 +7404,7 @@ void small_3D_round_trip_complex_to_complex()
layout::buffer_layout_t layout = layout::complex_planar;
data_pattern pattern = sawtooth;
- complex_to_complex_round_trip<T, cl_T, fftw_T>( pattern, lengths, batch, layout );
+ precallback_complex_to_complex_round_trip<T, cl_T, fftw_T>( pattern, lengths, batch, layout );
}
TEST_F(accuracy_test_pow2_precallback_single, small_3D_round_trip_complex_to_complex)
@@ -7419,6 +7419,7 @@ TEST_F(accuracy_test_pow2_precallback_double, small_3D_round_trip_complex_to_com
catch( const std::exception& err ) { handle_exception(err); }
}
+
// *****************************************************
// *****************************************************
template< class T, class cl_T, class fftw_T >
@@ -7429,7 +7430,7 @@ void normal_1D_round_trip_real_to_complex()
size_t batch = 1;
data_pattern pattern = impulse;
- real_to_complex_round_trip<T, cl_T, fftw_T>( pattern, lengths, batch );
+ precallback_real_to_complex_round_trip<T, cl_T, fftw_T>( pattern, lengths, batch );
}
TEST_F(accuracy_test_pow2_precallback_single, normal_1D_round_trip_real_to_complex)
@@ -7454,7 +7455,7 @@ void large_1D_round_trip_real_to_complex()
size_t batch = 1;
data_pattern pattern = impulse;
- real_to_complex_round_trip<T, cl_T, fftw_T>( pattern, lengths, batch );
+ precallback_real_to_complex_round_trip<T, cl_T, fftw_T>( pattern, lengths, batch );
}
TEST_F(accuracy_test_pow2_precallback_single, large_1D_round_trip_real_to_complex)
@@ -7480,7 +7481,7 @@ void normal_2D_round_trip_real_to_complex()
size_t batch = 1;
data_pattern pattern = impulse;
- real_to_complex_round_trip<T, cl_T, fftw_T>( pattern, lengths, batch );
+ precallback_real_to_complex_round_trip<T, cl_T, fftw_T>( pattern, lengths, batch );
}
TEST_F(accuracy_test_pow2_precallback_single, normal_2D_round_trip_real_to_complex)
@@ -7507,7 +7508,7 @@ void small_3D_round_trip_real_to_complex()
size_t batch = 1;
data_pattern pattern = impulse;
- real_to_complex_round_trip<T, cl_T, fftw_T>( pattern, lengths, batch );
+ precallback_real_to_complex_round_trip<T, cl_T, fftw_T>( pattern, lengths, batch );
}
TEST_F(accuracy_test_pow2_precallback_single, small_3D_round_trip_real_to_complex)
@@ -7521,5 +7522,5 @@ TEST_F(accuracy_test_pow2_precallback_double, small_3D_round_trip_real_to_comple
try { small_3D_round_trip_real_to_complex< double, cl_double, fftw_complex >(); }
catch( const std::exception& err ) { handle_exception(err); }
}
-*/
+
} //namespace
diff --git a/src/tests/accuracy_test_pow3_precallback.cpp b/src/tests/accuracy_test_pow3_precallback.cpp
index 2039224..93933f5 100644
--- a/src/tests/accuracy_test_pow3_precallback.cpp
+++ b/src/tests/accuracy_test_pow3_precallback.cpp
@@ -7169,7 +7169,7 @@ TEST_F(accuracy_test_pow3_precallback_double, small_3D_non_unit_stride_and_dista
catch( const std::exception& err ) { handle_exception(err); }
}
-/* TODO
+
// *****************************************************
// *****************************************************
template< class T, class cl_T, class fftw_T >
@@ -7353,5 +7353,5 @@ TEST_F(accuracy_test_pow3_precallback_double, small_3D_round_trip_precallback_re
try { small_3D_round_trip_precallback_real_to_complex< double, cl_double, fftw_complex >(); }
catch( const std::exception& err ) { handle_exception(err); }
}
-*/
+
} //namespace
diff --git a/src/tests/accuracy_test_pow5_precallback.cpp b/src/tests/accuracy_test_pow5_precallback.cpp
index 4e631d2..9582711 100644
--- a/src/tests/accuracy_test_pow5_precallback.cpp
+++ b/src/tests/accuracy_test_pow5_precallback.cpp
@@ -7169,7 +7169,7 @@ TEST_F(accuracy_test_pow5_precallback_double, small_3D_non_unit_stride_and_dista
catch( const std::exception& err ) { handle_exception(err); }
}
-/*
+
// *****************************************************
// *****************************************************
template< class T, class cl_T, class fftw_T >
@@ -7353,5 +7353,5 @@ TEST_F(accuracy_test_pow5_precallback_double, small_3D_round_trip_precallback_re
try { small_3D_round_trip_precallback_real_to_complex< double, cl_double, fftw_complex >(); }
catch( const std::exception& err ) { handle_exception(err); }
}
-*/
+
} //namespace
--
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