[cppad] Hypothesis: Remote Fedora test machine is using gaurd digits and thereby defeating the testing of th

Bradley M. Bell bradbell at fedoraproject.org
Sat Jan 5 14:53:06 UTC 2013


commit 1d976e8ba5905c1188592cfe85ac0319fd07d8b5
Author: Brad Bell <bradbell at seanet.com>
Date:   Sat Jan 5 07:50:35 2013 -0700

    Hypothesis: Remote Fedora test machine is using gaurd digits and
    thereby defeating the testing of the limits.hpp values.
    
    Solution: Make it harder for the complier to do this sort of
    optimizaiton, thereby removing gaurd digits from the calculations.

 cppad.spec |  105 +++++++++++++++++++++++++++++++++++++++++------------------
 1 files changed, 73 insertions(+), 32 deletions(-)
---
diff --git a/cppad.spec b/cppad.spec
index 389d573..91a6919 100644
--- a/cppad.spec
+++ b/cppad.spec
@@ -10,7 +10,7 @@
 
 Name: cppad
 Version: 20130000.0
-Release: 2%{?dist}
+Release: 3%{?dist}
 Summary: C++ Algorithmic Differentiation (AD), %{name}-devel and %{name}-doc
 
 # Only noarch.rpms provided.
@@ -65,37 +65,74 @@ as a single web page, in both HTML and XML, can be found at that web site.
 %setup -q 
 includedir=%{buildroot}%{_includedir}
 
