public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Justin Lecher" <jlec@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/sci:master commit in: sci-libs/magma/
Date: Mon, 18 Nov 2013 08:01:40 +0000 (UTC)	[thread overview]
Message-ID: <1384720500.d05d18d95b0b154f3446f832f25fd6a0c5c3d3b8.jlec@gentoo> (raw)

commit:     d05d18d95b0b154f3446f832f25fd6a0c5c3d3b8
Author:     Andreas Schäfer <gentryx <AT> gmx <DOT> de>
AuthorDate: Sun Nov 17 20:35:00 2013 +0000
Commit:     Justin Lecher <jlec <AT> gentoo <DOT> org>
CommitDate: Sun Nov 17 20:35:00 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/sci.git;a=commit;h=d05d18d9

added Magma 1.4.0 ebuild

---
 sci-libs/magma/magma-1.4.0.ebuild | 122 ++++++++++++++++++++++++++++++++++++++
 1 file changed, 122 insertions(+)

diff --git a/sci-libs/magma/magma-1.4.0.ebuild b/sci-libs/magma/magma-1.4.0.ebuild
new file mode 100644
index 0000000..b17c326
--- /dev/null
+++ b/sci-libs/magma/magma-1.4.0.ebuild
@@ -0,0 +1,122 @@
+# Copyright 1999-2013 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI=4
+
+FORTRAN_STANDARD="77 90"
+inherit eutils fortran-2 multilib toolchain-funcs versionator
+
+DESCRIPTION="Matrix Algebra on GPU and Multicore Architectures"
+HOMEPAGE="http://icl.cs.utk.edu/magma/"
+SRC_URI="http://icl.cs.utk.edu/projectsfiles/${PN}/downloads/${P}.tar.gz"
+
+LICENSE="BSD"
+SLOT="0"
+KEYWORDS="~amd64 ~x86 ~amd64-linux ~x86-linux"
+IUSE="fermi kepler static-libs"
+
+RDEPEND="
+	dev-util/nvidia-cuda-toolkit
+	virtual/cblas
+	virtual/fortran
+	virtual/lapack"
+DEPEND="${RDEPEND}
+	virtual/pkgconfig"
+
+# We have to have write acccess /dev/nvidia0 and /dev/nvidiactl and the portage
+# user is (usually) not in the video group
+RESTRICT="userpriv"
+
+static_to_shared() {
+	local libstatic=${1}; shift
+	local libname=$(basename ${libstatic%.a})
+	local soname=${libname}$(get_libname $(get_version_component_range 1-2))
+	local libdir=$(dirname ${libstatic})
+
+	einfo "Making ${soname} from ${libstatic}"
+	if [[ ${CHOST} == *-darwin* ]] ; then
+		${LINK:-$(tc-getCC)} ${LDFLAGS}  \
+			-dynamiclib -install_name "${EPREFIX}"/usr/lib/"${soname}" \
+			-Wl,-all_load -Wl,${libstatic} \
+			"$@" -o ${libdir}/${soname} || die "${soname} failed"
+	else
+		${LINK:-$(tc-getCC)} ${LDFLAGS}  \
+			-shared -Wl,-soname=${soname} \
+			-Wl,--whole-archive ${libstatic} -Wl,--no-whole-archive \
+			"$@" -o ${libdir}/${soname} || die "${soname} failed"
+		[[ $(get_version_component_count) -gt 1 ]] && \
+			ln -s ${soname} ${libdir}/${libname}$(get_libname $(get_major_version))
+		ln -s ${soname} ${libdir}/${libname}$(get_libname)
+	fi
+}
+
+src_prepare() {
+	# distributed pc file not so useful so replace it
+	cat <<-EOF > ${PN}.pc
+		prefix=${EPREFIX}/usr
+		libdir=\${prefix}/$(get_libdir)
+		includedir=\${prefix}/include/${PN}
+		Name: ${PN}
+		Description: ${DESCRIPTION}
+		Version: ${PV}
+		URL: ${HOMEPAGE}
+		Libs: -L\${libdir} -lmagma -lmagmablas
+		Libs.private: -lm -lpthread -ldl -lcublas -lcudart
+		Cflags: -I\${includedir}
+		Requires: cblas lapack
+	EOF
+}
+
+src_configure() {
+	cat <<-EOF > make.inc
+		ARCH = $(tc-getAR)
+		ARCHFLAGS = cr
+		RANLIB = $(tc-getRANLIB)
+		NVCC = nvcc
+		CC = $(tc-getCXX)
+		FORT = $(tc-getFC)
+		INC = -I"${EPREFIX}/opt/cuda/include" -DADD_ -DCUBLAS_GFORTRAN
+		OPTS = ${CFLAGS} -fPIC
+		FOPTS = ${FFLAGS} -fPIC -x f95-cpp-input
+		F77OPTS = ${FFLAGS} -fPIC
+		NVOPTS = -DADD_ --compiler-options '-fPIC ${CFLAGS}' -DUNIX
+		LOADER = $(tc-getFC)
+		LIBBLAS = $($(tc-getPKG_CONFIG) --libs cblas)
+		LIBLAPACK = $($(tc-getPKG_CONFIG) --libs lapack)
+		CUDADIR = ${EPREFIX}/opt/cuda
+		LIBCUDA = -L\$(CUDADIR)/$(get_libdir) -lcublas -lcudart
+		LIB = -pthread -lm -ldl \$(LIBCUDA) \$(LIBBLAS) \$(LIBLAPACK) -lstdc++
+	EOF
+	if use kepler; then
+		echo >> make.inc "GPU_TARGET = Kepler"
+	elif use fermi; then
+		echo >> make.inc "GPU_TARGET = Fermi"
+	else # See http://icl.cs.utk.edu/magma/forum/viewtopic.php?f=2&t=227
+		echo >> make.inc "GPU_TARGET = Tesla"
+	fi
+}
+
+src_compile() {
+	emake lib
+	emake shared
+}
+
+src_test() {
+	emake test lapacktest
+	cd testing/lin
+	# we need to access this while running the tests
+	addwrite /dev/nvidiactl
+	addwrite /dev/nvidia0
+	LD_LIBRARY_PATH=${S}/lib python lapack_testing.py || die
+}
+
+src_install() {
+	dolib.so lib/lib*$(get_libname)*
+	use static-libs && dolib.a lib/lib*.a
+	insinto /usr/include/${PN}
+	doins include/*.h
+	insinto /usr/$(get_libdir)/pkgconfig
+	doins ${PN}.pc
+	dodoc README ReleaseNotes
+}


             reply	other threads:[~2013-11-18  8:01 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-18  8:01 Justin Lecher [this message]
  -- strict thread matches above, loose matches on Subject: below --
2013-12-28 18:59 [gentoo-commits] proj/sci:master commit in: sci-libs/magma/ Justin Lecher
2013-01-03  0:20 Sebastien Fabbro
2013-01-03  0:20 Sebastien Fabbro
2012-07-12 20:43 Sebastien Fabbro

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1384720500.d05d18d95b0b154f3446f832f25fd6a0c5c3d3b8.jlec@gentoo \
    --to=jlec@gentoo.org \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox