You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by Thomas Neidhart <th...@gmail.com> on 2015/02/24 20:56:15 UTC

[math] Test failures after switch to Java 1.7

Hi,

after switching to Java 1.7 there seems to be another problem with
FastMath, see the two test failures below when running on jenkins.

Can somebody reproduce it on a 64 bit machine (I just have a 32 bit
laptop at home)?

Test setup: Java 7 latest (1.7.0_75?), maven 3.1.1.

Tests run: 65, Failures: 1, Errors: 0, Skipped: 1, Time elapsed: 13.332
sec <<< FAILURE! - in org.apache.commons.math4.util.FastMathTest
testPowSpecialCases(org.apache.commons.math4.util.FastMathTest)  Time
elapsed: 0.007 sec  <<< FAILURE!
java.lang.AssertionError: pow(0.5, Infinity) should be 0.0
expected:<0.0> but was:<Infinity>
	at org.junit.Assert.fail(Assert.java:88)
	at org.junit.Assert.failNotEquals(Assert.java:743)
	at org.junit.Assert.assertEquals(Assert.java:494)
	at
org.apache.commons.math4.util.FastMathTest.testPowSpecialCases(FastMathTest.java:372)

Running org.apache.commons.math4.util.FastMathStrictComparisonTest
Tests run: 53, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 0.037
sec <<< FAILURE! - in
org.apache.commons.math4.util.FastMathStrictComparisonTest
test1[37](org.apache.commons.math4.util.FastMathStrictComparisonTest)
Time elapsed: 0 sec  <<< FAILURE!
java.lang.AssertionError: double pow(-0.0, NaN) expected NaN actual
-Infinity entries [1, 3]
	at org.junit.Assert.fail(Assert.java:88)
	at
org.apache.commons.math4.util.FastMathStrictComparisonTest.reportFailedResults(FastMathStrictComparisonTest.java:158)
	at
org.apache.commons.math4.util.FastMathStrictComparisonTest.callMethods(FastMathStrictComparisonTest.java:182)
	at
org.apache.commons.math4.util.FastMathStrictComparisonTest.setupMethodCall(FastMathStrictComparisonTest.java:204)
	at
org.apache.commons.math4.util.FastMathStrictComparisonTest.test1(FastMathStrictComparisonTest.java:92)

Thomas

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org


Re: [math] Test failures after switch to Java 1.7

Posted by Thomas Neidhart <th...@gmail.com>.
Running the tests with diagnostic options enabled, I see the following:

Running org.apache.commons.math4.analysis.integration.gauss.HermiteParametricTest
Compiled method (c2)   25704  794
org.apache.commons.math4.util.FastMath::pow (635 bytes)
 total in heap  [0xf37f3ac8,0xf37f4bc0] = 4344
 relocation     [0xf37f3b90,0xf37f3ca0] = 272
 constants      [0xf37f3ca0,0xf37f3d20] = 128
 main code      [0xf37f3d20,0xf37f42c0] = 1440
 stub code      [0xf37f42c0,0xf37f4318] = 88
 oops           [0xf37f4318,0xf37f4324] = 12
 scopes data    [0xf37f4324,0xf37f45cc] = 680
 scopes pcs     [0xf37f45cc,0xf37f4afc] = 1328
 dependencies   [0xf37f4afc,0xf37f4b00] = 4
 handler table  [0xf37f4b00,0xf37f4bc0] = 192
Could not load hsdis-i386.so; library not loadable; PrintAssembly is disabled
OopMapSet contains 8 OopMaps
#0
OopMap{off=484}
#1
OopMap{off=500}
#2
OopMap{ebp=Oop off=596}
#3
OopMap{off=808}
#4
OopMap{off=924}
#5
OopMap{off=964}
#6
OopMap{off=1088}
#7
OopMap{off=1208}

later on the method is recompiled (reduced in size):

Running org.apache.commons.math4.analysis.differentiation.DerivativeStructureTest
Compiled method (c2)   40169  941
org.apache.commons.math4.util.FastMath::pow (257 bytes)
 total in heap  [0xf37b6148,0xf37b6708] = 1472
 relocation     [0xf37b6210,0xf37b6230] = 32
 constants      [0xf37b6240,0xf37b6260] = 32
 main code      [0xf37b6260,0xf37b6420] = 448
 stub code      [0xf37b6420,0xf37b6430] = 16
 oops           [0xf37b6430,0xf37b6434] = 4
 scopes data    [0xf37b6434,0xf37b6524] = 240
 scopes pcs     [0xf37b6524,0xf37b6704] = 480
 dependencies   [0xf37b6704,0xf37b6708] = 4
OopMapSet contains 1 OopMaps
#0
OopMap{off=389}

afterwards the failing tests run:

