[med-svn] [Git][med-team/kalign][master] 2 commits: Compile using all levels of SIMD CPU support and restructure package with a "simd-dispatch" script

Michael R. Crusoe gitlab at salsa.debian.org
Mon Mar 30 15:27:06 BST 2020



Michael R. Crusoe pushed to branch master at Debian Med / kalign


Commits:
8a7d0132 by Michael R. Crusoe at 2020-03-30T16:26:42+02:00
Compile using all levels of SIMD CPU support and restructure package with a "simd-dispatch" script

- - - - -
f8984288 by Michael R. Crusoe at 2020-03-30T16:26:43+02:00
debian/patches/hardening: keep the provided CFLAGS

- - - - -


6 changed files:

- + debian/bin/simd-dispatch
- debian/changelog
- debian/control
- + debian/patches/hardening
- debian/patches/series
- debian/rules


Changes:

=====================================
debian/bin/simd-dispatch
=====================================
@@ -0,0 +1,20 @@
+#!/bin/bash
+
+PKG=kalign
+DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
+BASE=$(realpath ${DIR}/../lib/$PKG/$(basename "$0"))
+
+function test_and_run () {
+	if grep -q "$1" /proc/cpuinfo && [ -x "${BASE}-$1" ]; then
+		cmd="${BASE}-$1"
+		shift
+		# echo "${cmd}" "$@"
+		"${cmd}" "$@"
+		exit
+	fi
+}
+
+for SIMD in avx2 avx sse4.1 ssse3 sse3 sse2 sse mmx ; do test_and_run ${SIMD} "$@" ; done
+
+# fallback to plain option
+$BASE-plain "$@"


=====================================
debian/changelog
=====================================
@@ -2,6 +2,9 @@ kalign (1:3.2.3-2) UNRELEASED; urgency=medium
 
   * Team upload.
   * Add non-AVX2 compatability using the SIMD Everywhere library
+  * Compile using all levels of SIMD CPU support and restructure package
+    with a "simd-dispatch" script
+  * debian/patches/hardening: keep the provided CFLAGS
 
  -- Michael R. Crusoe <michael.crusoe at gmail.com>  Mon, 30 Mar 2020 12:13:37 +0200
 


=====================================
debian/control
=====================================
@@ -13,7 +13,6 @@ Rules-Requires-Root: no
 
 Package: kalign
 Architecture: any
-#Architecture: any-amd64 any-i386
 Depends: ${shlibs:Depends},
          ${misc:Depends}
 Enhances: t-coffee,


=====================================
debian/patches/hardening
=====================================
@@ -0,0 +1,18 @@
+From: Michael R. Crusoe <michael.crusoe at gmail.com>
+Subject: Don't discard the provided CFLAGS
+--- kalign.orig/m4/ax_set_compile_flags.m4
++++ kalign/m4/ax_set_compile_flags.m4
+@@ -19,11 +19,11 @@
+ AC_DEFINE(DEBUG,1,[Defines debugging .])
+ 
+ ADD_DEBUG_COMPILE_WARNINGS
+-CFLAGS="-ggdb -std=gnu11"
++CFLAGS="-ggdb -std=gnu11 ${CFLAGS}"
+ CFLAGS="${CFLAGS} ${TLDEVEL_CFLAGS}"
+ else
+ ADD_PRODUCTION_COMPILE_WARNINGS
+-CFLAGS="-O3 -std=gnu11"
++CFLAGS="-O3 -std=gnu11 ${CFLAGS}"
+ CFLAGS="${CFLAGS} ${TLDEVEL_CFLAGS}"
+ DEBUG=0
+ fi


=====================================
debian/patches/series
=====================================
@@ -1,2 +1,3 @@
 simde
 no-native-build
+hardening


=====================================
debian/rules
=====================================
@@ -2,13 +2,66 @@
 # -*- makefile -*-
 # Build rules for the Debian package kalign
 
