Skip to content

Commit 3513729

Browse files
committed
sci-libs/magma: bump to version 2.4.0
New package in overlay, bumped and reworked from version 1.4.1::gentoo Package-Manager: Portage-2.3.69, Repoman-2.3.16 Signed-off-by: Bernd Waibel <[email protected]>
1 parent 90cdb3d commit 3513729

File tree

3 files changed

+177
-0
lines changed

3 files changed

+177
-0
lines changed

sci-libs/magma/Manifest

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
DIST magma-2.4.0.tar.gz 7687575 BLAKE2B e111c261d42e4192729e63c3ca971fd0f003802431bd423a37cb5ec6fb1d281e311fc49ac974a33bc2b91f355ae4da1e3febe5c96dc7361adfdbefaa162a321e SHA512 ea72136fd52371f445f608c4a6d247c535793d51376f32ad57ca81767e3629285463597883adc988e532a7e93282885ff1dd8f83e5cfd61748abefce63990274

sci-libs/magma/magma-2.4.0.ebuild

Lines changed: 155 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,155 @@
1+
# Copyright 1999-2019 Gentoo Authors
2+
# Distributed under the terms of the GNU General Public License v2
3+
4+
# TODO
5+
# 1. Open issue on science-overlay to add a possibility for installing
6+
# xlintstc and other test programs from lapack-reference!
7+
# 2. Keep an eye on the cmake implementation. Does not work currently,
8+
# check again on bumps.
9+
10+
EAPI=7
11+
12+
PYTHON_COMPAT=( python2_7 )
13+
FORTRAN_STANDARD="77 90"
14+
15+
inherit cuda flag-o-matic fortran-2 multilib toolchain-funcs python-any-r1
16+
17+
MY_PV=$(ver_rs 3 '-')
18+
19+
DESCRIPTION="Matrix Algebra on GPU and Multicore Architectures"
20+
HOMEPAGE="https://icl.cs.utk.edu/magma/"
21+
SRC_URI="https://icl.cs.utk.edu/projectsfiles/${PN}/downloads/${PN}-${MY_PV}.tar.gz -> ${P}.tar.gz"
22+
23+
LICENSE="BSD"
24+
SLOT="0"
25+
KEYWORDS="~amd64"
26+
IUSE="doc kepler maxwell pascal sparse static-libs test volta"
27+
28+
RDEPEND="
29+
dev-util/nvidia-cuda-toolkit:=
30+
virtual/blas
31+
virtual/lapack
32+
"
33+
DEPEND="
34+
${RDEPEND}
35+
test? ( ${PYTHON_DEPS} )
36+
"
37+
BDEPEND="
38+
virtual/pkgconfig
39+
doc? ( >=app-doc/doxygen-1.8.14-r1[dot] )
40+
"
41+
42+
# We have to have write acccess /dev/nvidia0 and /dev/nvidiactl and the portage
43+
# user is (usually) not in the video group
44+
RESTRICT="!test? ( test )"
45+
46+
pkg_setup() {
47+
fortran-2_pkg_setup
48+
use test && python-any-r1_pkg_setup
49+
tc-check-openmp || die "Need OpenMP to compile ${P}"
50+
}
51+
52+
src_prepare() {
53+
# distributed pc file not so useful so replace it
54+
cat <<-EOF > ${PN}.pc
55+
prefix=${EPREFIX}/usr
56+
libdir=\${prefix}/$(get_libdir)
57+
includedir=\${prefix}/include/${PN}
58+
Name: ${PN}
59+
Description: ${DESCRIPTION}
60+
Version: ${PV}
61+
URL: ${HOMEPAGE}
62+
Libs: -L\${libdir} -lmagma
63+
Libs.private: -lm -lpthread -ldl -lcublas -lcudart -lcusparse
64+
Cflags: -I\${includedir}
65+
Requires: blas lapack
66+
EOF
67+
68+
if [[ $(tc-getCC) =~ gcc ]]; then
69+
local eopenmp=-fopenmp
70+
elif [[ $(tc-getCC) =~ icc ]]; then
71+
local eopenmp=-openmp
72+
else
73+
elog "Cannot detect compiler type so not setting openmp support"
74+
fi
75+
append-flags -fPIC ${eopenmp}
76+
append-ldflags -Wl,-soname,lib${PN}.so.2.4 ${eopenmp}
77+
78+
cuda_src_prepare
79+
default
80+
}
81+
82+
src_configure() {
83+
cat <<-EOF > make.inc
84+
ARCH = $(tc-getAR)
85+
ARCHFLAGS = cr
86+
RANLIB = $(tc-getRANLIB)
87+
NVCC = nvcc
88+
CC = $(tc-getCXX)
89+
FORT = $(tc-getFC)
90+
INC = -I"${EPREFIX}/opt/cuda/include" -DADD_ -DCUBLAS_GFORTRAN
91+
CFLAGS = ${CFLAGS} -fPIC
92+
CXXFLAGS = ${CXXFLAGS} -fPIC
93+
F90FLAGS = ${FFLAGS} -fPIC -x f95-cpp-input
94+
FFLAGS = ${FFLAGS} -fPIC
95+
NVCCFLAGS = -DADD_ -DUNIX ${NVCCFLAGS}
96+
LDOPTS = ${LDFLAGS}
97+
LOADER = $(tc-getFC)
98+
LIBBLAS = $($(tc-getPKG_CONFIG) --libs blas)
99+
LIBLAPACK = $($(tc-getPKG_CONFIG) --libs lapack)
100+
CUDADIR = ${EPREFIX}/opt/cuda
101+
LIBCUDA = -L\$(CUDADIR)/$(get_libdir) -lcublas -lcudart -lcusparse
102+
LIB = -pthread -lm -ldl \$(LIBCUDA) \$(LIBBLAS) \$(LIBLAPACK) -lstdc++
103+
EOF
104+
if use volta; then
105+
echo >> make.inc "GPU_TARGET = Volta"
106+
elif use pascal; then
107+
echo >> make.inc "GPU_TARGET = Pascal"
108+
elif use maxwell; then
109+
echo >> make.inc "GPU_TARGET = Maxwell"
110+
elif use kepler; then
111+
echo >> make.inc "GPU_TARGET = Kepler"
112+
else # See http://icl.cs.utk.edu/magma/forum/viewtopic.php?f=2&t=227
113+
# Minimal arch supported is Fermi as of 2.4.0
114+
echo >> make.inc "GPU_TARGET = Fermi"
115+
fi
116+
}
117+
118+
src_compile() {
119+
emake lib
120+
use sparse && emake sparse-lib
121+
emake shared
122+
mv lib/lib${PN}.so{,.2.4} || die
123+
ln -sf lib${PN}.so.2.4 lib/lib${PN}.so.2 || die
124+
ln -sf lib${PN}.so.2.4 lib/lib${PN}.so || die
125+
if use sparse; then
126+
mv lib/lib${PN}_sparse.so{,.2.4} || die
127+
ln -sf lib${PN}_sparse.so.2.4 lib/lib${PN}_sparse.so.2 || die
128+
ln -sf lib${PN}_sparse.so.2.4 lib/lib${PN}_sparse.so || die
129+
fi
130+
}
131+
132+
src_test() {
133+
emake test
134+
# FIXME: sparse-test currently fails
135+
use sparse && emake sparse-test
136+
cd testing/lin || die
137+
# we need to access this while running the tests
138+
cuda_add_sandbox -w # replaces addwrite /dev/nvidia{ctl,0}
139+
# FIXME: The python file needs the xlintstc program from
140+
# lapack-reference test suite, which is not installed, even
141+
# if lapack-reference is compiled with FEATURES="test". See TODO
142+
LD_LIBRARY_PATH="${S}"/lib ${EPYTHON} lapack_testing.py || die
143+
}
144+
145+
src_install() {
146+
dolib.so lib/lib*$(get_libname)*
147+
use static-libs && dolib.a lib/lib*.a
148+
insinto /usr/include/${PN}
149+
doins include/*.h
150+
insinto /usr/$(get_libdir)/pkgconfig
151+
doins ${PN}.pc
152+
local DOCS=( README ReleaseNotes )
153+
use doc && local HTML_DOCS=( docs/html/. )
154+
einstalldocs
155+
}

sci-libs/magma/metadata.xml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
3+
<pkgmetadata>
4+
<maintainer type="person">
5+
<email>[email protected]</email>
6+
<name>Bernd Waibel</name>
7+
</maintainer>
8+
<longdescription lang="en">
9+
The Matrix Algebra on GPU and Multicore Architecture project aims to
10+
develop a dense linear algebra library similar to LAPACK but for
11+
heterogeneous/hybrid architectures, starting with current
12+
"Multicore+GPU" systems.
13+
</longdescription>
14+
<use>
15+
<flag name="kepler">Compile for GPU NVIDIA Kepler family (sm_3x)</flag>
16+
<flag name="maxwell">Compile for GPU NVIDIA Maxwell family (sm_5x)</flag>
17+
<flag name="pascal">Compile for GPU NVIDIA Pascal family (sm_6x)</flag>
18+
<flag name="sparse">Additionally build the sparse matrix library</flag>
19+
<flag name="volta">Compile for GPU NVIDIA Volta family (sm_7x)</flag>
20+
</use>
21+
</pkgmetadata>

0 commit comments

Comments
 (0)