[Pythonmac-SIG] numarray 1.1.1 w/ vecLib (Apple's optimized implementation of BLAS)

Andrew Jaffe a.h.jaffe at gmail.com
Sun May 22 00:44:28 CEST 2005


Hi Bob,

Thanks for the quick response.

However, it seems that there are some bugs in the script, but you've  
inspired me to hunt for them.

First, the section of addons.py that checks for the existence of the  
framework (around line 47) needs to set lapack_dirs = [], I think,  
since it needs to exist later on.

Second, the section after that that sets lapack_compile_args,  
lapack_link_args and lapack_include_dirs for *all* cases (lines 57-60)  
overwrites lapack_link_args from the if...elif...else above.

Finally, cblas.h isn't included correctly, since the framework option  
is only used for linking, not compiling.

I assume this works, since:

~...archive/numarray-1.3.1% otool -L  
build/lib.darwin-7.9.0-Power_Macintosh-2.3/numarray/linear_algebra/ 
lapack_lite2.so
build/lib.darwin-7.9.0-Power_Macintosh-2.3/numarray/linear_algebra/ 
lapack_lite2.so:
         /System/Library/Frameworks/Python.framework/Versions/2.3/Python  
(compatibility version 2.3.0, current version 2.3.0)
         /System/Library/Frameworks/vecLib.framework/Versions/A/vecLib  
(compatibility version 1.0.0, current version 153.2.0)
         /usr/lib/libSystem.B.dylib (compatibility version 1.0.0,  
current version 71.1.3)


The overall solution to this was actually to reorder the sections and  
make some changes to the part that checks for veclib:

     # Set to list directories to be searched for BLAS and LAPACK  
libraries
     ##### MOVED FROM BELOW
     lapack_compile_args = []
     lapack_link_args = []
     lapack_include_dirs = ["Packages/LinearAlgebra2/Src"]

     if os.path.exists('/System/Library/Frameworks/vecLib.framework'):
         # use Apple's optimized BLAS implementation
         lapack_libs = []
         lapack_link_args = ['-framework', 'vecLib']
         lapack_compile_args = ['-framework', 'vecLib']  ### ADDED
         lapack_dirs = []                                ### ADDED
     elif USE_ABSOFT:  # Absoft Fortran
         lapack_dirs = ['/usr/local/lib/atlas', '/opt/absoft/lib']
         lapack_libs = ['lapack', 'f77blas', 'cblas', 'atlas',
                        'f90math', 'fio', 'f77math', 'm']
     else:
         lapack_dirs = ['/usr/local/lib/atlas']
         lapack_libs = ['lapack', 'cblas', 'f77blas', 'atlas', 'g2c',  
'm']

Feel free to use this if you do package it up. Is there any easy way to  
pass this on to the numarray people?

Give my regards to Berkeley (worked there for five years and just  
visited last month!)

Andrew


On 21 May 2005, at 22:11, Bob Ippolito wrote:

>
> On May 21, 2005, at 8:57 AM, Andrew Jaffe wrote:
>
>> Any chance of an updated package for numarray 1.3.1? (Or just hints on
>> fixing the installer which doesn't quite pick up veclib correctly, I
>> think!)?
>
> Unfortunately I'm out of town (in SF/Berkeley rather than NYC) for  
> about a month and don't have good access to a Panther machine (I only  
> brought my laptop, which runs Tiger).
>
> Looking at setup.py and addons.py (particularly addons.py) it looks  
> like it should pick up vecLib just fine.  You just need to say set the  
> USE_LAPACK environment variable prior to running setup.py, or specify  
> --use_lapack on the command line (it's a really really ugly hack that  
> generate.py does circumventing distutils.)
>
> -bob
>
>
______________________________________________________________________
Andrew Jaffe
Astrophysics Group                                    +44 207 594-7526
Blackett Laboratory, Room 1013                    FAX             7541
Imperial College, Prince Consort Road
London SW7 2AZ ENGLAND              http://astro.imperial.ac.uk/~jaffe



More information about the Pythonmac-SIG mailing list