Bug#888220: ignition-math4: FTBFS on mips(el) and hppa: UNIT_Helpers_TEST fails badly

2018-04-02 Thread Jose Luis Rivero
Hello Emilio:

I'm working on fixing problems with the patch that appeared upstream with
g++ 6.x/g++ 7.x compilers
https://bitbucket.org/ignitionrobotics/ign-math/pull-requests/232/bug-in-pairing-function-insde-helperscc/diff#comment-59266386

My path should be ready today.

On Fri, Mar 30, 2018 at 6:51 PM, Emilio Pozuelo Monfort 
wrote:

> On Tue, 13 Feb 2018 15:15:22 -0800 Jose Luis Rivero <
> jriv...@openrobotics.org>
> wrote:
> > Thanks very much James for the research and the patch.
> >
> > I've sent it upstream:
> > https://bitbucket.org/ignitionrobotics/ign-math/
> pull-requests/232/bug-in-pairing-function-insde-helperscc/diff
>
> Can this be applied now? It's blocking sdformat builds on mips(el), which
> is in
> turn blocking some transitions.
>
> Thanks,
> Emilio
>
-- 
debian-science-maintainers mailing list
debian-science-maintainers@lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/debian-science-maintainers

Bug#888220: ignition-math4: FTBFS on mips(el) and hppa: UNIT_Helpers_TEST fails badly

2018-03-30 Thread Emilio Pozuelo Monfort
On Tue, 13 Feb 2018 15:15:22 -0800 Jose Luis Rivero 
wrote:
> Thanks very much James for the research and the patch.
> 
> I've sent it upstream:
> https://bitbucket.org/ignitionrobotics/ign-math/pull-requests/232/bug-in-pairing-function-insde-helperscc/diff

Can this be applied now? It's blocking sdformat builds on mips(el), which is in
turn blocking some transitions.

Thanks,
Emilio

-- 
debian-science-maintainers mailing list
debian-science-maintainers@lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/debian-science-maintainers


Bug#888220: ignition-math4: FTBFS on mips(el) and hppa: UNIT_Helpers_TEST fails badly

2018-01-24 Thread James Cowgill
Control: tags -1 patch

Hi,

On 23/01/18 23:48, Aaron M. Ucko wrote:
> Source: ignition-math4
> Version: 4.0.0+dfsg1-1
> Severity: important
> Tags: upstream
> Justification: fails to build from source
> User: debian-m...@lists.debian.org
> Usertags: mips mipsel
> 
> Builds of ignition-math4 for mips, mipsel, and the non-release
> architecture hppa have been failing as detailed at
> 
> https://buildd.debian.org/status/fetch.php?pkg=ignition-math4=mips=4.0.0%2Bdfsg1-1=1516376024=0
> https://buildd.debian.org/status/fetch.php?pkg=ignition-math4=mipsel=4.0.0%2Bdfsg1-1=1516373688=0
> https://buildd.debian.org/status/fetch.php?pkg=ignition-math4=hppa=4.0.0%2Bdfsg1-1=1516373442=0
> 
> On mips, this test manages to make ctest itself to run out of memory:
> 
> Start 11: UNIT_Helpers_TEST
>   terminate called after throwing an instance of 'std::bad_alloc'
> what():  std::bad_alloc
>   Makefile:143: recipe for target 'test' failed
>   make[2]: *** [test] Aborted
> 
> On mipsel and hppa, HelpersTest.Pair spews millions(!) of errors and
> then hits a timeout:
> 
>   11/75 Test #11: UNIT_Helpers_TEST ..***Timeout 240.12 
> sec
>   [...]
>   [ RUN  ] HelpersTest.Pair
>   /<>/ignition-math4-4.0.0+dfsg1/src/Helpers_TEST.cc:516: Failure
> Expected: a
> Which is: 4294962295
>   To be equal to: c
> Which is: 4294962296

This is caused by the pairing function in src/Helpers.cc

Firstly, I am not sure I understand why anyone would need this pairing
function exactly. The point of a pairing function is that the inputs can
be infinitely big, but the inputs to these functions are 32-bit
integers. As long as you don't need the specific algorithm, you could
implement something similar using a single shift and an add.

