[med-svn] [Git][med-team/plink2][master] 2 commits: dispatch

Michael R. Crusoe gitlab at salsa.debian.org
Fri Apr 24 09:08:36 BST 2020



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


Commits:
918c7471 by Michael R. Crusoe at 2020-04-23T22:38:33+02:00
dispatch

- - - - -
3df60f9f by Michael R. Crusoe at 2020-04-24T10:07:55+02:00
release 2.00~a3-200409+dfsg2-1 to unstable

- - - - -


6 changed files:

- + debian/bin/simd-dispatch
- debian/changelog
- − debian/install
- debian/patches/crossbuild
- debian/patches/simde
- debian/rules


Changes:

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


=====================================
debian/changelog
=====================================
@@ -1,11 +1,11 @@
-plink2 (2.00~a3-200409+dfsg2-1) UNRELEASED; urgency=medium
+plink2 (2.00~a3-200409+dfsg2-1) unstable; urgency=medium
 
   * Team upload.
   * Enable building on non-x86
   * Use the Debian package of libdeflate
   * Enable cross building
 
- -- Michael R. Crusoe <michael.crusoe at gmail.com>  Thu, 23 Apr 2020 14:26:02 +0200
+ -- Michael R. Crusoe <michael.crusoe at gmail.com>  Fri, 24 Apr 2020 10:07:15 +0200
 
 plink2 (2.00~a3-200409+dfsg-1) unstable; urgency=medium
 


=====================================
debian/install deleted
=====================================
@@ -1,2 +0,0 @@
-build_dynamic/plink2 usr/bin/
-build_dynamic/pgen_compress usr/bin/


=====================================
debian/patches/crossbuild
=====================================
@@ -2,24 +2,33 @@ From: Michael R. Crusoe <michael.crusoe at gmail.com>
 Subject: enable cross building
 --- plink2.orig/build_dynamic/Makefile
 +++ plink2/build_dynamic/Makefile
-@@ -144,14 +144,14 @@
- all: plink2 pgen_compress
+@@ -29,6 +29,8 @@
+ MKL_IOMP5_DIR = /home/ubuntu/intel/compilers_and_libraries_2017.2.174/linux/compiler/lib/intel64
+ FORCE_32BIT =
+ DEBUG =
++CC ?= gcc
++CXX ?= g++
  
- plink2: $(CSRC2) $(ZCSRC2) $(CCSRC2) ../plink2_cpu.cc
+ BASEFLAGS=-DZSTD_MULTITHREAD
+ # ***** end configuration *****
+@@ -146,14 +148,14 @@
+ all: plink2$(SFX) pgen_compress$(SFX)
+ 
+ plink2$(SFX): $(CSRC2) $(ZCSRC2) $(CCSRC2) ../plink2_cpu.cc
 -	gcc $(CPPFLAGS) $(CFLAGS) $(CSRC2) -c
 -	$(SKIP_STATIC_ZSTD) gcc $(ZCFLAGS) $(ZCSRC2) -c
 -	g++ $(CPPFLAGS) $(CXXFLAGS) $(CCSRC2) -c
 -	g++ $(CPUCHECK_FLAGS) $(CXXFLAGS) $(CPPFLAGS) ../plink2_cpu.cc -c
--	g++ $(OBJ2) plink2_cpu.o $(ARCH32) -o plink2 $(BLASFLAGS) $(LINKFLAGS) $(LDFLAGS)
+-	g++ $(OBJ2) plink2_cpu.o $(ARCH32) -o plink2$(SFX) $(BLASFLAGS) $(LINKFLAGS) $(LDFLAGS)
 +	$(CC) $(CPPFLAGS) $(CFLAGS) $(CSRC2) -c
 +	$(SKIP_STATIC_ZSTD) $(CC) $(ZCFLAGS) $(ZCSRC2) -c
 +	$(CXX) $(CPPFLAGS) $(CXXFLAGS) $(CCSRC2) -c
 +	$(CXX) $(CPUCHECK_FLAGS) $(CXXFLAGS) $(CPPFLAGS) ../plink2_cpu.cc -c
-+	$(CXX) $(OBJ2) plink2_cpu.o $(ARCH32) -o plink2 $(BLASFLAGS) $(LINKFLAGS) $(LDFLAGS)
++	$(CXX) $(OBJ2) plink2_cpu.o $(ARCH32) -o plink2$(SFX) $(BLASFLAGS) $(LINKFLAGS) $(LDFLAGS)
  