Tests run: 53, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 0.034
sec <<< FAILURE! - in
org.apache.commons.math4.util.FastMathStrictComparisonTest
test1[37](org.apache.commons.math4.util.FastMathStrictComparisonTest)
Time elapsed: 0.005 sec  <<< FAILURE!
java.lang.AssertionError: double pow(-0.0, -Infinity) expected
Infinity actual 0.0 entries [1, 4]
	at org.junit.Assert.fail(Assert.java:88)
	at org.apache.commons.math4.util.FastMathStrictComparisonTest.reportFailedResults(FastMathStrictComparisonTest.java:158)
	at org.apache.commons.math4.util.FastMathStrictComparisonTest.callMethods(FastMathStrictComparisonTest.java:182)
	at org.apache.commons.math4.util.FastMathStrictComparisonTest.setupMethodCall(FastMathStrictComparisonTest.java:204)
	at org.apache.commons.math4.util.FastMathStrictComparisonTest.test1(FastMathStrictComparisonTest.java:92)



On Wed, Feb 25, 2015 at 10:40 AM, Thomas Neidhart <thomas.neidhart@gmail.com
> wrote:

> I wonder if in this case the problem is related to branch prediction or
> instruction re-ordering.
>
> The FastMath.pow() method has a lot of ifs to handle special cases, but
> they are all independent and and handled in sequence. No results are
> calculated or stored in them, so the JVM might wrongly assume that it can
> safely re-order them in a more efficient way.
>
> I will try to express the special cases using if / else instead and run a
> test to see if this changes the result.
>
>
> On Wed, Feb 25, 2015 at 3:09 AM, sebb <se...@gmail.com> wrote:
>
>> Might be worth running a version of the test with JIT disabled.
>> This will make the test much longer so I suggest first seeing if the
>> tests fail on their own, and then disable JIT.
>> You could experiment with the additional Jenkins Math job I set up for
>> the H10 tests:
>>
>> https://builds.apache.org/job/Commons%20Math%20H10/
>>
>> On 24 February 2015 at 19:56, Thomas Neidhart <th...@gmail.com>
>> wrote:
>> > Hi,
>> >
>> > after switching to Java 1.7 there seems to be another problem with
>> > FastMath, see the two test failures below when running on jenkins.
>> >
>> > Can somebody reproduce it on a 64 bit machine (I just have a 32 bit
>> > laptop at home)?
>> >
>> > Test setup: Java 7 latest (1.7.0_75?), maven 3.1.1.
>> >
>> > Tests run: 65, Failures: 1, Errors: 0, Skipped: 1, Time elapsed: 13.332
>> > sec <<< FAILURE! - in org.apache.commons.math4.util.FastMathTest
>> > testPowSpecialCases(org.apache.commons.math4.util.FastMathTest)  Time
>> > elapsed: 0.007 sec  <<< FAILURE!
>> > java.lang.AssertionError: pow(0.5, Infinity) should be 0.0
>> > expected:<0.0> but was:<Infinity>
>> >         at org.junit.Assert.fail(Assert.java:88)
>> >         at org.junit.Assert.failNotEquals(Assert.java:743)
>> >         at org.junit.Assert.assertEquals(Assert.java:494)
>> >         at
>> >
>> org.apache.commons.math4.util.FastMathTest.testPowSpecialCases(FastMathTest.java:372)
>> >
>> > Running org.apache.commons.math4.util.FastMathStrictComparisonTest
>> > Tests run: 53, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 0.037
>> > sec <<< FAILURE! - in
>> > org.apache.commons.math4.util.FastMathStrictComparisonTest
>> > test1[37](org.apache.commons.math4.util.FastMathStrictComparisonTest)
>> > Time elapsed: 0 sec  <<< FAILURE!
>> > java.lang.AssertionError: double pow(-0.0, NaN) expected NaN actual
>> > -Infinity entries [1, 3]
>> >         at org.junit.Assert.fail(Assert.java:88)
>> >         at
>> >
>> org.apache.commons.math4.util.FastMathStrictComparisonTest.reportFailedResults(FastMathStrictComparisonTest.java:158)
>> >         at
>> >
>> org.apache.commons.math4.util.FastMathStrictComparisonTest.callMethods(FastMathStrictComparisonTest.java:182)
>> >         at
>> >
>> org.apache.commons.math4.util.FastMathStrictComparisonTest.setupMethodCall(FastMathStrictComparisonTest.java:204)
>> >         at
>> >
>> org.apache.commons.math4.util.FastMathStrictComparisonTest.test1(FastMathStrictComparisonTest.java:92)
>> >
>> > Thomas
>> >
>> > ---------------------------------------------------------------------
>> > To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
>> > For additional commands, e-mail: dev-help@commons.apache.org
>> >
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
>> For additional commands, e-mail: dev-help@commons.apache.org
>>
>>
>

Re: [math] Test failures after switch to Java 1.7

