[numexpr] 01/05: Imported Upstream version 2.6.1

Antonio Valentino a_valentino-guest at moszumanska.debian.org
Sat Jul 30 10:58:49 UTC 2016


This is an automated email from the git hooks/post-receive script.

a_valentino-guest pushed a commit to branch master
in repository numexpr.

commit 5bf2c0df3003766d5f00f73a50a07382451857fb
Author: Antonio Valentino <antonio.valentino at tiscali.it>
Date:   Sat Jul 30 10:35:54 2016 +0000

    Imported Upstream version 2.6.1
---
 ANNOUNCE.rst               | 44 ++++++++++++++++++++------------------------
 RELEASE_NOTES.rst          | 13 +++++++++++++
 RELEASING.txt              |  3 +--
 bench/vml_timing2.py       |  2 +-
 bench/vml_timing3.py       | 13 +++++++++++++
 numexpr/cpuinfo.py         | 28 ++++++++++++++++++++++++++++
 numexpr/numexpr_config.hpp | 18 ++++++++----------
 numexpr/version.py         |  2 +-
 8 files changed, 85 insertions(+), 38 deletions(-)

diff --git a/ANNOUNCE.rst b/ANNOUNCE.rst
index 1a9553c..66f585b 100644
--- a/ANNOUNCE.rst
+++ b/ANNOUNCE.rst
@@ -1,7 +1,26 @@
 =========================
- Announcing Numexpr 2.6.0
+ Announcing Numexpr 2.6.1
 =========================
 
+What's new
+==========
+
+This is a manintenance release that fixes a performance regression in
+some situations. More specifically, the BLOCK_SIZE1 constant has been
+set to 1024 (down from 8192). This allows for better cache utilization
+when there are many operands.  Fixes #221.
+
+Also, support for NetBSD has been added.  Thanks to Thomas Klausner.
+
+In case you want to know more in detail what has changed in this
+version, see:
+
+https://github.com/pydata/numexpr/blob/master/RELEASE_NOTES.rst
+
+
+What's Numexpr
+==============
+
 Numexpr is a fast numerical expression evaluator for NumPy.  With it,
 expressions that operate on arrays (like "3*a+4*b") are accelerated
 and use less memory than doing the same calculation in Python.
@@ -18,29 +37,6 @@ Its only dependency is NumPy (MKL is optional), so it works well as an
 easy-to-deploy, easy-to-use, computational engine for projects that
 don't want to adopt other solutions requiring more heavy dependencies.
 
-What's new
-==========
-
-This is a minor version bump because it introduces a new function.
-Also some minor fine tuning for recent CPUs has been done:
-
-- Introduced a new re_evaluate() function for re-evaluating the
-  previous executed array expression without any check.  This is meant
-  for accelerating loops that are re-evaluating the same expression
-  repeatedly without changing anything else than the operands.  If
-  unsure, use evaluate() which is safer.
-
-- The BLOCK_SIZE1 and BLOCK_SIZE2 constants have been re-checked in
-  order to find a value maximizing most of the benchmarks in bench/
-  directory.  The new values (8192 and 16 respectively) give somewhat
-  better results (~5%) overall.  The CPU used for fine tuning is a
-  relatively new Haswell processor (E3-1240 v3).
-
-In case you want to know more in detail what has changed in this
-version, see:
-
-https://github.com/pydata/numexpr/blob/master/RELEASE_NOTES.rst
-
 Where I can find Numexpr?
 =========================
 
diff --git a/RELEASE_NOTES.rst b/RELEASE_NOTES.rst
index bd8db53..d3102f7 100644
--- a/RELEASE_NOTES.rst
+++ b/RELEASE_NOTES.rst
@@ -2,6 +2,19 @@
  Release notes for Numexpr 2.6 series
 ======================================
 
+Changes from 2.6.0 to 2.6.1
+===========================
+
+- Fixed a performance regression in some situations as consequence of
+  increasing too much the BLOCK_SIZE1 constant.  After more careful
+  benchmarks (both in VML and non-VML modes), the value has been set
+  again to 1024 (down from 8192).  The benchmarks have been made with
+  a relatively new processor (Intel Xeon E3-1245 v5 @ 3.50GHz), so
+  they should work well for a good range of processors again.
+
+- Added NetBSD support to CPU detection.  Thanks to Thomas Klausner.
+
+
 Changes from 2.5.2 to 2.6.0
 ===========================
 
diff --git a/RELEASING.txt b/RELEASING.txt
index e3f0501..958728f 100644
--- a/RELEASING.txt
+++ b/RELEASING.txt
@@ -83,8 +83,7 @@ Post-release actions
   (i.e. X.Y.Z --> X.Y.(Z+1).dev0).
 
 - Create new headers for adding new features in ``RELEASE_NOTES.txt``
-  and empty the release-specific information in ``ANNOUNCE.txt`` and
-  add this place-holder instead:
+  and add this place-holder:
 
   #XXX version-specific blurb XXX#
 