- pgen_compress: $(PGCSRC2)
--	g++ $(CPPFLAGS) $(CXXFLAGS) $(LDFLAGS) $(PGCSRC2) -o pgen_compress
-+	$(CXX) $(CPPFLAGS) $(CXXFLAGS) $(LDFLAGS) $(PGCSRC2) -o pgen_compress
+ pgen_compress$(SFX): $(PGCSRC2)
+-	g++ $(CPPFLAGS) $(CXXFLAGS) $(LDFLAGS) $(PGCSRC2) -o pgen_compress$(SFX)
++	$(CXX) $(CPPFLAGS) $(CXXFLAGS) $(LDFLAGS) $(PGCSRC2) -o pgen_compress$(SFX)
  
  .PHONY: clean
  clean:


=====================================
debian/patches/simde
=====================================
@@ -53,3 +53,30 @@ Description: Enable buidling on non-AMD64
    _MM_SET_FLUSH_ZERO_MODE(_MM_FLUSH_ZERO_ON);
  #  endif
  #endif
+--- plink2.orig/build_dynamic/Makefile
++++ plink2/build_dynamic/Makefile
+@@ -141,17 +141,19 @@
+   CXXFLAGS += -Wno-sign-compare
+ endif
+ 
+-all: plink2 pgen_compress
++SFX ?= ""
+ 
+-plink2: $(CSRC2) $(ZCSRC2) $(CCSRC2) ../plink2_cpu.cc
++all: plink2$(SFX) pgen_compress$(SFX)
++
++plink2$(SFX): $(CSRC2) $(ZCSRC2) $(CCSRC2) ../plink2_cpu.cc
+ 	gcc $(CPPFLAGS) $(CFLAGS) $(CSRC2) -c
+ 	$(SKIP_STATIC_ZSTD) gcc $(ZCFLAGS) $(ZCSRC2) -c
+ 	g++ $(CPPFLAGS) $(CXXFLAGS) $(CCSRC2) -c
+ 	g++ $(CPUCHECK_FLAGS) $(CXXFLAGS) $(CPPFLAGS) ../plink2_cpu.cc -c
+-	g++ $(OBJ2) plink2_cpu.o $(ARCH32) -o plink2 $(BLASFLAGS) $(LINKFLAGS) $(LDFLAGS)
++	g++ $(OBJ2) plink2_cpu.o $(ARCH32) -o plink2$(SFX) $(BLASFLAGS) $(LINKFLAGS) $(LDFLAGS)
+ 
+-pgen_compress: $(PGCSRC2)
+-	g++ $(CPPFLAGS) $(CXXFLAGS) $(LDFLAGS) $(PGCSRC2) -o pgen_compress
++pgen_compress$(SFX): $(PGCSRC2)
++	g++ $(CPPFLAGS) $(CXXFLAGS) $(LDFLAGS) $(PGCSRC2) -o pgen_compress$(SFX)
+ 
+ .PHONY: clean
+ clean:


=====================================
debian/rules
=====================================
@@ -1,5 +1,6 @@
 #!/usr/bin/make -f
 
+include /usr/share/dpkg/default.mk
 export DEB_BUILD_MAINT_OPTIONS = hardening=+all
 export DEB_CFLAGS_MAINT_APPEND+=-DSIMDE_ENABLE_OPENMP -fopenmp-simd -O3
 export DEB_CXXFLAGS_MAINT_APPEND+=-DSIMDE_ENABLE_OPENMP -fopenmp-simd -O3
@@ -7,6 +8,9 @@ export DEB_LDFLAGS_MAINT_APPEND+=-ldeflate
 
 DIRECTORY=build_dynamic/
 
+prefix=$(CURDIR)/debian/$(DEB_SOURCE)/usr
+libexecdir=$(prefix)/lib/$(DEB_SOURCE)
+
 %:
 	dh $@ --sourcedirectory=$(DIRECTORY)
 
@@ -15,13 +19,6 @@ override_dh_auto_clean:
 	rm -f plink2.1
 	rm -f pgen_compress.1
 
-override_dh_auto_build:
-	dh_auto_build
-# help2man 1.47.13 is not able anymore do generate a clean manpage for plink1.9
-# which lead to several lintian warnings
-#	help2man --no-discard-stderr --name="whole genome SNP analysis" $(DIRECTORY)/plink2 > plink2.1
-	help2man --no-discard-stderr --name="whole genome SNP analysis" $(DIRECTORY)/pgen_compress > pgen_compress.1
-
 override_dh_installman:
 	dh_installman debian/plink2.1
 	dh_installman pgen_compress.1
@@ -31,3 +28,74 @@ override_dh_installchangelogs:
 
 override_dh_gencontrol:
 	dh_gencontrol -- -Vsimde:Built-Using="$(shell dpkg-query -f '$${source:Package} (= $${source:Version}), ' -W "libsimde-dev")"
