Ticket #2303 (closed defect: fixed)

Opened 7 months ago

Last modified 3 months ago

[with spkg, positive review] bessel_I(1,1,"scipy") segfaults with gcc 4.2.3 on Linux x86

Reported by: mabshoff Assigned to: mabshoff
Priority: blocker Milestone: sage-3.0.5
Component: doctest Keywords:
Cc:

Description

Kate reports in https://groups.google.com/group/sage-support/browse_thread/thread/f7bc183b6f052943/70f4b300f5be3d13#70f4b300f5be3d13

When I build 2.10.2 from source on my
x86-Linux box (pentium4-fc6) using gcc-4.2.3,
I get a 'make check' failure at

./sage -t devel/sage-main/sage/functions/special.py

sh: line 1:  3345 Illegal instruction     /home/kate/sage/sage-2.10.2-
x86-Linux/local/bin/python .doctest_special.py >.doctest/out
2>.doctest/err

A mysterious error (perphaps a memory error?) occurred, which may have
crashed doctest.
         [3.6 s]
exit code: 256

The offending line seems to be

sage: bessel_I(1,1,"scipy")
/home/kate/sage/sage-2.10.2-x86-Linux/local/bin/sage-sage: line 212:
3484 Illegal instruction     sage-ipython -c "$SAGE_STARTUP_COMMAND;"
"$@"

Kate 

Cheers,

Michael

Attachments

2303-scipy-bessel.patch (1.4 kB) - added by robertwb on 07/08/2008 04:55:51 PM.

Change History

02/25/2008 01:24:06 PM changed by mabshoff

  • status changed from new to assigned.

02/25/2008 01:36:54 PM changed by was

If anybody can reproduce this, e.g., has a P4 computer, please post here. The temporary solution will be to disable the scipy option for bessel_l, then report this upstream (with a gdb traceback?) to scipy.

03/08/2008 12:35:16 PM changed by jason

Using Sage 2.10.2 on this computer (Ubuntu 7.10, 32-bit):

vendor_id       : GenuineIntel
cpu family      : 15
model           : 4
model name      : Intel(R) Pentium(R) 4 CPU 3.80GHz
stepping        : 1
cpu MHz         : 3790.991
cache size      : 1024 KB

$ gcc -v
Using built-in specs.
Target: i486-linux-gnu
Configured with: ../src/configure -v --enable-languages=c,c++,fortran,objc,obj-c++,treelang --prefix=/usr --enable-shared --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --enable-nls --with-gxx-include-dir=/usr/include/c++/4.1.3 --program-suffix=-4.1 --enable-__cxa_atexit --enable-clocale=gnu --enable-libstdcxx-debug --enable-mpfr --enable-checking=release i486-linux-gnu
Thread model: posix
gcc version 4.1.3 20070929 (prerelease) (Ubuntu 4.1.2-16ubuntu2)

the doctest passes:

$ sage -t sage/devel/sage-main/sage/functions/special.py 
sage -t  sage/devel/sage-main/sage/functions/special.py     
         [7.3 s]
 
----------------------------------------------------------------------
All tests passed!
Total time for all tests: 7.3 seconds

and I get:

sage: bessel_I(1,1,"scipy")
0.565159103992000

03/12/2008 01:11:45 PM changed by was

  • milestone changed from sage-2.11 to sage-2.10.4.

07/08/2008 03:58:37 PM changed by mabshoff

  • milestone changed from sage-3.0.6 to sage-3.0.5.

We can finally replicate the problem:

(gdb) bt
#0  0x02e474ac in dgamln_ () from /tmp/foo/sage-3.0.4.rc0-x86-Linux-fc8/local/lib/python/site-packages/scipy/special/_cephes.so
#1  0x0028bbc9 in log () from /lib/libm.so.6
#2  0x40000000 in ?? ()

William says:

William:  here is the sage-free version to replicate the problem:
scipy.special.iv(float(1),complex(1,0))

Cheers,

Michael

07/08/2008 04:55:51 PM changed by robertwb

  • attachment 2303-scipy-bessel.patch added.

07/08/2008 04:56:53 PM changed by robertwb

After discussing with William Stein, we are disabling this option. Note that if one wants to use it it is much faster to directly call scypy.special.iv.

07/08/2008 05:52:14 PM changed by was

  • summary changed from bessel_I(1,1,"scipy") segfaults with gcc 4.2.3 on Linux x86 to [with patch; needs review] bessel_I(1,1,"scipy") segfaults with gcc 4.2.3 on Linux x86.

07/08/2008 06:08:47 PM changed by was

  • summary changed from [with patch; needs review] bessel_I(1,1,"scipy") segfaults with gcc 4.2.3 on Linux x86 to bessel_I(1,1,"scipy") segfaults with gcc 4.2.3 on Linux x86.

Robert's patch is unfortunately no good because there are *dozens* of different special functions that crash from scipy. We can't release something that is this broken.

So no solution to this yet.

07/08/2008 06:10:30 PM changed by robertwb

In that case we should probably not bother applying this ticket at all.

07/09/2008 09:26:37 AM changed by mabshoff

Having poked around the solution might be to disabled the "-fwrapv" build option for Python. We already do that on Itanium since it caused numerous unexplained doctest failures.

Cheers,

Michael

07/11/2008 10:46:03 AM changed by mabshoff

  • milestone changed from sage-3.0.6 to sage-3.0.5.

It is not a -fwrapv issue, but I have a patch coming up.

Cheers,

Michael

07/11/2008 11:25:33 AM changed by mabshoff

With the new spkg the following three doctests that used to segfault all due to illegal instruction now pass:

[mabshoff@cicero sage-3.0.4-x86-Linux-fc8]$ ./sage -t  devel/sage/sage/plot/plot3d/list_plot3d.py
sage -t  devel/sage/sage/plot/plot3d/list_plot3d.py         
	 [6.3 s]
 
----------------------------------------------------------------------
All tests passed!
Total time for all tests: 6.3 seconds
[mabshoff@cicero sage-3.0.4-x86-Linux-fc8]$ ./sage -t  devel/sage/sage/finance/time_series.pyx
sage -t  devel/sage/sage/finance/time_series.pyx            
	 [15.1 s]
 
----------------------------------------------------------------------
All tests passed!
Total time for all tests: 15.1 seconds
[mabshoff@cicero sage-3.0.4-x86-Linux-fc8]$ ./sage -t devel/sage/sage/functions/special.py 
sage -t  devel/sage/sage/functions/special.py               
	 [8.2 s]
 
----------------------------------------------------------------------
All tests passed!
Total time for all tests: 8.2 seconds

Cheers,

Michael

07/11/2008 11:27:21 AM changed by mabshoff

  • summary changed from bessel_I(1,1,"scipy") segfaults with gcc 4.2.3 on Linux x86 to [with spkg, needs revivew] bessel_I(1,1,"scipy") segfaults with gcc 4.2.3 on Linux x86.

07/11/2008 11:53:12 AM changed by was

  • status changed from assigned to closed.
  • resolution set to fixed.
  • summary changed from [with spkg, needs revivew] bessel_I(1,1,"scipy") segfaults with gcc 4.2.3 on Linux x86 to [with spkg, positive review] bessel_I(1,1,"scipy") segfaults with gcc 4.2.3 on Linux x86.