[Numpy-discussion] numarray patch: use Apple's vecLib on Mac OS X

Andrew Straw strawman at astraw.com
Thu Nov 18 07:54:17 CST 2004


Hi all,

Here's a patch for numarray (against current CVS) to build using  
Apple's vecLib (optimized BLAS library) on Mac OS X.  This was inspired  
by/stolen from Bob Ippolito's recent Numeric patch (  
http://mail.python.org/pipermail/pythonmac-sig/2004-November/ 
012077.html ). To build with vecLib, set the environment variable  
USE_LAPACK=1.  I can test any modifications needed to incorporate this  
into the main release.  After building with this patch (both with and  
without vecLib) I ran Lib/testall.py with no problems -- are there more  
tests I should do?

Cheers!
Andrew

Index: addons.py
===================================================================
RCS file: /cvsroot/numpy/numarray/addons.py,v
retrieving revision 1.8
diff -c -r1.8 addons.py
*** addons.py	3 Nov 2004 15:06:33 -0000	1.8
--- addons.py	18 Nov 2004 15:43:01 -0000
***************
*** 24,31 ****
--- 24,33 ----
           os.path.join('Packages/LinearAlgebra2/Src', 'zlapack_lite.c'),
           os.path.join('Packages/LinearAlgebra2/Src', 'dlapack_lite.c')
           ]
+     lapack_include_dirs = ["Packages/LinearAlgebra2/Src",  
'Include/numarray']
       lapack_libs = []
       lapack_dirs = []
+     lapack_link_args = []
   else:
       sourcelist = [
           os.path.join('Packages/LinearAlgebra2/Src',  
'lapack_litemodule.c'),
***************
*** 53,58 ****
--- 55,70 ----

       # lapack_dirs = ['/home/jmiller/work/lib']

+     lapack_link_args = []
+     lapack_include_dirs = ["Packages/LinearAlgebra2/Src",  
'Include/numarray']
+
+     VECLIB_PATH = '/System/Library/Frameworks/vecLib.framework'
+     if os.path.exists(VECLIB_PATH):
+         lapack_link_args = ['-framework', 'vecLib']
+         lapack_include_dirs.append( os.path.join(VECLIB_PATH,  
'Headers'))
+         lapack_libs = []
+         lapack_dirs = []
+
   ADDONS_DATA_FILES = [('numarray/ma', ['Packages/MA/Legal.htm'])]

   ADDONS_PACKAGES = ["numarray.convolve",
***************
*** 102,110 ****
                 include_dirs =  
['Packages/FFT2/Include','Include/numarray']),
       Extension('numarray.linear_algebra.lapack_lite2',
                 sourcelist,
!               include_dirs = ["Packages/LinearAlgebra2/Src",  
'Include/numarray'],
                 library_dirs = lapack_dirs,
!               libraries = lapack_libs),
       Extension("numarray.random_array.ranlib2",
                 ["Packages/RandomArray2/Src/ranlib.c",
                  "Packages/RandomArray2/Src/ranlibmodule.c",
--- 114,124 ----
                 include_dirs =  
['Packages/FFT2/Include','Include/numarray']),
       Extension('numarray.linear_algebra.lapack_lite2',
                 sourcelist,
!               include_dirs = lapack_include_dirs,
                 library_dirs = lapack_dirs,
!               libraries = lapack_libs,
!               extra_link_args = lapack_link_args,
!               ),
       Extension("numarray.random_array.ranlib2",
                 ["Packages/RandomArray2/Src/ranlib.c",
                  "Packages/RandomArray2/Src/ranlibmodule.c",





More information about the Numpy-discussion mailing list