summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastien Fabbro <bicatali@gentoo.org>2011-08-09 04:46:36 +0000
committerSebastien Fabbro <bicatali@gentoo.org>2011-08-09 04:46:36 +0000
commitdc476d28a823329ee448b844608dc57a87c587d6 (patch)
tree92b14dcecb89422781a154e7f3b9afab84daf312 /sci-libs/libsvm
parentBug #377907 - Use package.mask for compatibility with PMS section 5.2.7, and ... (diff)
downloadgentoo-2-dc476d28a823329ee448b844608dc57a87c587d6.tar.gz
gentoo-2-dc476d28a823329ee448b844608dc57a87c587d6.tar.bz2
gentoo-2-dc476d28a823329ee448b844608dc57a87c587d6.zip
Version bump. Added openmp features, thanks to Roby, bug #360157
(Portage version: 2.1.10.10/cvs/Linux x86_64)
Diffstat (limited to 'sci-libs/libsvm')
-rw-r--r--sci-libs/libsvm/ChangeLog10
-rw-r--r--sci-libs/libsvm/files/3.1-openmp.patch36
-rw-r--r--sci-libs/libsvm/libsvm-3.1.ebuild (renamed from sci-libs/libsvm/libsvm-2.91.ebuild)30
3 files changed, 64 insertions, 12 deletions
diff --git a/sci-libs/libsvm/ChangeLog b/sci-libs/libsvm/ChangeLog
index f067c647c355..b2b1f7813c78 100644
--- a/sci-libs/libsvm/ChangeLog
+++ b/sci-libs/libsvm/ChangeLog
@@ -1,6 +1,12 @@
# ChangeLog for sci-libs/libsvm
-# Copyright 1999-2010 Gentoo Foundation; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo-x86/sci-libs/libsvm/ChangeLog,v 1.22 2010/12/02 19:46:10 bicatali Exp $
+# Copyright 1999-2011 Gentoo Foundation; Distributed under the GPL v2
+# $Header: /var/cvsroot/gentoo-x86/sci-libs/libsvm/ChangeLog,v 1.23 2011/08/09 04:46:36 bicatali Exp $
+
+*libsvm-3.1 (09 Aug 2011)
+
+ 09 Aug 2011; Sébastien Fabbro <bicatali@gentoo.org> +files/3.1-openmp.patch,
+ -libsvm-2.91.ebuild, +libsvm-3.1.ebuild:
+ Version bump. Added openmp features, thanks to Roby, bug #360157
*libsvm-3.0 (02 Dec 2010)
diff --git a/sci-libs/libsvm/files/3.1-openmp.patch b/sci-libs/libsvm/files/3.1-openmp.patch
new file mode 100644
index 000000000000..b50ad94ecf60
--- /dev/null
+++ b/sci-libs/libsvm/files/3.1-openmp.patch
@@ -0,0 +1,36 @@
+--- svm.cpp.orig 2011-03-08 08:25:57.000000000 -0500
++++ svm.cpp 2011-04-25 18:07:09.000000000 -0400
+@@ -1267,6 +1267,9 @@ public:
+ int start, j;
+ if((start = cache->get_data(i,&data,len)) < len)
+ {
++#ifdef OPENMP
++#pragma omp parallel for private(j)
++#endif
+ for(j=start;j<len;j++)
+ data[j] = (Qfloat)(y[i]*y[j]*(this->*kernel_function)(i,j));
+ }
+@@ -2445,8 +2448,11 @@ double svm_predict_values(const svm_mode
+ model->param.svm_type == NU_SVR)
+ {
+ double *sv_coef = model->sv_coef[0];
+- double sum = 0;
+- for(int i=0;i<model->l;i++)
++ double sum = 0; int i;
++#ifdef OPENMP
++#pragma omp parallel for private(i) reduction(+:sum)
++#endif
++ for(i=0;i<model->l;i++)
+ sum += sv_coef[i] * Kernel::k_function(x,model->SV[i],model->param);
+ sum -= model->rho[0];
+ *dec_values = sum;
+@@ -2463,6 +2469,9 @@ double svm_predict_values(const svm_mode
+ int l = model->l;
+
+ double *kvalue = Malloc(double,l);
++#ifdef OPENMP
++#pragma omp parallel for private(i)
++#endif
+ for(i=0;i<l;i++)
+ kvalue[i] = Kernel::k_function(x,model->SV[i],model->param);
+
diff --git a/sci-libs/libsvm/libsvm-2.91.ebuild b/sci-libs/libsvm/libsvm-3.1.ebuild
index 83e20a90f18d..ffa8d3ee625f 100644
--- a/sci-libs/libsvm/libsvm-2.91.ebuild
+++ b/sci-libs/libsvm/libsvm-3.1.ebuild
@@ -1,31 +1,41 @@
-# Copyright 1999-2010 Gentoo Foundation
+# Copyright 1999-2011 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/sci-libs/libsvm/libsvm-2.91.ebuild,v 1.1 2010/08/05 20:25:14 bicatali Exp $
+# $Header: /var/cvsroot/gentoo-x86/sci-libs/libsvm/libsvm-3.1.ebuild,v 1.1 2011/08/09 04:46:36 bicatali Exp $
EAPI="3"
SUPPORT_PYTHON_ABIS="1"
-inherit eutils java-pkg-opt-2 python
+inherit eutils java-pkg-opt-2 python flag-o-matic toolchain-funcs
-MY_P="${PN}-${PV%0}"
-
-DESCRIPTION="Library for Support Vector Machines"
+DESCRIPTION="Library for Support Vector Mahcines"
HOMEPAGE="http://www.csie.ntu.edu.tw/~cjlin/libsvm/"
-SRC_URI="http://www.csie.ntu.edu.tw/~cjlin/libsvm/${MY_P}.tar.gz"
+SRC_URI="http://www.csie.ntu.edu.tw/~cjlin/libsvm/${P}.tar.gz"
LICENSE="BSD"
SLOT="0"
KEYWORDS="~amd64 ~ppc ~ppc64 ~x86"
-IUSE="java python tools"
+IUSE="java openmp python tools"
DEPEND="java? ( >=virtual/jdk-1.4 )"
RDEPEND="${DEPEND}
tools? ( sci-visualization/gnuplot )"
-S="${WORKDIR}"/${MY_P}
+pkg_setup() {
+ if use openmp; then
+ if [[ $(tc-getCC)$ == *gcc* ]] && ! tc-has-openmp; then
+ ewarn "You are using gcc and OpenMP is only available with gcc >= 4.2 "
+ die "Need an OpenMP capable compiler"
+ else
+ append-ldflags -fopenmp
+ append-cxxflags -fopenmp
+ fi
+ append-cxxflags -DOPENMP
+ fi
+}
src_prepare() {
- epatch "${FILESDIR}"/${PV}-makefile.patch
+ epatch "${FILESDIR}"/3.0-makefile.patch
+ epatch "${FILESDIR}"/${PV}-openmp.patch
sed -i -e "s@\.\./@${EPREFIX}/usr/bin/@g" tools/*.py \
|| die "Failed to fix paths in python files"
if use java; then