[lua-torch-torch7] 01/02: d: misc update

Zhou Mo cdluminate-guest at moszumanska.debian.org
Sun Nov 20 14:06:10 UTC 2016


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

cdluminate-guest pushed a commit to branch master
in repository lua-torch-torch7.

commit 7f9c5e3862119174752092fb48478d593f4c24bc
Author: Zhou Mo <cdluminate at gmail.com>
Date:   Sun Nov 20 14:05:05 2016 +0000

    d: misc update
---
 debian/changelog                                   | 14 +++++++
 debian/libtorch-th.symbols.amd64                   | 19 ----------
 debian/libtorch-th.symbols.i386                    | 19 ----------
 .../cmake-disable-simd-for-compatibility.patch     | 43 ++++++++++++++++++++++
 debian/patches/series                              |  1 +
 debian/rules                                       | 13 ++++++-
 debian/tool.unittest.benchmark                     | 23 ++++++++++++
 7 files changed, 92 insertions(+), 40 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index 98dcced..28cef68 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,17 @@
+lua-torch-torch7 (0~20161013-g4f7843e-2) UNRELEASED; urgency=medium
+
+  * Drop -pedantic to reduce build log size.
+  * Disable AVX, SSE4.2, SSE4.1, SSE3 instruction sets on amd64, and disable
+    AVX and SSE* instruction sets on i386, which makes several symbols of
+    optimized convolution symbols disappeared from libTH.so . Performance
+    gain from SIMD instruction sets are lost but we obtain a better
+    compatibility.
+    + Add patch: cmake-disable-simd-for-compatibility.patch
+    + Refresh symbols control files.
+  * Add tool script for benchmarking with upstream unittest.
+
+ -- Zhou Mo <cdluminate at gmail.com>  Sun, 20 Nov 2016 13:48:49 +0000
+
 lua-torch-torch7 (0~20161013-g4f7843e-1) experimental; urgency=medium
 
   * Import upstream snapshot (4f7843e).
diff --git a/debian/libtorch-th.symbols.amd64 b/debian/libtorch-th.symbols.amd64
index 173ef31..69d5fa8 100644
--- a/debian/libtorch-th.symbols.amd64
+++ b/debian/libtorch-th.symbols.amd64
@@ -2060,23 +2060,4 @@ libTH.so.0 libtorch-th #MINVER#
  _THArgCheck at Base 0~20160803-g17ff317
  _THAssertionFailed at Base 0~20160803-g17ff317
  _THError at Base 0~20160803-g17ff317
- convolve_5x5 at Base 0~20160803-g17ff317
- convolve_5x5_16x16_avx at Base 0~20160803-g17ff317
- convolve_5x5_1_avx at Base 0~20160803-g17ff317
- convolve_5x5_1_sse at Base 0~20160803-g17ff317
- convolve_5x5_2_avx at Base 0~20160803-g17ff317
- convolve_5x5_2_sse at Base 0~20160803-g17ff317
- convolve_5x5_32x32_avx at Base 0~20160803-g17ff317
- convolve_5x5_4_avx at Base 0~20160803-g17ff317
- convolve_5x5_4_sse at Base 0~20160803-g17ff317
- convolve_5x5_5_avx at Base 0~20160803-g17ff317
- convolve_5x5_64x64_avx at Base 0~20160803-g17ff317
- convolve_5x5_6_avx at Base 0~20160803-g17ff317
- convolve_5x5_6_sse at Base 0~20160803-g17ff317
- convolve_5x5_7_avx at Base 0~20160803-g17ff317
- convolve_5x5_8_avx at Base 0~20160803-g17ff317
- convolve_5x5_8_sse at Base 0~20160803-g17ff317
- convolve_5x5_8x8_avx at Base 0~20160803-g17ff317
- convolve_5x5_avx at Base 0~20160803-g17ff317
- convolve_5x5_sse at Base 0~20160803-g17ff317
  unknown_filename at Base 0~20160908-ge5ebac6
diff --git a/debian/libtorch-th.symbols.i386 b/debian/libtorch-th.symbols.i386
index 173ef31..69d5fa8 100644
--- a/debian/libtorch-th.symbols.i386
+++ b/debian/libtorch-th.symbols.i386
@@ -2060,23 +2060,4 @@ libTH.so.0 libtorch-th #MINVER#
  _THArgCheck at Base 0~20160803-g17ff317
  _THAssertionFailed at Base 0~20160803-g17ff317
  _THError at Base 0~20160803-g17ff317
