[med-svn] [Git][med-team/rna-star][master] 3 commits: On amd64/i386: build STAR for each SIMD level from AVX2 on down

Michael R. Crusoe gitlab at salsa.debian.org
Mon Mar 1 19:16:27 GMT 2021



Michael R. Crusoe pushed to branch master at Debian Med / rna-star


Commits:
5b01801f by Michael R. Crusoe at 2021-03-01T20:12:01+01:00
On amd64/i386: build STAR for each SIMD level from AVX2 on down

Build and ship STARlong as well

- - - - -
6947a75c by Michael R. Crusoe at 2021-03-01T20:12:01+01:00
forward reproducible build patch upstream

- - - - -
db3d62ca by Michael R. Crusoe at 2021-03-01T20:15:40+01:00
release 2.7.8a+dfsg-2

- - - - -


6 changed files:

- + debian/bin/simd-dispatch
- debian/changelog
- − debian/install
- debian/patches/reproducible.patch
- debian/patches/simde.patch
- debian/rules


Changes:

=====================================
debian/bin/simd-dispatch
=====================================
@@ -0,0 +1,20 @@
+#!/bin/bash
+
+DIR=/usr/lib/rna-star/bin
+BASE=${DIR}/$(basename "$0")
+CMDARGS="$@"
+
+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 ; do test_and_run ${SIMD} "$@" ; done
+
+# fallback to plain option
+$BASE-plain "$@"


=====================================
debian/changelog
=====================================
@@ -1,8 +1,6 @@
-rna-star (2.7.8a+dfsg-2) UNRELEASED; urgency=high
+rna-star (2.7.8a+dfsg-2) unstable; urgency=high
 
-  [ Michael R. Crusoe ]
   * Team upload.