Posted by Thomas Neidhart <th...@gmail.com>.
I wonder if in this case the problem is related to branch prediction or
instruction re-ordering.

The FastMath.pow() method has a lot of ifs to handle special cases, but
they are all independent and and handled in sequence. No results are
calculated or stored in them, so the JVM might wrongly assume that it can
safely re-order them in a more efficient way.

I will try to express the special cases using if / else instead and run a
test to see if this changes the result.


On Wed, Feb 25, 2015 at 3:09 AM, sebb <se...@gmail.com> wrote:

> Might be worth running a version of the test with JIT disabled.
> This will make the test much longer so I suggest first seeing if the
> tests fail on their own, and then disable JIT.
> You could experiment with the additional Jenkins Math job I set up for
> the H10 tests:
>
> https://builds.apache.org/job/Commons%20Math%20H10/
>
> On 24 February 2015 at 19:56, Thomas Neidhart <th...@gmail.com>
> wrote:
> > Hi,
> >
> > after switching to Java 1.7 there seems to be another problem with
> > FastMath, see the two test failures below when running on jenkins.
> >
> > Can somebody reproduce it on a 64 bit machine (I just have a 32 bit
> > laptop at home)?
> >
> > Test setup: Java 7 latest (1.7.0_75?), maven 3.1.1.
> >
> > Tests run: 65, Failures: 1, Errors: 0, Skipped: 1, Time elapsed: 13.332
> > sec <<< FAILURE! - in org.apache.commons.math4.util.FastMathTest
> > testPowSpecialCases(org.apache.commons.math4.util.FastMathTest)  Time
> > elapsed: 0.007 sec  <<< FAILURE!
> > java.lang.AssertionError: pow(0.5, Infinity) should be 0.0
> > expected:<0.0> but was:<Infinity>
> >         at org.junit.Assert.fail(Assert.java:88)
> >         at org.junit.Assert.failNotEquals(Assert.java:743)
> >         at org.junit.Assert.assertEquals(Assert.java:494)
> >         at
> >
> org.apache.commons.math4.util.FastMathTest.testPowSpecialCases(FastMathTest.java:372)
> >
> > Running org.apache.commons.math4.util.FastMathStrictComparisonTest
> > Tests run: 53, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 0.037
> > sec <<< FAILURE! - in
> > org.apache.commons.math4.util.FastMathStrictComparisonTest
> > test1[37](org.apache.commons.math4.util.FastMathStrictComparisonTest)
> > Time elapsed: 0 sec  <<< FAILURE!
> > java.lang.AssertionError: double pow(-0.0, NaN) expected NaN actual
> > -Infinity entries [1, 3]
> >         at org.junit.Assert.fail(Assert.java:88)
> >         at
> >
> org.apache.commons.math4.util.FastMathStrictComparisonTest.reportFailedResults(FastMathStrictComparisonTest.java:158)
> >         at
> >
> org.apache.commons.math4.util.FastMathStrictComparisonTest.callMethods(FastMathStrictComparisonTest.java:182)
> >         at
> >
> org.apache.commons.math4.util.FastMathStrictComparisonTest.setupMethodCall(FastMathStrictComparisonTest.java:204)
> >         at
> >
> org.apache.commons.math4.util.FastMathStrictComparisonTest.test1(FastMathStrictComparisonTest.java:92)
> >
> > Thomas
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
> > For additional commands, e-mail: dev-help@commons.apache.org
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
> For additional commands, e-mail: dev-help@commons.apache.org
>
>

Re: [math] Test failures after switch to Java 1.7

Posted by sebb <se...@gmail.com>.
Might be worth running a version of the test with JIT disabled.
This will make the test much longer so I suggest first seeing if the
tests fail on their own, and then disable JIT.
You could experiment with the additional Jenkins Math job I set up for
the H10 tests:

https://builds.apache.org/job/Commons%20Math%20H10/