- convolve_5x5 at Base 0~20160803-g17ff317
- convolve_5x5_16x16_avx at Base 0~20160803-g17ff317
- convolve_5x5_1_avx at Base 0~20160803-g17ff317
- convolve_5x5_1_sse at Base 0~20160803-g17ff317
- convolve_5x5_2_avx at Base 0~20160803-g17ff317
- convolve_5x5_2_sse at Base 0~20160803-g17ff317
- convolve_5x5_32x32_avx at Base 0~20160803-g17ff317
- convolve_5x5_4_avx at Base 0~20160803-g17ff317
- convolve_5x5_4_sse at Base 0~20160803-g17ff317
- convolve_5x5_5_avx at Base 0~20160803-g17ff317
- convolve_5x5_64x64_avx at Base 0~20160803-g17ff317
- convolve_5x5_6_avx at Base 0~20160803-g17ff317
- convolve_5x5_6_sse at Base 0~20160803-g17ff317
- convolve_5x5_7_avx at Base 0~20160803-g17ff317
- convolve_5x5_8_avx at Base 0~20160803-g17ff317
- convolve_5x5_8_sse at Base 0~20160803-g17ff317
- convolve_5x5_8x8_avx at Base 0~20160803-g17ff317
- convolve_5x5_avx at Base 0~20160803-g17ff317
- convolve_5x5_sse at Base 0~20160803-g17ff317
  unknown_filename at Base 0~20160908-ge5ebac6
diff --git a/debian/patches/cmake-disable-simd-for-compatibility.patch b/debian/patches/cmake-disable-simd-for-compatibility.patch
new file mode 100644
index 0000000..48a20d1
--- /dev/null
+++ b/debian/patches/cmake-disable-simd-for-compatibility.patch
@@ -0,0 +1,43 @@
+diff --git a/lib/TH/cmake/FindSSE.cmake b/lib/TH/cmake/FindSSE.cmake
+index f6aac07..e4b3334 100644
+--- a/lib/TH/cmake/FindSSE.cmake
++++ b/lib/TH/cmake/FindSSE.cmake
+@@ -97,15 +97,26 @@ MACRO(CHECK_SSE lang type flags)
+ 
+ ENDMACRO()
+ 
+-CHECK_SSE(C "SSE1" " ;-msse;/arch:SSE")
+-CHECK_SSE(C "SSE2" " ;-msse2;/arch:SSE2")
+-CHECK_SSE(C "SSE3" " ;-msse3;/arch:SSE3")
+-CHECK_SSE(C "SSE4_1" " ;-msse4.1;-msse4;/arch:SSE4")
+-CHECK_SSE(C "SSE4_2" " ;-msse4.2;-msse4;/arch:SSE4")
+-CHECK_SSE(C "AVX" " ;-mavx;/arch:AVX")
+-
+-CHECK_SSE(CXX "SSE1" " ;-msse;/arch:SSE")
+-CHECK_SSE(CXX "SSE2" " ;-msse2;/arch:SSE2")
+-CHECK_SSE(CXX "SSE3" " ;-msse3;/arch:SSE3")
+-CHECK_SSE(CXX "SSE4_1" " ;-msse4.1;-msse4;/arch:SSE4")
+-CHECK_SSE(CXX "SSE4_2" " ;-msse4.2;-msse4;/arch:SSE4")
++IF(DEBIAN_I386)
++  # no SSE at all for i386
++ELSEIF(DEBIAN_AMD64)
++  # nothing higher than SSE2, no AVX
++  CHECK_SSE(C "SSE1" " ;-msse;/arch:SSE")
++  CHECK_SSE(C "SSE2" " ;-msse2;/arch:SSE2")
++  CHECK_SSE(CXX "SSE1" " ;-msse;/arch:SSE")
++  CHECK_SSE(CXX "SSE2" " ;-msse2;/arch:SSE2")
++ELSE()
++  # General case
++  CHECK_SSE(C "SSE1" " ;-msse;/arch:SSE")
++  CHECK_SSE(C "SSE2" " ;-msse2;/arch:SSE2")
++  CHECK_SSE(C "SSE3" " ;-msse3;/arch:SSE3")
++  CHECK_SSE(C "SSE4_1" " ;-msse4.1;-msse4;/arch:SSE4")
++  CHECK_SSE(C "SSE4_2" " ;-msse4.2;-msse4;/arch:SSE4")
++  CHECK_SSE(C "AVX" " ;-mavx;/arch:AVX")
++  
++  CHECK_SSE(CXX "SSE1" " ;-msse;/arch:SSE")
++  CHECK_SSE(CXX "SSE2" " ;-msse2;/arch:SSE2")
++  CHECK_SSE(CXX "SSE3" " ;-msse3;/arch:SSE3")
++  CHECK_SSE(CXX "SSE4_1" " ;-msse4.1;-msse4;/arch:SSE4")
++  CHECK_SSE(CXX "SSE4_2" " ;-msse4.2;-msse4;/arch:SSE4")
++ENDIF()
diff --git a/debian/patches/series b/debian/patches/series
new file mode 100644
index 0000000..622c741
--- /dev/null
+++ b/debian/patches/series
@@ -0,0 +1 @@
+cmake-disable-simd-for-compatibility.patch
diff --git a/debian/rules b/debian/rules
index 260a04a..2737efa 100755
--- a/debian/rules
+++ b/debian/rules
@@ -1,9 +1,11 @@
 #!/usr/bin/make -f
 export DEB_BUILD_MAINT_OPTIONS = hardening=+all
