[Numpy-tickets] [NumPy] #993: [PATCH] Support for detecting libraries in several directories simultaneously
NumPy
numpy-tickets@scipy....
Mon Feb 2 12:29:40 CST 2009
#993: [PATCH] Support for detecting libraries in several directories
simultaneously
-----------------------------+----------------------------------------------
Reporter: faltet | Owner: cookedm
Type: defect | Status: new
Priority: normal | Milestone: 1.3.0
Component: numpy.distutils | Version: none
Severity: normal | Keywords:
-----------------------------+----------------------------------------------
I've found a problem with `numpy.distutils` when I want to specify
multiple libraries for a !NumPy component that are spread in two or more
directories. For example, for linking against MKL, a `site.cfg` with the
next contents:
{{{
[mkl]
library_dirs =
/opt/intel/Compiler/11.0/074/mkl/lib/em64t/:/opt/intel/Compiler/11.0/074/lib/intel64
include_dirs = /opt/intel/Compiler/11.0/074/mkl/include/
mkl_libs = mkl_gf_lp64, mkl_gnu_thread, mkl_core, iomp5
}}}
gives the next output:
{{{
mkl_info:
libraries mkl_gf_lp64,mkl_gnu_thread,mkl_core,iomp5 not found in
/opt/intel/Compiler/11.0/074/mkl/lib/em64t/
libraries mkl_gf_lp64,mkl_gnu_thread,mkl_core,iomp5 not found in
/opt/intel/Compiler/11.0/074/lib/intel64
NOT AVAILABLE
}}}
I've tracked down the problem in that `numpy.distutils` tries to find the
complete set of libraries in one single directory, instead in the complete
list.
I'm attaching a fix that is able to find the set of required libraries in
all the directories specified in `library_dirs` and only in one of them.
With it, the output is:
{{{
mkl_info:
FOUND:
libraries = ['mkl_gf_lp64', 'mkl_gnu_thread', 'mkl_core', 'iomp5',
'pthread']
library_dirs = ['/opt/intel/Compiler/11.0/074/mkl/lib/em64t/',
'/opt/intel/Compiler/11.0/074/lib/intel64']
define_macros = [('SCIPY_MKL_H', None)]
include_dirs = ['/opt/intel/Compiler/11.0/074/mkl/include/']
}}}
So, it seems to work well. Moreover, the fix simplifies quite a bit the
logic in `system_info.py`. However, caveat emptor: as I've only tested
the MKL section, more testing should be carried out with other libraries
than MKL before to apply the patch.
Finally, attention should be payed to the next issue:
In `atlas_info.calc_info()` method, I've not completely simplified the
loop:
{{{
for d in lib_dirs:
atlas = self.check_libs2(d,atlas_libs,[])
lapack_atlas = self.check_libs2(d,['lapack_atlas'],[])
if atlas is not None:
lib_dirs2 = [d] +
self.combine_paths(d,['atlas*','ATLAS*'])
lapack = self.check_libs2(lib_dirs2,lapack_libs,[])
if lapack is not None:
break
if atlas:
atlas_1 = atlas
}}}
because I'm not sure about how can affect the use of
`self.combine_paths()` in the previous loop, but I'd say that it could be
rewritten as:
{{{
atlas = self.check_libs2(lib_dirs,atlas_libs,[])
lapack_atlas = self.check_libs2(lib_dirs,['lapack_atlas'],[])
if atlas is not None:
lib_dirs2 = [lib_dirs] +
self.combine_paths(lib_dirs,['atlas*','ATLAS*'])
lapack = self.check_libs2(lib_dirs2,lapack_libs,[])
atlas_1 = atlas
}}}
So, if anybody with more knowledge than me can double check the patch, it
would be great.
Thanks
--
Ticket URL: <http://scipy.org/scipy/numpy/ticket/993>
NumPy <http://projects.scipy.org/scipy/numpy>
The fundamental package needed for scientific computing with Python.
More information about the Numpy-tickets
mailing list