I think the issue is this code relies on infinite floating point
precision in calculating the "sqrt" variable:
> std::tuple Unpair(const PairOutput _key)
> {
>   // Must explicitly cast so that the _key is not auto cast to a double
>   uint64_t sqrt = static_cast(
>   std::floor(std::sqrt(static_cast(_key;
>   uint64_t sq = sqrt * sqrt;
> 
>   return ((_key - sq) >= sqrt) ?
> std::make_tuple(static_cast(sqrt),
> static_cast(_key - sq - sqrt)) :
> std::make_tuple(static_cast(_key - sq),
> static_cast(sqrt));
> }

On architectures with > 64-bit long doubles (like Linux x86_64) you get
away with this. On other architectures where long double == double, the
cast to long double and sqrt is too inaccurate to implement this properly.

The attached patch is based on a more accurate integer square root I
found on stack overflow. You should be able to drop your
0004_test_failures_in_non_x64_arches.patch after applying this and
possibly some other #ifdefs I noticed that upstream have added.

James
--- a/src/Helpers.cc
+++ b/src/Helpers.cc
@@ -38,9 +38,12 @@ namespace ignition
 /
 std::tuple Unpair(const PairOutput _key)
 {
-  // Must explicitly cast so that the _key is not auto cast to a double
-  uint64_t sqrt = static_cast(
-  std::floor(std::sqrt(static_cast(_key;
+  // Accurate 64-bit integer sqrt
+  //  From https://stackoverflow.com/a/18501209
+  uint64_t sqrt = static_cast(std::sqrt(_key) - 0x1p-20);
+  if (2 * sqrt < _key - sqrt * sqrt)
+sqrt++;
+
   uint64_t sq = sqrt * sqrt;
 
   return ((_key - sq) >= sqrt) ?


signature.asc
Description: OpenPGP digital signature
-- 
debian-science-maintainers mailing list
debian-science-maintainers@lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/debian-science-maintainers

Processed: Re: Bug#888220: ignition-math4: FTBFS on mips(el) and hppa: UNIT_Helpers_TEST fails badly

2018-01-24 Thread Debian Bug Tracking System
Processing control commands:

> tags -1 patch
Bug #888220 [src:ignition-math4] ignition-math4: FTBFS on mips(el) and hppa: 
UNIT_Helpers_TEST fails badly
Added tag(s) patch.

-- 
888220: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=888220
Debian Bug Tracking System
Contact ow...@bugs.debian.org with problems

-- 
debian-science-maintainers mailing list
debian-science-maintainers@lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/debian-science-maintainers


Bug#888220: ignition-math4: FTBFS on mips(el) and hppa: UNIT_Helpers_TEST fails badly

2018-01-23 Thread Aaron M. Ucko
Source: ignition-math4
Version: 4.0.0+dfsg1-1
Severity: important
Tags: upstream
Justification: fails to build from source
User: debian-m...@lists.debian.org
Usertags: mips mipsel

Builds of ignition-math4 for mips, mipsel, and the non-release
architecture hppa have been failing as detailed at

https://buildd.debian.org/status/fetch.php?pkg=ignition-math4=mips=4.0.0%2Bdfsg1-1=1516376024=0
https://buildd.debian.org/status/fetch.php?pkg=ignition-math4=mipsel=4.0.0%2Bdfsg1-1=1516373688=0
https://buildd.debian.org/status/fetch.php?pkg=ignition-math4=hppa=4.0.0%2Bdfsg1-1=1516373442=0

On mips, this test manages to make ctest itself to run out of memory:

Start 11: UNIT_Helpers_TEST
  terminate called after throwing an instance of 'std::bad_alloc'
what():  std::bad_alloc
  Makefile:143: recipe for target 'test' failed
  make[2]: *** [test] Aborted

On mipsel and hppa, HelpersTest.Pair spews millions(!) of errors and
then hits a timeout:

  11/75 Test #11: UNIT_Helpers_TEST ..***Timeout 240.12 sec
  [...]
  [ RUN  ] HelpersTest.Pair
  /<>/ignition-math4-4.0.0+dfsg1/src/Helpers_TEST.cc:516: Failure
Expected: a
Which is: 4294962295
  To be equal to: c
Which is: 4294962296
  [...]
  /<>/ignition-math4-4.0.0+dfsg1/src/Helpers_TEST.cc:516: Failure
Expected: a
Which is: 4294963544
  To be equal to: c
Which is: 4294963545
  
Start 12: check_UNIT_Helpers_TEST

(above output from mipsel, hppa is similar)

NB: the mipsel and hppa logs are a couple hundred megs apiece, so you
may wish to consider taking it easy on your browser by downloading raw
logs and viewing them with less. ;-)

Could you please take a look?

Thanks!

-- 
Aaron M. Ucko, KB1CJC (amu at alum.mit.edu, ucko at debian.org)
http://www.mit.edu/~amu/ | http://stuff.mit.edu/cgi/finger/?a...@monk.mit.edu

-- 
debian-science-maintainers mailing list
debian-science-maintainers@lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/debian-science-maintainers