From 175cea4dc0590ae520f32476ffb9129b8524bcad Mon Sep 17 00:00:00 2001 From: Charles Harris Date: Wed, 13 Aug 2014 18:16:26 -0600 Subject: 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. --- numpy/core/numeric.py | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) (limited to 'numpy/core/numeric.py') 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. -- cgit v1.2.1