-  * debian/{rules,clean: specify the source directory, and simplify
 
   [ Nilesh Patra ]
   * debian/{rules,control,patches/simde.patch}: use libsimde-dev to enable
@@ -10,10 +8,13 @@ rna-star (2.7.8a+dfsg-2) UNRELEASED; urgency=high
     Removed "-march=native" architecture baseline violation. Closes: #983723
 
   [ Michael R. Crusoe ]
+  * debian/{rules,clean: specify the source directory, and simplify
   * debian/patches/reproducible.patch: Reproducibly include the build
-    time using SOURCE_DATE_EPOCH
+    time using SOURCE_DATE_EPOCH. Also forwarded upstream
+  * On amd64: build STAR for each SIMD level from AVX2 on down.
+  * Build and ship STARlong as well
 
- -- Michael R. Crusoe <crusoe at debian.org>  Mon, 01 Mar 2021 12:10:42 +0100
+ -- Michael R. Crusoe <crusoe at debian.org>  Mon, 01 Mar 2021 20:14:32 +0100
 
 rna-star (2.7.8a+dfsg-1) unstable; urgency=medium
 


=====================================
debian/install deleted
=====================================
@@ -1 +0,0 @@
-source/STAR	usr/bin


=====================================
debian/patches/reproducible.patch
=====================================
@@ -1,6 +1,7 @@
 Description: make build reproducible
  Stops build hostname and directory from being recorded in the artifact.
 Author: Sascha Steinbiss <sascha at steinbiss.name>
+Forwarded: https://github.com/alexdobin/STAR/pull/1164
 --- rna-star.orig/source/Makefile
 +++ rna-star/source/Makefile
 @@ -18,7 +18,14 @@


=====================================
debian/patches/simde.patch
=====================================
@@ -16,7 +16,12 @@ Forwarded: https://github.com/alexdobin/STAR/issues/1160
  #include "opal.h"
 --- rna-star.orig/source/Makefile
 +++ rna-star/source/Makefile
-@@ -91,7 +91,7 @@
+@@ -87,11 +87,11 @@
+ %.o : %.c
+ 	$(CXX) -c $(CPPFLAGS) $(CFLAGS) $(COMPTIMEPLACE) $<
+ 
+-all: STAR
++all: STAR$(SFX)
  
  opal/opal.o : opal/opal.cpp opal/opal.h
  	cd opal && \
@@ -25,3 +30,33 @@ Forwarded: https://github.com/alexdobin/STAR/issues/1160
  
  .PHONY: clean
  clean:
+@@ -128,10 +128,10 @@
+ parametersDefault.xxd: parametersDefault
+ 	xxd -i parametersDefault > parametersDefault.xxd
+ 
+-STAR : CXXFLAGS := $(CXXFLAGSextra) $(CXXFLAGS_main) $(CXXFLAGS)
+-STAR : LDFLAGS := $(LDFLAGSextra) $(LDFLAGS_shared) $(LDFLAGS)
+-STAR : Depend.list parametersDefault.xxd $(OBJECTS)
+-	$(CXX) -o STAR $(CXXFLAGS) $(OBJECTS) $(LDFLAGS)
++STAR$(SFX) : CXXFLAGS := $(CXXFLAGSextra) $(CXXFLAGS_main) $(CXXFLAGS)
++STAR$(SFX) : LDFLAGS := $(LDFLAGSextra) $(LDFLAGS_shared) $(LDFLAGS)
++STAR$(SFX) : Depend.list parametersDefault.xxd $(OBJECTS)
++	$(CXX) -o STAR$(SFX) $(CXXFLAGS) $(OBJECTS) $(LDFLAGS)
+ 
+ POSIXSHARED : CXXFLAGS := $(CXXFLAGSextra) $(CXXFLAGS_main) -DPOSIX_SHARED_MEM $(CXXFLAGS)
+ POSIXSHARED : LDFLAGS := $(LDFLAGSextra) $(LDFLAGS_shared) $(LDFLAGS)
+@@ -143,10 +143,10 @@
+ STARstatic : Depend.list parametersDefault.xxd $(OBJECTS)
+ 	$(CXX) -o STAR $(CXXFLAGS) $(OBJECTS) $(LDFLAGS)
+ 
+-STARlong : CXXFLAGS := $(CXXFLAGSextra) $(CXXFLAGS_main) -D'COMPILE_FOR_LONG_READS' $(CXXFLAGS)
+-STARlong : LDFLAGS := $(LDFLAGSextra) $(LDFLAGS_shared) $(LDFLAGS)
+-STARlong : Depend.list parametersDefault.xxd $(OBJECTS)
+-	$(CXX) -o STARlong $(CXXFLAGS) $(OBJECTS) $(LDFLAGS)
++STARlong$(SFX) : CXXFLAGS := $(CXXFLAGSextra) $(CXXFLAGS_main) -D'COMPILE_FOR_LONG_READS' $(CXXFLAGS)
++STARlong$(SFX) : LDFLAGS := $(LDFLAGSextra) $(LDFLAGS_shared) $(LDFLAGS)
++STARlong$(SFX) : Depend.list parametersDefault.xxd $(OBJECTS)
++	$(CXX) -o STARlong$(SFX) $(CXXFLAGS) $(OBJECTS) $(LDFLAGS)
+ 
+ STARlongStatic : CXXFLAGS := $(CXXFLAGSextra) $(CXXFLAGS_main) -D'COMPILE_FOR_LONG_READS' $(CXXFLAGS)
+ STARlongStatic : LDFLAGS := $(LDFLAGSextra) $(LDFLAGS_static) $(LDFLAGS)


=====================================
debian/rules
=====================================
@@ -4,20 +4,42 @@
 # Uncomment this to turn on verbose mode.
 #export DH_VERBOSE=1
 
-#DPKG_EXPORT_BUILDFLAGS = 1
-#include /usr/share/dpkg/buildflags.mk
+include /usr/share/dpkg/default.mk
 
 export CCFLAGS=-flto $(CXXFLAGS) $(CPPFLAGS) -std=c++0x
 # export LDFLAGS+=-flto -pthread -lhts -lz
 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
+
+AMD64_SIMD_LEVELS=avx2 avx sse4.1 ssse3 sse3
+binprefix=$(CURDIR)/debian/$(DEB_SOURCE)/usr/bin
+libexecdir=$(CURDIR)/debian/$(DEB_SOURCE)/usr/lib/$(DEB_SOURCE)/bin
+export DEB_CFLAGS_MAINT_APPEND+=-O3
+export DEB_CXXFLAGS_MAINT_APPEND+=-O3
+# package already builds with -fopenmp, so no need to add that for SIMDe
 
 %:
 	dh $@ --sourcedirectory=source
 
 override_dh_auto_build:
-	dh_auto_build -- CCFLAGS_common_add="-flto $(CCFLAGS)" CCFLAGS="$(CCFLAGS)" LDFLAGS_add="$(LDFLAGS)"
+ifeq ($(DEB_HOST_ARCH),amd64)
+	mkdir --parents $(libexecdir)
+	$(foreach SIMD,$(AMD64_SIMD_LEVELS),dh_auto_build -- SFX=-$(SIMD) CCFLAGS_common_add="-flto $(CCFLAGS)" CXXFLAGS="$(CXXFLAGS) -m$(SIMD)" LDFLAGS_add="$(LDFLAGS)" STAR-$(SIMD) STARlong-$(SIMD) && ) true
+	dh_auto_build -- SFX=-plain CCFLAGS_common_add="-flto $(CCFLAGS)" CCFLAGS="$(CCFLAGS)" LDFLAGS_add="$(LDFLAGS)" STAR-plain STARlong-plain
+	cp source/STAR-plain source/STARlong-plain $(libexecdir)/
+else
+	dh_auto_build -- CCFLAGS_common_add="-flto $(CCFLAGS)" CCFLAGS="$(CCFLAGS)" LDFLAGS_add="$(LDFLAGS)" STAR STARlong
+endif
+
+override_dh_auto_install:
+ifeq ($(DEB_HOST_ARCH),amd64)
+	mkdir --parents $(binprefix)
+	$(foreach SIMD,$(AMD64_SIMD_LEVELS) plain,dh_install source/STAR-$(SIMD) source/STARlong-$(SIMD) /usr/lib/$(DEB_SOURCE)/bin && ) true
+	dh_install debian/bin/simd-dispatch /usr/lib/$(DEB_SOURCE)/
+	set -e && cd $(binprefix) && for prog in STAR STARlong ; do ln -s \
+		../lib/$(DEB_SOURCE)/simd-dispatch $${prog} ; done
+else
+	dh_install source/STAR source/STARlong usr/bin/
+endif
 
 override_dh_auto_clean:
 	cd source && ${MAKE} clean
@@ -27,8 +49,16 @@ override_dh_compress:
 
 override_dh_auto_test:
 ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
+ifeq ($(DEB_HOST_ARCH),amd64)
+	set -i; for SIMD in $(AMD64_SIMD_LEVELS) ; do \
+		if lscpu | grep -q $${SIMD} ; then \
+		debian/tests/run_test.sh $(CURDIR)/source/STAR-$${SIMD} ; \
+		fi ; done
+	debian/tests/run_test.sh $(libexecdir)/STAR-plain
+else
 	debian/tests/run_test.sh $(CURDIR)/source/STAR
 endif
+endif
 
 override_dh_gencontrol:
 	dh_gencontrol -- -Vsimde:Built-Using="$(shell dpkg-query -f '$${source:Package} (= $${source:Version}), ' -W "libsimde-dev")"



View it on GitLab: https://salsa.debian.org/med-team/rna-star/-/compare/9b2a3ffd0e21cb3d72f2c077d9123697717b8a1d...db3d62caec47c897696af0f3c565b4bc1537102b

-- 
View it on GitLab: https://salsa.debian.org/med-team/rna-star/-/compare/9b2a3ffd0e21cb3d72f2c077d9123697717b8a1d...db3d62caec47c897696af0f3c565b4bc1537102b
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/20210301/1f367833/attachment-0001.htm>


More information about the debian-med-commit mailing list