diff --git a/bench/vml_timing2.py b/bench/vml_timing2.py
index f089496..75f172f 100644
--- a/bench/vml_timing2.py
+++ b/bench/vml_timing2.py
@@ -10,7 +10,7 @@ import numpy as np
 import numexpr as ne
 from time import time
 
-N = 1e7 # higher value can cause segfault (on x86)
+N = int(5e7)
 
 x = np.linspace(0, 1, N)
 y = np.linspace(0, 1, N)
diff --git a/bench/vml_timing3.py b/bench/vml_timing3.py
new file mode 100644
index 0000000..e9471df
--- /dev/null
+++ b/bench/vml_timing3.py
@@ -0,0 +1,13 @@
+# -*- coding: utf-8 -*-
+import numpy as np
+import numexpr as ne
+from timeit import default_timer as timer
+
+x = np.ones(100000)
+scaler = -1J
+start = timer()
+for k in range(10000):
+    cexp = ne.evaluate('exp(scaler * x)')
+exec_time=(timer() - start)
+print
+print("Execution took", str(round(exec_time, 3)), "seconds")
diff --git a/numexpr/cpuinfo.py b/numexpr/cpuinfo.py
index f11cf5f..5be8b7c 100755
--- a/numexpr/cpuinfo.py
+++ b/numexpr/cpuinfo.py
@@ -498,6 +498,32 @@ class DarwinCPUInfo(CPUInfoBase):
 
     def _is_ppc860(self): return self.__machine(860)
 
+class NetBSDCPUInfo(CPUInfoBase):
+	info = None
+
+	def __init__(self):
+		if self.info is not None:
+			return
+		info = {}
+		info['sysctl_hw'] = key_value_from_command(['sysctl', 'hw'], sep='=')
+		info['arch'] = info['sysctl_hw'].get('hw.machine_arch', 1)
+		info['machine'] = info['sysctl_hw'].get('hw.machine', 1)
+		self.__class__.info = info
+
+	def _not_impl(self): pass
+
+	def _getNCPUs(self):
+		return int(self.info['sysctl_hw'].get('hw.ncpu', 1))
+
+	def _is_Intel(self):
+		if self.info['sysctl_hw'].get('hw.model', "")[0:5] == 'Intel':
+			return True
+		return False
+
+	def _is_AMD(self):
+		if self.info['sysctl_hw'].get('hw.model', "")[0:3] == 'AMD':
+			return True
+		return False
 
 class SunOSCPUInfo(CPUInfoBase):
     info = None
@@ -781,6 +807,8 @@ elif sys.platform.startswith('irix'):
     cpuinfo = IRIXCPUInfo
 elif sys.platform == 'darwin':
     cpuinfo = DarwinCPUInfo
+elif sys.platform[0:6] == 'netbsd':
+    cpuinfo = NetBSDCPUInfo
 elif sys.platform.startswith('sunos'):
     cpuinfo = SunOSCPUInfo
 elif sys.platform.startswith('win32'):
diff --git a/numexpr/numexpr_config.hpp b/numexpr/numexpr_config.hpp
index 6370877..92a3ebe 100644
--- a/numexpr/numexpr_config.hpp
+++ b/numexpr/numexpr_config.hpp
@@ -7,15 +7,17 @@
 #  define USE_UNALIGNED_ACCESS 1
 #endif
 
+#ifdef SCIPY_MKL_H
+#define USE_VML
+#endif
+
 #ifdef USE_VML
-/* The values below have been tuned for a Haswell processor (E3-1240 v3) */
-/* Note: with VML functions a larger block size (e.g. 8192) allows to make use
- * of the automatic multithreading capabilities of the VML library */
-#define BLOCK_SIZE1 8192
+/* The values below have been tuned for a Skylake processor (E3-1245 v5 @ 3.50GHz) */
+#define BLOCK_SIZE1 1024
 #define BLOCK_SIZE2 16
 #else
-/* The values below have been tuned for a Haswell processor (E3-1240 v3) */
-#define BLOCK_SIZE1 8192
+/* The values below have been tuned for a Skylake processor (E3-1245 v5 @ 3.50GHz) */
+#define BLOCK_SIZE1 1024
 #define BLOCK_SIZE2 16
 #endif
 
@@ -33,10 +35,6 @@
   #include "unistd.h"
 #endif
 
-#ifdef SCIPY_MKL_H
-#define USE_VML
-#endif
-
 #ifdef USE_VML
 #include "mkl_vml.h"
 #include "mkl_service.h"
diff --git a/numexpr/version.py b/numexpr/version.py
index b429378..489f868 100644
--- a/numexpr/version.py
+++ b/numexpr/version.py
@@ -8,4 +8,4 @@
 #  rights to use.
 ####################################################################
 
-version = '2.6.0'
+version = '2.6.1'

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/numexpr.git



More information about the debian-science-commits mailing list