-# patch epsilon.cpp in a way that may fix problem and that will
-# print debugging information.
-cat << EOF > epsilon.patch
-46,56c46,58
-< 	{	bool ok  = true;
-< 		using CppAD::epsilon;
-< 		using CppAD::abs;
-< 		Type eps   = CppAD::epsilon<Type>();
-< 		Type one   = 1;
-< 		Type two   = 2;
-< 		Type eps2  = eps / two; 
-< 		Type check = add_one(eps);
-< 		ok        &= one !=  check;
-< 		check      = add_one(eps2);
-< 		ok        &= one == check;
----
-> 	{	bool ok      = true;
-> 		static size_t count = 0;
-> 		CppAD::vector<Type> eps(1), one(1), two(1), eps2(1), check(1);
-> 		eps[0]   = CppAD::epsilon<Type>();
-> 		one[0]   = 1;
-> 		two[0]   = 2;
-> 		eps2[0]  = eps[0] / two[0]; 
-> 		check[0] = add_one(eps[0]);
-> 		ok      &= one[0] !=  check[0];
-> 		std::cout << "count = " << count++ << ", ok = " << ok << std::endl;
-> 		check[0] = add_one(eps2[0]);
-> 		ok      &= one[0] == check[0];
-> 		std::cout << "count = " << count++ << ", ok = " << ok << std::endl;
+# ---------------------------------------------------------------------------
+# This patch should not longer be necessary when %%{version} >= 20130000.0
+# Fedora test machines seem to use gauard digits instead of converting values 
+# to their numerical percision. Modify tests to avoid this. 
+cat << EOF > patch.sed
+/\\tbool *check_epsilon/! b end_check_epsilon
+N
+s|\\t{\\tbool *ok *= *true;|&\\
+\\t\\tCppAD::vector<Type> eps(1), one(1), two(1), eps2(1), check(1);|
+: end_check_epsilon
+#
+/\\tbool *check_min/! b end_check_min
+N
+s|\\t{\\tbool *ok *= *true;|&\\
+\\t\\tCppAD::vector<Type> min(1), eps(1), one(1), three(1), tmp(1), match(1);|
+: end_check_min
+#
+/\\tbool *check_max/! b end_check_max
+N
+s|\\t{\\tbool *ok *= *true;|&\\
+\\t\\tCppAD::vector<Type> max(1), eps(1), one(1), three(1), tmp(1), match(1);|
+: end_check_max
+#
+/\\tbool *check_max_complex/! b end_check_max_complex
+N
+s|\\t\\tbool *ok *= *true;|&\\
+\\t\\tCppAD::vector<Complex> c_max(1), c_eps(1);\\
+\\t\\tCppAD::vector<Type> max(1), eps(1), one(1), three(1), tmp(1), match(1);|
+: end_check_max_complex
+#
+s|\\t\\tComplex c_max *=|\\t\\tc_max[0]     =|
+s|\\t\\tComplex c_eps *=|\\t\\tc_eps[0]     =|
+s|c_max\\.|c_max[0]\\.|
+s|c_eps\\.|c_eps[0]\\.|
+#
+s|\\t\\tType min *=|\\t\\tmin[0]     =|
+s|\\t\\tType max *=|\\t\\tmax[0]     =|
+s|\\t\\tType eps *=|\\t\\teps[0]     =|
+s|\\t\\tType one *=|\\t\\tone[0]     =|
+s|\\t\\tType two *=|\\t\\ttwo[0]     =|
+s|\\t\\tType tmp *=|\\t\\ttmp[0]     =|
+s|\\t\\tType eps2 *=|\\t\\teps2[0]    =|
+s|\\t\\tType check *=|\\t\\tcheck[0]   =|
+s|\\t\\tType three *=|\\t\\tthree[0]   =|
+s|\\t\\tType match *=|\\t\\tmatch[0]   =|
+#
+s|\\t\\ttmp *=|\\t\\ttmp[0]     =|
+s|\\t\\tmatch *=|\\t\\tmatch[0]   =|
+s|\\t\\tcheck *=|\\t\\tcheck[0]   =|
+#
+#
+s|(eps)|(eps[0])|
+s|(eps2)|(eps2[0])|
+#
+s|\\([a-z][a-z]*\\) *\\([*/]\\) *\\([a-z][a-z]*\\)|\\1[0] \\2 \\3[0]|g
+s|\\([-+*/]\\) *\\([a-z][a-z]*\\)\\( *[;,)]\\)|\\1 \\2[0]\\3|
+s|\\([a-z][a-z]*\\) *\\([-+*/]\\)\\( *(\\)|\\1[0] \\2 \\3|
+#
+s|eps */ *two|eps[0] / two[0]|
+s|one *\\([!=]*\\) *check|one[0] \\1 check[0]|
+#
+# undo some changes that should not have been done
+s|<cppad\\[0\\] */ *cppad\\[0\\].hpp>|<cppad/cppad.hpp>|
+s|value\\[0\\]|value|
 EOF
-patch test_more/epsilon.cpp epsilon.patch
+sed -f patch.sed -i example/limits.cpp
+sed -f patch.sed -i test_more/epsilon.cpp
+# ---------------------------------------------------------------------------
 
 # Replace cppad_SOURCE_DIR by the system include directory so that
 # installed files, instead of local files, are used for testing.
@@ -103,7 +140,7 @@ sed \
 -e "s|\(INCLUDE_DIRECTORIES(\).*{cppad_SOURCE_DIR}|\1 SYSTEM $includedir|" \
 	-i.stamp CMakeLists.txt
 
-# This patch should not longer be necessary when %%{version} >= 20130000.2
+# This patch should not longer be necessary when %%{version} >= 20130000.0
 sed -e '/TARGET_LINK_LIBRARIES/d' \
 	-i.stamp speed/example/CMakeLists.txt
 
@@ -153,6 +190,10 @@ rm -rf %{buildroot}
 
 # ----------------------------------------------------------------------------
 %changelog
+* Sat Jan 05 2013 Brad Bell <bradbell at seanet dot com> - 20130000.0-3
+- The patch.sed script in this file is for a final test of a solution on the 
+- remote machine. Expect to modify upstream source so it is not necessary.
+
 * Fri Jan 04 2013 Brad Bell <bradbell at seanet dot com> - 20130000.0-2
 - Debugging build to try to understand failure of test_more/epsilon.cpp
 - on a remote machine that I do not have access to.


More information about the scm-commits mailing list