-export DEB_CFLAGS_MAINT_APPEND  = -Wall -pedantic
+export DEB_BUILD_OPTIONS = nocheck
+export DEB_CFLAGS_MAINT_APPEND  = -Wall #-pedantic
 export DEB_LDFLAGS_MAINT_APPEND = -Wl,--as-needed
 
 DEB_HOST_MULTIARCH=$(shell dpkg-architecture -qDEB_HOST_MULTIARCH)
+DEB_HOST_ARCH=$(shell dpkg-architecture -qDEB_HOST_ARCH)
 TMP=$(shell pwd)/debian/tmp
 LUA51=/usr/bin/lua5.1
 LUAJIT=/usr/bin/luajit
@@ -24,6 +26,13 @@ TORCH_FLAGS_5_1= \
  -DCMAKE_INSTALL_PREFIX=/usr \
  -DWITH_BLAS=generic
 
+ifeq (amd64,$(DEB_HOST_ARCH))
+ISA_FLAGS= -DDEBIAN_AMD64=ON
+endif
+ifeq (i386,$(DEB_HOST_ARCH))
+ISA_FLAGS= -DDEBIAN_I386=ON
+endif
+
 %:
 	dh $@ --buildsystem=lua --with lua --parallel
 
@@ -35,7 +44,7 @@ override_dh_auto_configure:
 		-DTorch_INSTALL_CMAKE_SUBDIR=/usr/share/libtorch-luat-dev/
 	# configure libTH.so
 	dh_auto_configure --buildsystem=cmake --builddirectory=TH.build -- \
-		../lib/TH $(TORCH_FLAGS_5_1) \
+		../lib/TH $(TORCH_FLAGS_5_1) $(ISA_FLAGS) \
 		-DTorch_INSTALL_CMAKE_SUBDIR=/usr/share/libtorch-th-dev/
 	# configure the rest lua stuff
 	dh_auto_configure --buildsystem=lua
diff --git a/debian/tool.unittest.benchmark b/debian/tool.unittest.benchmark
new file mode 100755
index 0000000..3c47982
--- /dev/null
+++ b/debian/tool.unittest.benchmark
@@ -0,0 +1,23 @@
+#!/bin/sh
+set -e
+
+# NOTE: execute this script in deb.test directory, that directory
+#       is prepared for dh_autotest.
+
+MAXITER=20
+
+export LD_LIBRARY_PATH=.
+touch benchmark.log
+
+for iter in $(seq $MAXITER); do
+  echo running iteration $iter ...
+  /usr/bin/time -a -o benchmark.log -p luajit -ltorch -e 'torch.test()' \
+    1>/dev/null 2>/dev/null
+done
+
+awk '
+BEGIN{sum=0;count=0};
+/real/{sum+=$2;count+=1};
+END{print sum, count, sum/count}' benchmark.log
+
+exit 0

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



More information about the debian-science-commits mailing list