+
+override_dh_auto_build-arch:
+ifeq (amd64,$(DEB_HOST_ARCH))
+	mkdir -p $(prefix)
+	mkdir -p $(libexecdir)
+	export CXXFLAGS="$(CXXFLAGS) -mavx2 -mbmi -mbmi2 -mlzcnt" && export CFLAGS="$(CFLAGS) -mavx2 -mbmi -mbmi2 -mlzcnt" && \
+		make clean ; \
+		dh_auto_build -- SFX=-avx2
+	for SIMD in avx sse4.1 ssse3 sse3 sse2 ; do \
+		export CXXFLAGS="$(CXXFLAGS) -m$${SIMD}" && export CFLAGS="$(CFLAGS) -m$${SIMD}" && \
+		make clean ; \
+		dh_auto_build -- SFX=-$${SIMD} ; \
+	done
+ifeq (,$(filter nodoc,$(DEB_BUILD_PROFILES)))
+# help2man 1.47.13 is not able anymore do generate a clean manpage for plink1.9
+# which lead to several lintian warnings
+#	help2man --no-discard-stderr --name="whole genome SNP analysis" $(DIRECTORY)/plink2 > plink2.1
+	help2man --no-discard-stderr --name="whole genome SNP analysis" $(DIRECTORY)/pgen_compress-sse2 > pgen_compress.1
+endif
+else ifeq (i386,$(DEB_HOST_ARCH))
+	mkdir -p $(prefix)
+	mkdir -p $(libexecdir)
+	for SIMD in ssse3 sse3 sse2 sse mmx; do \
+		export CXXFLAGS="$(CXXFLAGS) -m$${SIMD}" && export CFLAGS="$(CFLAGS) -m$${SIMD}" && \
+		make clean ; \
+		dh_auto_build -- SFX=-$${SIMD} ; \
+	done
+	dh_auto_build -- SFX=-plain
+ifeq (,$(filter nodoc,$(DEB_BUILD_PROFILES)))
+# help2man 1.47.13 is not able anymore do generate a clean manpage for plink1.9
+# which lead to several lintian warnings
+#	help2man --no-discard-stderr --name="whole genome SNP analysis" $(DIRECTORY)/plink2 > plink2.1
+	help2man --no-discard-stderr --name="whole genome SNP analysis" $(DIRECTORY)/pgen_compress-plain > pgen_compress.1
+endif
+else
+	dh_auto_build
+ifeq (,$(filter nodoc,$(DEB_BUILD_PROFILES)))
+# help2man 1.47.13 is not able anymore do generate a clean manpage for plink1.9
+# which lead to several lintian warnings
+#	help2man --no-discard-stderr --name="whole genome SNP analysis" $(DIRECTORY)/plink2 > plink2.1
+	help2man --no-discard-stderr --name="whole genome SNP analysis" $(DIRECTORY)/pgen_compress > pgen_compress.1
+endif
+endif
+
+override_dh_auto_install-arch:
+ifeq (amd64,$(DEB_HOST_ARCH))
+	dh_install debian/bin/simd-dispatch /usr/lib/$(DEB_SOURCE)/
+	for SIMD in avx2 avx sse4.1 ssse3 sse3 sse2 ; do \
+		dh_install build_dynamic/plink2-$${SIMD} usr/lib/$(DEB_SOURCE)/ ; \
+		dh_install build_dynamic/pgen_compress-$${SIMD} usr/lib/$(DEB_SOURCE)/ ; \
+	done
+	mkdir -p $(prefix)/bin
+	cd $(prefix)/bin \
+		&& for prog in plink2 pgen_compress ; 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)/
+	for SIMD in ssse3 sse3 sse2 plain ; do \
+		dh_install build_dynamic/plink2-$${SIMD} usr/lib/$(DEB_SOURCE)/ ; \
+		dh_install build_dynamic/pgen_compress-$${SIMD} usr/lib/$(DEB_SOURCE)/ ; \
+	done
+	mkdir -p $(prefix)/bin
+	cd $(prefix)/bin \
+		&& for prog in plink2 pgen_compress ; do \
+		ln -s ../lib/$(DEB_SOURCE)/simd-dispatch $${prog} ; done
+else
+	dh_install build_dynamic/plink2 usr/bin/
+	dh_install build_dynamic/pgen_compress usr/bin/
+endif
+
+override_dh_auto_install-indep:



View it on GitLab: https://salsa.debian.org/med-team/plink2/-/compare/c4ae3d19433f6f9a53917a9c0c5c52467fdd1dd1...3df60f9fca9fb104b5d0dd89d13ebbf3f3f2648c

-- 
View it on GitLab: https://salsa.debian.org/med-team/plink2/-/compare/c4ae3d19433f6f9a53917a9c0c5c52467fdd1dd1...3df60f9fca9fb104b5d0dd89d13ebbf3f3f2648c
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/20200424/18cbda8c/attachment-0001.html>


More information about the debian-med-commit mailing list