Repository: numpy/numpy

Issue:
Support atlas 3.10
With atlas 3.10 the library names have changed, either libsatlas for serial or libtatlas for threaded.



Discussion:
I guess this already works if you provide the right name in site.cfg? So the issue is to fix the autodetection in `distutils/system_info.py`?

Actually, it doesn't work with this in site.cfg either:

```
[blas_opt]
libraries = tatlas
#
[lapack_opt]
libraries = tatlas
```

Okay, I can override with:

```
[atlas]
library_dirs = /usr/lib64/atlas
atlas_libs = tatlas
```

but site.cfg states that  [atlas] is deprecated and should not be used.

As Orion wrote, there is a [section](https://github.com/numpy/numpy/blob/maintenance/1.7.x/site.cfg.example#L70) in site.cfg.example in numpy 1.7 which states that using `[atlas]`, `[lapack_atlas]`, etc. is deprecated. As I checked master, [this](https://github.com/numpy/numpy/blob/master/site.cfg.example#L66) warning is gone and in fact using section `[atlas]` is recommended. (This [commit](https://github.com/numpy/numpy/commit/ffd4332262ee0295cb942c94ed124f043d801eb6) changed it.)

So I guess that Orion's solution is correct.

Does `site.cfg.example` need some documentation about 3.10?

With just:

```
$ cat numpy-1.8.0rc2/site.cfg
[atlas]
library_dirs = /usr/lib64/atlas
atlas_libs = satlas
```

I get:

```
Python 2.7.5 (default, Oct  8 2013, 12:16:00)
[GCC 4.8.1 20130920 (Red Hat 4.8.1-10)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from numpy.distutils.system_info import get_info
>>> get_info('atlas', 0)
/usr/lib64/python2.7/site-packages/numpy/distutils/system_info.py:1062: UserWarning:
*********************************************************************
    Could not find lapack library within the ATLAS installation.
*********************************************************************

  warnings.warn(message)
{'libraries': ['satlas'], 'library_dirs': ['/usr/lib64/atlas'], 'define_macros': [('ATLAS_WITHOUT_LAPACK', None)], 'language': 'c', 'include_dirs': ['/usr/include']}
```

Is there some way to tell numpy that lapack is in there?

Any change here?

Hmm, seems the change was in ATLAS 3.9.33 released 01/21/11, so we should probably fix this in numpy.


Resolving patch:
diff --git a/numpy/distutils/system_info.py b/numpy/distutils/system_info.py
--- a/numpy/distutils/system_info.py
+++ b/numpy/distutils/system_info.py
@@ -10,6 +10,13 @@
   atlas_blas_info
   atlas_blas_threads_info
   lapack_atlas_info
+  lapack_atlas_threads_info
+  atlas_3_10_info
+  atlas_3_10_threads_info
+  atlas_3_10_blas_info,
+  atlas_3_10_blas_threads_info,
+  lapack_atlas_3_10_info
+  lapack_atlas_3_10_threads_info
   blas_info
   lapack_info
   openblas_info
@@ -302,6 +309,12 @@ def get_info(name, notfound_action=0):
           'atlas_blas_threads': atlas_blas_threads_info,
           'lapack_atlas': lapack_atlas_info,  # use lapack_opt instead
           'lapack_atlas_threads': lapack_atlas_threads_info,  # ditto
+          'atlas_3_10': atlas_3_10_info,  # use lapack_opt or blas_opt instead
+          'atlas_3_10_threads': atlas_3_10_threads_info,                # ditto
+          'atlas_3_10_blas': atlas_3_10_blas_info,
+          'atlas_3_10_blas_threads': atlas_3_10_blas_threads_info,
+          'lapack_atlas_3_10': lapack_atlas_3_10_info,  # use lapack_opt instead
+          'lapack_atlas_3_10_threads': lapack_atlas_3_10_threads_info,  # ditto
           'mkl': mkl_info,
           # openblas which may or may not have embedded lapack
           'openblas': openblas_info,          # use blas_opt instead
@@ -1148,6 +1161,63 @@ class lapack_atlas_threads_info(atlas_threads_info):
     _lib_names = ['lapack_atlas'] + atlas_threads_info._lib_names
 
 
+class atlas_3_10_info(atlas_info):
+    _lib_names = ['satlas']
+    _lib_atlas = _lib_names
+    _lib_lapack = _lib_names
+
+
+class atlas_3_10_blas_info(atlas_3_10_info):
+    _lib_names = ['satlas']
+
+    def calc_info(self):
+        lib_dirs = self.get_lib_dirs()
+        info = {}
+        atlas_libs = self.get_libs('atlas_libs',
+                                   self._lib_names)
+        atlas = self.check_libs2(lib_dirs, atlas_libs, [])
+        if atlas is None:
+            return
+        include_dirs = self.get_include_dirs()
+        h = (self.combine_paths(lib_dirs + include_dirs, 'cblas.h') or [None])
+        h = h[0]
+        if h:
+            h = os.path.dirname(h)
+            dict_append(info, include_dirs=[h])
+        info['language'] = 'c'
+        info['define_macros'] = [('HAVE_CBLAS', None)]
+
+        atlas_version, atlas_extra_info = get_atlas_version(**atlas)
+        dict_append(atlas, **atlas_extra_info)
+
+        dict_append(info, **atlas)
+
+        self.set_info(**info)
+        return
+
+
+class atlas_3_10_threads_info(atlas_3_10_info):
+    dir_env_var = ['PTATLAS', 'ATLAS']
+    _lib_names = ['tatlas']
+    #if sys.platfcorm[:7] == 'freebsd':
+        ## I don't think freebsd supports 3.10 at this time - 2014
+    _lib_atlas = _lib_names
+    _lib_lapack = _lib_names
+
+
+class atlas_3_10_blas_threads_info(atlas_3_10_blas_info):
+    dir_env_var = ['PTATLAS', 'ATLAS']
+    _lib_names = ['tatlas']
+
+
+class lapack_atlas_3_10_info(atlas_3_10_info):
+    pass
+
+
+class lapack_atlas_3_10_threads_info(atlas_3_10_threads_info):
+    pass
+
+
 class lapack_info(system_info):
     section = 'lapack'
     dir_env_var = 'LAPACK'
@@ -1366,7 +1436,6 @@ def get_atlas_version(**config):
     return result
 
 
-
 class lapack_opt_info(system_info):
 
     notfounderror = LapackNotFoundError
@@ -1383,7 +1452,11 @@ def calc_info(self):
             self.set_info(**lapack_mkl_info)
             return
 
-        atlas_info = get_info('atlas_threads')
+        atlas_info = get_info('atlas_3_10_threads')
+        if not atlas_info:
+            atlas_info = get_info('atlas_3_10')
+        if not atlas_info:
+            atlas_info = get_info('atlas_threads')
         if not atlas_info:
             atlas_info = get_info('atlas')
 
@@ -1480,7 +1553,11 @@ def calc_info(self):
             self.set_info(**openblas_info)
             return
 
-        atlas_info = get_info('atlas_blas_threads')
+        atlas_info = get_info('atlas_3_10_blas_threads')
+        if not atlas_info:
+            atlas_info = get_info('atlas_3_10_blas')
+        if not atlas_info:
+            atlas_info = get_info('atlas_blas_threads')
         if not atlas_info:
             atlas_info = get_info('atlas_blas')
 


Test patch: