From c55b36e1b4aa36eb54f33d89aa5c18e2a740b98c Mon Sep 17 00:00:00 2001 From: Pavel Denisov Date: Sun, 8 Nov 2015 16:28:04 -0400 Subject: sci-misc/kaldi: Version bump, switch to OpenBLAS math library by default, add CUDA support Package-Manager: portage-2.2.24 --- sci-misc/kaldi/ChangeLog | 8 ++ sci-misc/kaldi/Manifest | 1 + .../kaldi/files/default_rules.mk.a7d9824.patch | 48 ++++++++++++ sci-misc/kaldi/kaldi-0_p20151106.ebuild | 91 ++++++++++++++++++++++ sci-misc/kaldi/metadata.xml | 11 ++- 5 files changed, 158 insertions(+), 1 deletion(-) create mode 100644 sci-misc/kaldi/files/default_rules.mk.a7d9824.patch create mode 100644 sci-misc/kaldi/kaldi-0_p20151106.ebuild (limited to 'sci-misc') diff --git a/sci-misc/kaldi/ChangeLog b/sci-misc/kaldi/ChangeLog index fe4798129..b40d1713a 100644 --- a/sci-misc/kaldi/ChangeLog +++ b/sci-misc/kaldi/ChangeLog @@ -2,6 +2,14 @@ # Copyright 1999-2015 Gentoo Foundation; Distributed under the GPL v2 # $Id$ +*kaldi-0_p20151106 (08 Nov 2015) + + 08 Nov 2015; Pavel Denisov + +files/default_rules.mk.a7d9824.patch, +kaldi-0_p20151106.ebuild, + metadata.xml: + sci-misc/kaldi: Version bump, switch to OpenBLAS math library by default, add + CUDA support + *kaldi-0_p20150709 (18 Jul 2015) 18 Jul 2015; Pavel Denisov diff --git a/sci-misc/kaldi/Manifest b/sci-misc/kaldi/Manifest index 73235f010..fa70f9d27 100644 --- a/sci-misc/kaldi/Manifest +++ b/sci-misc/kaldi/Manifest @@ -1 +1,2 @@ DIST kaldi-0_p20150709.tar.xz 2322512 SHA256 84f1856315c8a1a3179cd464628bb0efa0423de0d68a529a064ba93c41bd64aa SHA512 cf1f0cb0701d386202a9e406c9a3aa40046058c4ecec8cedb51fc2b3216084eecc8d2a7353d695a21afa668fb88fa5dae29911d35ab5d413f48ccc9025258e90 WHIRLPOOL 144ad5a92fe46146766e9a4f34385b171cf24ce4849456e73783432e8cc74af145f7375e0130dfcbd0eac584d43ed79652f03967a24b532f11b7bf1bf15c2b7b +DIST kaldi-0_p20151106.tar.xz 2533608 SHA256 77726388b33739dcd3840b49bca027c3d97afad02e7b52c931d65ae08d900d40 SHA512 35f41bea999f8fdc5bc8d33753b9630bafddb23975254b12d30287e65cb2bfd48c7d1f126d96fc669cbbd43ad80abf6a5d5ccd6a24d516061454f8f84f560333 WHIRLPOOL 6e6c3ebc2f4701185e5d5c6eae727b5a4c06a764495e5a5172be142724ce89cd7e521b6f9602ae051d44e8766269000cde96ad12e9439cd16890bce6e311eabe diff --git a/sci-misc/kaldi/files/default_rules.mk.a7d9824.patch b/sci-misc/kaldi/files/default_rules.mk.a7d9824.patch new file mode 100644 index 000000000..458d45341 --- /dev/null +++ b/sci-misc/kaldi/files/default_rules.mk.a7d9824.patch @@ -0,0 +1,48 @@ +*** makefiles/default_rules.mk.orig 2015-10-28 22:11:07.903182744 -0400 +--- makefiles/default_rules.mk 2015-10-29 20:43:41.081851545 -0400 +*************** +*** 14,20 **** + LIBFILE = lib$(LIBNAME).so + #LDLIBS += -l$(LIBNAME) + endif +! LDFLAGS += -Wl,-rpath=$(shell readlink -f $(KALDILIBDIR)) -L. + LDFLAGS += $(foreach dep,$(ADDLIBS), -L$(dir $(dep)) ) + XDEPENDS = $(foreach dep,$(ADDLIBS), $(dir $(dep))/lib$(notdir $(basename $(dep))).so ) + else # Platform not supported +--- 14,20 ---- + LIBFILE = lib$(LIBNAME).so + #LDLIBS += -l$(LIBNAME) + endif +! LDFLAGS += -L. + LDFLAGS += $(foreach dep,$(ADDLIBS), -L$(dir $(dep)) ) + XDEPENDS = $(foreach dep,$(ADDLIBS), $(dir $(dep))/lib$(notdir $(basename $(dep))).so ) + else # Platform not supported +*************** +*** 75,81 **** + @{ result=0; \ + for x in $(TESTFILES); do \ + printf "Running $$x ..."; \ +! ./$$x >$$x.testlog 2>&1; \ + if [ $$? -ne 0 ]; then \ + echo "... FAIL $$x"; \ + result=1; \ +--- 75,81 ---- + @{ result=0; \ + for x in $(TESTFILES); do \ + printf "Running $$x ..."; \ +! LD_LIBRARY_PATH=$(KALDILIBDIR):${LD_LIBRARY_PATH} ./$$x >$$x.testlog 2>&1; \ + if [ $$? -ne 0 ]; then \ + echo "... FAIL $$x"; \ + result=1; \ +*************** +*** 99,101 **** +--- 99,107 ---- + # removing automatic making of "depend" as it's quite slow. + #.depend.mk: depend + -include .depend.mk ++ ++ print-binfiles: ++ @echo $(addprefix $(shell pwd)/, $(BINFILES)) ++ ++ print-libfiles: ++ @echo $(addsuffix .so, $(addprefix $(shell pwd)/lib, $(LIBNAME))) diff --git a/sci-misc/kaldi/kaldi-0_p20151106.ebuild b/sci-misc/kaldi/kaldi-0_p20151106.ebuild new file mode 100644 index 000000000..128c26898 --- /dev/null +++ b/sci-misc/kaldi/kaldi-0_p20151106.ebuild @@ -0,0 +1,91 @@ +# Copyright 1999-2015 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Id$ + +EAPI="5" + +inherit eutils flag-o-matic + +DESCRIPTION="A toolkit for speech recognition" +HOMEPAGE="http://kaldi-asr.org/" +SRC_URI="http://gentoo.akreal.net/distfiles/${P}.tar.xz" + +LICENSE="Apache-2.0" +SLOT="0" +IUSE="doc test threads atlas cuda" +KEYWORDS="~amd64" + +RDEPEND=" + media-libs/speex + virtual/lapack + virtual/lapacke + >=sci-misc/openfst-1.4.1 + atlas? ( sci-libs/atlas[threads=] ) + !atlas? ( sci-libs/openblas[-openmp,-threads] sci-libs/lapack-reference ) + cuda? ( dev-util/nvidia-cuda-toolkit )" +DEPEND="${RDEPEND} + doc? ( app-doc/doxygen )" + +REQUIRED_USE="!atlas? ( !threads )" + +# We need write acccess /dev/nvidiactl, /dev/nvidia0 and /dev/nvidia-uvm and the portage +# user is (usually) not in the video group +RESTRICT="cuda? ( userpriv )" + +src_prepare() { + epatch \ + "${FILESDIR}"/configure.patch \ + "${FILESDIR}"/Makefile.patch \ + "${FILESDIR}"/default_rules.mk.a7d9824.patch +} + +src_configure() { + if use atlas; then + myconf+=( --atlas-root="${EPREFIX}/usr/include/atlas" ) + if use threads; then + myconf+=( --threaded-atlas=yes ) + fi + else + myconf+=( --openblas-root="${EPREFIX}/usr" ) + append-cxxflags "-I${EPREFIX}/usr/include/openblas" + append-libs -lreflapack + fi + + # Upstream's configure script is "hand-generated" and not autotools compatible, + # for this reason econf can not be used + ./configure \ + --shared \ + --fst-root="${EPREFIX}/usr" \ + $(use cuda && echo "--use-cuda=yes --cudatk-dir=${EPREFIX}/opt/cuda" \ + || echo --use-cuda=no) \ + "${myconf[@]}" || die "failed to run configure" + + use test || append-cxxflags -DNDEBUG + append-libs -lspeex + + sed -i \ + -e "s:-g # -O0 -DKALDI_PARANOID:-DHAVE_SPEEX ${CXXFLAGS} :" \ + -e "s:-lm -lpthread -ldl:-lm -lpthread -ldl ${LIBS} ${LDFLAGS}:" \ + -e "s:CUDA_FLAGS = -g:CUDA_FLAGS = -O2:" \ + kaldi.mk || die "sed unix/kaldi.mk failed" +} + +src_compile() { + default + use doc && doxygen +} + +src_test() { + if use cuda; then + addwrite /dev/nvidiactl + addwrite /dev/nvidia0 + addwrite /dev/nvidia-uvm + fi + default +} + +src_install() { + dolib.so $(make print-libfiles) + dobin $(make print-binfiles) + use doc && dohtml -r html/* +} diff --git a/sci-misc/kaldi/metadata.xml b/sci-misc/kaldi/metadata.xml index e961e5163..ddeac8413 100644 --- a/sci-misc/kaldi/metadata.xml +++ b/sci-misc/kaldi/metadata.xml @@ -3,6 +3,7 @@ pavel.a.denisov@gmail.com + Pavel Denisov Kaldi is a toolkit for speech recognition written @@ -10,6 +11,14 @@ Kaldi is intended for use by speech recognition researchers. - kaldi + kaldi-asr/kaldi + + + Use sci-libs/atlas for math library. + + + Build with CUDA support. + + -- cgit v1.2.3-65-gdbad