[Scipy-tickets] [SciPy] #1472: sparse.isolve solvers segfault in test suite

SciPy Trac scipy-tickets@scipy....
Fri Aug 19 01:44:25 CDT 2011


#1472: sparse.isolve solvers segfault in test suite
---------------------------------+------------------------------------------
 Reporter:  rgommers             |       Owner:  pv    
     Type:  defect               |      Status:  new   
 Priority:  high                 |   Milestone:  0.10.0
Component:  scipy.sparse.linalg  |     Version:  0.9.0 
 Keywords:  gmres                |  
---------------------------------+------------------------------------------

Comment(by rgommers):

 The fix should be something like this:
 {{{
 #!diff
 diff --git a/scipy/sparse/linalg/isolve/SConscript
 b/scipy/sparse/linalg/isolve/SConscript
 index 7aa589e..a0c3067 100644
 --- a/scipy/sparse/linalg/isolve/SConscript
 +++ b/scipy/sparse/linalg/isolve/SConscript
 @@ -6,7 +6,7 @@ from os.path import join as pjoin, splitext
  from numscons import GetNumpyEnvironment
  from numscons import CheckF77LAPACK

 -from numscons import write_info
 +from numscons import write_info, IsAccelerate, IsVeclib

  env = GetNumpyEnvironment(ARGUMENTS)
  env.Tool('f2py')
 @@ -53,4 +53,20 @@ for method in raw_sources:
      res = env.FromFTemplate(target, pjoin('iterative', method))
      sources.append(res[0])

 -env.NumpyPythonExtension('_iterative', source = sources)
 +#--------------------------------------------------
 +# BLAS wrapper to fix ABI incompatibilities on OS X
 +# -------------------------------------------------
 +use_c_calling = IsAccelerate(env, "lapack") or IsVeclib(env, "lapack")
 +
 +if use_c_calling:
 +    blas_wrapper += ['veclib_cabi_c.c.src', 'veclib_cabi_f.f.src']
 +else:
 +    blas_wrapper += ['dummy.f.src']
 +
 +for wrapper in blas_wrapper:
 +    target = splitext(wrapper)[0]
 +    res = env.FromFTemplate(target, pjoin('..', 'eigen', 'arpack',
 'ARPACK',
 +                                          'FWRAPPERS', wrapper))
 +    sources.append(res[0])
 +
 +env.NumpyPythonExtension('_iterative', source=sources)
 diff --git a/scipy/sparse/linalg/isolve/iterative/BiCGREVCOM.f.src
 b/scipy/sparse/linalg/isolve/iterative/BiCGREVCOM.f.s
 index 466d2bc..b6f3b88 100644
 --- a/scipy/sparse/linalg/isolve/iterative/BiCGREVCOM.f.src
 +++ b/scipy/sparse/linalg/isolve/iterative/BiCGREVCOM.f.src
 @@ -113,7 +113,7 @@
        <rt>   TOL, BNRM2, RHOTOL,
       $       <sdsd=s,d,s,d>GETBREAK,
       $       <rc=s,d,sc,dz>NRM2
 -      <_t>  ALPHA, BETA, RHO, RHO1, <xdot=sdot,ddot,cdotc,zdotc>
 +      <_t>  ALPHA, BETA, RHO, RHO1, <xdot=sdot,ddot,wcdotc,wzdotc>
  *
  *     indicates where to resume from. Only valid when IJOB = 2!
        INTEGER RLBL
 diff --git a/scipy/sparse/linalg/isolve/iterative/CGREVCOM.f.src
 b/scipy/sparse/linalg/isolve/iterative/CGREVCOM.f.src
 index 1a056fd..e2b4e54 100644
 --- a/scipy/sparse/linalg/isolve/iterative/CGREVCOM.f.src
 +++ b/scipy/sparse/linalg/isolve/iterative/CGREVCOM.f.src
 @@ -100,7 +100,7 @@
  *     .. Local Scalars ..
        INTEGER          MAXIT, R, Z, P, Q, NEED1, NEED2
        <_t>             ALPHA, BETA, RHO, RHO1,
 -     $     <xdot=sdot,ddot,cdotc,zdotc>
 +     $     <xdot=sdot,ddot,wcdotc,wzdotc>
        <rt>             <rc=s,d,sc,dz>NRM2, TOL
  *
  *     indicates where to resume from. Only valid when IJOB = 2!
 diff --git a/scipy/sparse/linalg/isolve/iterative/CGSREVCOM.f.src
 b/scipy/sparse/linalg/isolve/iterative/CGSREVCOM.f.src
 index f8b7831..9a71d7b 100644
 --- a/scipy/sparse/linalg/isolve/iterative/CGSREVCOM.f.src
 +++ b/scipy/sparse/linalg/isolve/iterative/CGSREVCOM.f.src
 @@ -118,7 +118,7 @@
       $       <rc=s,d,sc,dz>NRM2

        <_t>   ALPHA, BETA, RHO, RHO1, TMPVAL,
 -     $     <xdot=sdot,ddot,cdotc,zdotc>
 +     $     <xdot=sdot,ddot,wcdotc,wzdotc>
  *     ..
  *     indicates where to resume from. Only valid when IJOB = 2!
        INTEGER RLBL
 diff --git a/scipy/sparse/linalg/isolve/iterative/GMRESREVCOM.f.src
 b/scipy/sparse/linalg/isolve/iterative/GMRESREVCOM.f
 index a3e48d4..743c24e 100644
 --- a/scipy/sparse/linalg/isolve/iterative/GMRESREVCOM.f.src
 +++ b/scipy/sparse/linalg/isolve/iterative/GMRESREVCOM.f.src
 @@ -104,7 +104,7 @@
  *     .. Local Scalars ..
        INTEGER             I, MAXIT, AV, GIV, H, R, S, V, W, Y,
       $                    NEED1, NEED2
 -      <_t>  <xdot=sdot,ddot,cdotc,zdotc>
 +      <_t>  <xdot=sdot,ddot,wcdotc,wzdotc>
        <_t>  toz
        <_t>    TMPVAL
        <rt>    BNRM2, RNORM, TOL,
 @@ -416,7 +416,7 @@
        <rt=real,double precision,real,double precision>
       $     <rc=s,d,sc,dz>NRM2, ONE
        PARAMETER        ( ONE = 1.0D+0 )
 -      <_t>    <xdot=sdot,ddot,cdotc,zdotc>
 +      <_t>    <xdot=sdot,ddot,wcdotc,wzdotc>
        <_t>    TMPVAL
        EXTERNAL         <_c>AXPY, <_c>COPY, <xdot>, <rc>NRM2, <_c>SCAL
  *
 diff --git a/scipy/sparse/linalg/isolve/iterative/QMRREVCOM.f.src
 b/scipy/sparse/linalg/isolve/iterative/QMRREVCOM.f.src
 index 6da7c3a..ebc8ccb 100644
 --- a/scipy/sparse/linalg/isolve/iterative/QMRREVCOM.f.src
 +++ b/scipy/sparse/linalg/isolve/iterative/QMRREVCOM.f.src
 @@ -129,7 +129,7 @@

        <_t>   BETA, GAMMA, GAMMA1, DELTA, EPS, ETA, XI,
       $       RHO, RHO1, THETA, THETA1, C1, TMPVAL,
 -     $     <xdot=sdot,ddot,cdotc,zdotc>,
 +     $     <xdot=sdot,ddot,wcdotc,wzdotc>,
       $     toz
  *
  *     indicates where to resume from. Only valid when IJOB = 2!
 }}}
 I'm not sure though how best to re-use those veclib wrappers.  Can they be
 recompiled (what's the right distutils/numscons incantation?), should the
 sources be duplicated under isolve/, or should _iterative.so link against
 the arpack library?

-- 
Ticket URL: <http://projects.scipy.org/scipy/ticket/1472#comment:25>
SciPy <http://www.scipy.org>
SciPy is open-source software for mathematics, science, and engineering.


More information about the Scipy-tickets mailing list