On 24 February 2015 at 19:56, Thomas Neidhart <th...@gmail.com> wrote:
> Hi,
>
> after switching to Java 1.7 there seems to be another problem with
> FastMath, see the two test failures below when running on jenkins.
>
> Can somebody reproduce it on a 64 bit machine (I just have a 32 bit
> laptop at home)?
>
> Test setup: Java 7 latest (1.7.0_75?), maven 3.1.1.
>
> Tests run: 65, Failures: 1, Errors: 0, Skipped: 1, Time elapsed: 13.332
> sec <<< FAILURE! - in org.apache.commons.math4.util.FastMathTest
> testPowSpecialCases(org.apache.commons.math4.util.FastMathTest)  Time
> elapsed: 0.007 sec  <<< FAILURE!
> java.lang.AssertionError: pow(0.5, Infinity) should be 0.0
> expected:<0.0> but was:<Infinity>
>         at org.junit.Assert.fail(Assert.java:88)
>         at org.junit.Assert.failNotEquals(Assert.java:743)
>         at org.junit.Assert.assertEquals(Assert.java:494)
>         at
> org.apache.commons.math4.util.FastMathTest.testPowSpecialCases(FastMathTest.java:372)
>
> Running org.apache.commons.math4.util.FastMathStrictComparisonTest
> Tests run: 53, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 0.037
> sec <<< FAILURE! - in
> org.apache.commons.math4.util.FastMathStrictComparisonTest
> test1[37](org.apache.commons.math4.util.FastMathStrictComparisonTest)
> Time elapsed: 0 sec  <<< FAILURE!
> java.lang.AssertionError: double pow(-0.0, NaN) expected NaN actual
> -Infinity entries [1, 3]
>         at org.junit.Assert.fail(Assert.java:88)
>         at
> org.apache.commons.math4.util.FastMathStrictComparisonTest.reportFailedResults(FastMathStrictComparisonTest.java:158)
>         at
> org.apache.commons.math4.util.FastMathStrictComparisonTest.callMethods(FastMathStrictComparisonTest.java:182)
>         at
> org.apache.commons.math4.util.FastMathStrictComparisonTest.setupMethodCall(FastMathStrictComparisonTest.java:204)
>         at
> org.apache.commons.math4.util.FastMathStrictComparisonTest.test1(FastMathStrictComparisonTest.java:92)
>
> Thomas
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
> For additional commands, e-mail: dev-help@commons.apache.org
>

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org


Re: [math] Test failures after switch to Java 1.7

Posted by Phil Steitz <ph...@gmail.com>.
On 2/24/15 12:56 PM, Thomas Neidhart wrote:

Interesting.  I could not get this to happen on

OSX:
java version "1.7.0_71"
Java(TM) SE Runtime Environment (build 1.7.0_71-b14)
Java HotSpot(TM) 64-Bit Server VM (build 24.71-b01, mixed mode)

java version "1.8.0_11"
Java(TM) SE Runtime Environment (build 1.8.0_11-b12)
Java HotSpot(TM) 64-Bit Server VM (build 25.11-b03, mixed mode)

Ubuntu:
java version "1.7.0_21"
Java(TM) SE Runtime Environment (build 1.7.0_21-b11)
Java HotSpot(TM) 64-Bit Server VM (build 23.21-b01, mixed mode)

FastMath tests from master all run clean for me using JDKs above.  

Phil

> Hi,
>
> after switching to Java 1.7 there seems to be another problem with
> FastMath, see the two test failures below when running on jenkins.
>
> Can somebody reproduce it on a 64 bit machine (I just have a 32 bit
> laptop at home)?
>
> Test setup: Java 7 latest (1.7.0_75?), maven 3.1.1.
>
> Tests run: 65, Failures: 1, Errors: 0, Skipped: 1, Time elapsed: 13.332
> sec <<< FAILURE! - in org.apache.commons.math4.util.FastMathTest
> testPowSpecialCases(org.apache.commons.math4.util.FastMathTest)  Time
> elapsed: 0.007 sec  <<< FAILURE!
> java.lang.AssertionError: pow(0.5, Infinity) should be 0.0
> expected:<0.0> but was:<Infinity>
> 	at org.junit.Assert.fail(Assert.java:88)
> 	at org.junit.Assert.failNotEquals(Assert.java:743)
> 	at org.junit.Assert.assertEquals(Assert.java:494)
> 	at
> org.apache.commons.math4.util.FastMathTest.testPowSpecialCases(FastMathTest.java:372)
>
> Running org.apache.commons.math4.util.FastMathStrictComparisonTest
> Tests run: 53, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 0.037
> sec <<< FAILURE! - in
> org.apache.commons.math4.util.FastMathStrictComparisonTest
> test1[37](org.apache.commons.math4.util.FastMathStrictComparisonTest)
> Time elapsed: 0 sec  <<< FAILURE!
> java.lang.AssertionError: double pow(-0.0, NaN) expected NaN actual
> -Infinity entries [1, 3]
> 	at org.junit.Assert.fail(Assert.java:88)
> 	at
> org.apache.commons.math4.util.FastMathStrictComparisonTest.reportFailedResults(FastMathStrictComparisonTest.java:158)
> 	at
> org.apache.commons.math4.util.FastMathStrictComparisonTest.callMethods(FastMathStrictComparisonTest.java:182)
> 	at
> org.apache.commons.math4.util.FastMathStrictComparisonTest.setupMethodCall(FastMathStrictComparisonTest.java:204)
> 	at
> org.apache.commons.math4.util.FastMathStrictComparisonTest.test1(FastMathStrictComparisonTest.java:92)
>
> Thomas
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
> For additional commands, e-mail: dev-help@commons.apache.org
>
>



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org