+include /usr/share/dpkg/default.mk
 export DEB_CFLAGS_MAINT_APPEND += -DSIMDE_ENABLE_OPENMP -fopenmp-simd -O3
 export DEB_CXXFLAGS_MAINT_APPEND += -DSIMDE_ENABLE_OPENMP -fopenmp-simd -O3
 export DEB_BUILD_MAINT_OPTIONS = hardening=+all
+prefix=$(CURDIR)/debian/$(DEB_SOURCE)/usr
+libexecdir=$(prefix)/lib/$(DEB_SOURCE)
 
 %:
 	dh $@
 
-override_dh_dwz:
-	# do nothing because of the following error:
-	# "dwz: Too few files for multifile optimization"
+override_dh_auto_build:
+ifeq (amd64,$(DEB_HOST_ARCH))
+	mkdir -p $(prefix)
+	mkdir -p $(libexecdir)
+	# pulled avx2 out of the loop to pass the HAVE_AVX2 flag that the source looks for
+	dh_auto_configure -- CFLAGS="-DHAVE_AVX2=1 $(CFLAGS) -mavx2" &&\
+		dh_auto_build
+	cp src/kalign src/kalign-avx2
+	cp src/timescorealn src/timescorealn-avx2
+	for SIMD in avx sse4.1 ssse3 sse3 sse2 ; do \
+		make clean ; \
+		dh_auto_configure -- CFLAGS="$(CFLAGS) -m$${SIMD}" && \
+		dh_auto_build && \
+		cp src/kalign src/kalign-$${SIMD} && \
+		cp src/timescorealn src/timescorealn-$${SIMD} ; \
+	done
+else ifeq (i386,$(DEB_HOST_ARCH))
+	mkdir -p $(prefix)
+	mkdir -p $(libexecdir)
+	for SIMD in ssse3 sse3 sse2 sse mmx; do \
+		dh_auto_configure -- CFLAGS="$(CFLAGS) -m$${SIMD}" && \
+		dh_auto_build && \
+		cp src/kalign src/kalign-$${SIMD} && \
+		cp src/timescorealn src/timescorealn-$${SIMD} && \
+		make clean ; \
+	done
+	dh_auto_build
+	cp src/kalign src/kalign-plain && \
+	cp src/timescorealn src/timescorealn-plain
+else
+	dh_auto_build
+endif
+
+override_dh_auto_install:
+ifeq (amd64,$(DEB_HOST_ARCH))
+	dh_install debian/bin/simd-dispatch /usr/lib/$(DEB_SOURCE)/
+	dh_install src/kalign-* usr/lib/$(DEB_SOURCE)/
+	dh_install src/timescorealn-* usr/lib/$(DEB_SOURCE)/
+	mkdir -p $(prefix)/bin
+	cd $(prefix)/bin \
+	        && for prog in kalign timescorealn ; do \
+	        ln -s ../lib/$(DEB_SOURCE)/simd-dispatch $${prog} ; done
+else ifeq (i386,$(DEB_HOST_ARCH))
+	dh_install debian/bin/simd-dispatch /usr/lib/$(DEB_SOURCE)/
+	dh_install src/kalign-* usr/lib/$(DEB_SOURCE)/
+	dh_install src/timescorealn-* usr/lib/$(DEB_SOURCE)/
+	mkdir -p $(prefix)/bin
+	cd $(prefix)/bin \
+	        && for prog in kalign timescorealn ; do \
+	        ln -s ../lib/$(DEB_SOURCE)/simd-dispatch $${prog} ; done
+else
+	dh_auto_install
+endif



View it on GitLab: https://salsa.debian.org/med-team/kalign/-/compare/33ae524ad1ec634fb8ee7b76db53c83c6f518c26...f898428817da67b68bf28326f03283ce61115a9d

-- 
View it on GitLab: https://salsa.debian.org/med-team/kalign/-/compare/33ae524ad1ec634fb8ee7b76db53c83c6f518c26...f898428817da67b68bf28326f03283ce61115a9d
You're receiving this email because of your account on salsa.debian.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/debian-med-commit/attachments/20200330/6c250681/attachment-0001.html>


More information about the debian-med-commit mailing list