diff options
author | Charles Harris <charlesr.harris@gmail.com> | 2014-08-13 18:16:26 -0600 |
---|---|---|
committer | Julian Taylor <jtaylor.debian@googlemail.com> | 2014-09-04 21:45:48 +0200 |
commit | 175cea4dc0590ae520f32476ffb9129b8524bcad (patch) | |
tree | 6d48e045a3fbdb3b0a8088732ec8d62db5f11f33 /numpy/core/numeric.py | |
parent | 2995792b90add947f8898ea36410473f37b94509 (diff) | |
download | numpy-175cea4dc0590ae520f32476ffb9129b8524bcad.tar.gz |
ENH: When cblas is available use it in descr->f->dot.
Importing _dotblas currently executes _dotblas.alterdot, which replaces
the default descr->f->dot function with a cblas based version for float,
double, complex float, and complex double data types. This PR changes
the default descr->f->dot to use cblas whenever it is available. After
this change, the alterdot and restoredot functions serve no purpose, so
are changed to do nothing and deprecated. Note that those functions were
already doing nothing when _dotblas was not available.
Diffstat (limited to 'numpy/core/numeric.py')
-rw-r--r-- | numpy/core/numeric.py | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/numpy/core/numeric.py b/numpy/core/numeric.py index eb0c38b0b..4361ba5c1 100644 --- a/numpy/core/numeric.py +++ b/numpy/core/numeric.py @@ -1078,31 +1078,33 @@ def outer(a, b, out=None): # try to import blas optimized dot if available envbak = os.environ.copy() try: - # importing this changes the dot function for basic 4 types - # to blas-optimized versions. - # disables openblas affinity setting of the main thread that limits # python threads or processes to one core if 'OPENBLAS_MAIN_FREE' not in os.environ: os.environ['OPENBLAS_MAIN_FREE'] = '1' if 'GOTOBLAS_MAIN_FREE' not in os.environ: os.environ['GOTOBLAS_MAIN_FREE'] = '1' - from ._dotblas import dot, vdot, inner, alterdot, restoredot + from ._dotblas import dot, vdot, inner except ImportError: # docstrings are in add_newdocs.py inner = multiarray.inner dot = multiarray.dot def vdot(a, b): return dot(asarray(a).ravel().conj(), asarray(b).ravel()) - def alterdot(): - pass - def restoredot(): - pass finally: os.environ.clear() os.environ.update(envbak) del envbak + +def alterdot(): + warnings.warn("alterdot no longer does anything.", DeprecationWarning) + + +def restoredot(): + warnings.warn("restoredot no longer does anything.", DeprecationWarning) + + def tensordot(a, b, axes=2): """ Compute tensor dot product along specified axes for arrays >= 1-D. |