Gentoo Archives: gentoo-commits

From: Aisha Tammy <gentoo@×××××.cc>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/sci:master commit in: sci-libs/blis-amd/, sci-libs/blis-amd/files/
Date: Thu, 08 Oct 2020 19:48:11
Message-Id: 1602186462.4d809d8e82496f7b7b3f2b5dba5ca8690a14c387.epsilon-0@gentoo
1 commit: 4d809d8e82496f7b7b3f2b5dba5ca8690a14c387
2 Author: Aisha Tammy <gentoo <AT> aisha <DOT> cc>
3 AuthorDate: Thu Oct 8 19:45:59 2020 +0000
4 Commit: Aisha Tammy <gentoo <AT> aisha <DOT> cc>
5 CommitDate: Thu Oct 8 19:47:42 2020 +0000
6 URL: https://gitweb.gentoo.org/proj/sci.git/commit/?id=4d809d8e
7
8 sci-libs/blis-amd: optimized blis for AMD CPUs
9
10 Package-Manager: Portage-3.0.8, Repoman-3.0.1
11 Signed-off-by: Aisha Tammy <gentoo <AT> aisha.cc>
12
13 sci-libs/blis-amd/blis-amd-2.2.ebuild | 128 +++++++++++++++++++++
14 sci-libs/blis-amd/blis-amd-9999.ebuild | 128 +++++++++++++++++++++
15 .../blis-amd/files/blis-amd-2.2-blas_rpath.patch | 46 ++++++++
16 sci-libs/blis-amd/metadata.xml | 21 ++++
17 4 files changed, 323 insertions(+)
18
19 diff --git a/sci-libs/blis-amd/blis-amd-2.2.ebuild b/sci-libs/blis-amd/blis-amd-2.2.ebuild
20 new file mode 100644
21 index 000000000..eb6c16385
22 --- /dev/null
23 +++ b/sci-libs/blis-amd/blis-amd-2.2.ebuild
24 @@ -0,0 +1,128 @@
25 +# Copyright 1999-2020 Gentoo Authors
26 +# Distributed under the terms of the GNU General Public License v2
27 +
28 +EAPI=7
29 +
30 +PYTHON_COMPAT=( python3_{7..9} )
31 +inherit fortran-2 python-any-r1
32 +
33 +DESCRIPTION="AMD optimized BLAS-like Library Instantiation Software Framework"
34 +HOMEPAGE="https://developer.amd.com/amd-aocl/"
35 +
36 +if [[ ${PV} == 9999 ]]; then
37 + inherit git-r3
38 + EGIT_REPO_URI="https://github.com/amd/blis"
39 +else
40 + SRC_URI="https://github.com/amd/blis/archive/${PV}.tar.gz -> ${P}.tar.gz"
41 + S="${WORKDIR}"/blis-"${PV}"
42 + KEYWORDS="~amd64 ~arm ~arm64 ~ppc ~ppc64 ~x86"
43 +fi
44 +
45 +LICENSE="BSD"
46 +SLOT="0"
47 +IUSE="64bit-index doc eselect-ldso openmp pthread static-libs"
48 +REQUIRED_USE="?? ( openmp pthread ) ?? ( eselect-ldso 64bit-index )"
49 +
50 +RDEPEND+="
51 + >=app-eselect/eselect-blas-0.2
52 + !sci-libs/blis
53 +"
54 +DEPEND+="${RDEPEND}
55 + ${PYTHON_DEPS}
56 +"
57 +
58 +PATCHES=(
59 + "${FILESDIR}"/${P}-blas_rpath.patch
60 +)
61 +
62 +pkg_pretend() {
63 + elog "It is very important that you set the BLIS_CONFNAME"
64 + elog "variable when compiling blis as it tunes the"
65 + elog "compilation to the specific CPU architecture."
66 + elog "To look at valid BLIS_CONFNAMEs, look at directories in"
67 + elog "\t https://github.com/amd/blis/tree/master/config"
68 + elog "At the very least, it should be set to the ARCH of"
69 + elog "the machine this will be run on, which gives a"
70 + elog "performance increase of ~4-5x."
71 +}
72 +
73 +src_configure() {
74 + local myconf=(
75 + --prefix="${BROOT}"/usr
76 + --libdir="${BROOT}"/usr/$(get_libdir)
77 + --enable-cblas
78 + --enable-blas
79 + --enable-arg-max-hack
80 + --enable-verbose-make
81 + --without-memkind
82 + --enable-shared
83 + $(use_enable static-libs static)
84 + )
85 +
86 + use 64bit-index && \
87 + myconf+=(
88 + --int-size=64
89 + --blas-int-size=64
90 + )
91 +
92 + # threading backend - openmp/pthreads/no
93 + if use openmp; then
94 + myconf+=( --enable-threading=openmp )
95 + elif use pthread; then
96 + myconf+=( --enable-threading=pthreads )
97 + else
98 + myconf+=( --enable-threading=no )
99 + fi
100 +
101 + # not an autotools configure script
102 + ./configure "${myconf[@]}" \
103 + "${EXTRA_ECONF[@]}" \
104 + ${BLIS_CONFNAME:-generic} || die
105 +}
106 +
107 +src_compile() {
108 + SET_RPATH=no \
109 + DEB_LIBBLAS=libblas.so.3 \
110 + DEB_LIBCBLAS=libcblas.so.3 \
111 + default
112 +}
113 +
114 +src_test() {
115 + emake check
116 +}
117 +
118 +src_install() {
119 + default
120 + use doc && dodoc README.md docs/*.md
121 +
122 + use eselect-ldso || return
123 +
124 + insinto /usr/$(get_libdir)/blas/blis-amd
125 + doins lib/${BLIS_CONFNAME:-generic}/lib{c,}blas.so.3
126 + dosym libblas.so.3 usr/$(get_libdir)/blas/blis-amd/libblas.so
127 + dosym libcblas.so.3 usr/$(get_libdir)/blas/blis-amd/libcblas.so
128 +}
129 +
130 +pkg_postinst() {
131 + use eselect-ldso || return
132 +
133 + local libdir=$(get_libdir) me="blis-amd"
134 +
135 + # check blas
136 + elog "adding ${me}"
137 + eselect blas add ${libdir} "${EROOT}"/usr/${libdir}/blas/${me} ${me}
138 + elog "added ${me}"
139 + local current_blas=$(eselect blas show ${libdir} | cut -d' ' -f2)
140 + if [[ ${current_blas} == "${me}" || -z ${current_blas} ]]; then
141 + eselect blas set ${libdir} ${me}
142 + elog "Current eselect: BLAS/CBLAS ($libdir) -> [${current_blas}]."
143 + else
144 + elog "Current eselect: BLAS/CBLAS ($libdir) -> [${current_blas}]."
145 + elog "To use blas [${me}] implementation, you have to issue (as root):"
146 + elog "\t eselect blas set ${libdir} ${me}"
147 + fi
148 +}
149 +
150 +pkg_postrm() {
151 + use eselect-ldso && eselect blas validate
152 +}
153
154 diff --git a/sci-libs/blis-amd/blis-amd-9999.ebuild b/sci-libs/blis-amd/blis-amd-9999.ebuild
155 new file mode 100644
156 index 000000000..672277b36
157 --- /dev/null
158 +++ b/sci-libs/blis-amd/blis-amd-9999.ebuild
159 @@ -0,0 +1,128 @@
160 +# Copyright 1999-2020 Gentoo Authors
161 +# Distributed under the terms of the GNU General Public License v2
162 +
163 +EAPI=7
164 +
165 +PYTHON_COMPAT=( python3_{7..9} )
166 +inherit fortran-2 python-any-r1
167 +
168 +DESCRIPTION="AMD optimized BLAS-like Library Instantiation Software Framework"
169 +HOMEPAGE="https://developer.amd.com/amd-aocl/"
170 +
171 +if [[ ${PV} == 9999 ]]; then
172 + inherit git-r3
173 + EGIT_REPO_URI="https://github.com/amd/blis"
174 +else
175 + SRC_URI="https://github.com/amd/blis/archive/${PV}.tar.gz -> ${P}.tar.gz"
176 + S="${WORKDIR}"/blis-"${PV}"
177 + KEYWORDS="~amd64 ~arm ~arm64 ~ppc ~ppc64 ~x86"
178 +fi
179 +
180 +LICENSE="BSD"
181 +SLOT="0"
182 +IUSE="64bit-index doc eselect-ldso openmp pthread static-libs"
183 +REQUIRED_USE="?? ( openmp pthread ) ?? ( eselect-ldso 64bit-index )"
184 +
185 +RDEPEND+="
186 + >=app-eselect/eselect-blas-0.2
187 + !sci-libs/blis
188 +"
189 +DEPEND+="${RDEPEND}
190 + ${PYTHON_DEPS}
191 +"
192 +
193 +PATCHES=(
194 + "${FILESDIR}"/${PN}-2.2-blas_rpath.patch
195 +)
196 +
197 +pkg_pretend() {
198 + elog "It is very important that you set the BLIS_CONFNAME"
199 + elog "variable when compiling blis as it tunes the"
200 + elog "compilation to the specific CPU architecture."
201 + elog "To look at valid BLIS_CONFNAMEs, look at directories in"
202 + elog "\t https://github.com/amd/blis/tree/master/config"
203 + elog "At the very least, it should be set to the ARCH of"
204 + elog "the machine this will be run on, which gives a"
205 + elog "performance increase of ~4-5x."
206 +}
207 +
208 +src_configure() {
209 + local myconf=(
210 + --prefix="${BROOT}"/usr
211 + --libdir="${BROOT}"/usr/$(get_libdir)
212 + --enable-cblas
213 + --enable-blas
214 + --enable-arg-max-hack
215 + --enable-verbose-make
216 + --without-memkind
217 + --enable-shared
218 + $(use_enable static-libs static)
219 + )
220 +
221 + use 64bit-index && \
222 + myconf+=(
223 + --int-size=64
224 + --blas-int-size=64
225 + )
226 +
227 + # threading backend - openmp/pthreads/no
228 + if use openmp; then
229 + myconf+=( --enable-threading=openmp )
230 + elif use pthread; then
231 + myconf+=( --enable-threading=pthreads )
232 + else
233 + myconf+=( --enable-threading=no )
234 + fi
235 +
236 + # not an autotools configure script
237 + ./configure "${myconf[@]}" \
238 + "${EXTRA_ECONF[@]}" \
239 + ${BLIS_CONFNAME:-generic} || die
240 +}
241 +
242 +src_compile() {
243 + SET_RPATH=no \
244 + DEB_LIBBLAS=libblas.so.3 \
245 + DEB_LIBCBLAS=libcblas.so.3 \
246 + default
247 +}
248 +
249 +src_test() {
250 + emake check
251 +}
252 +
253 +src_install() {
254 + default
255 + use doc && dodoc README.md docs/*.md
256 +
257 + use eselect-ldso || return
258 +
259 + insinto /usr/$(get_libdir)/blas/blis-amd
260 + doins lib/${BLIS_CONFNAME:-generic}/lib{c,}blas.so.3
261 + dosym libblas.so.3 usr/$(get_libdir)/blas/blis-amd/libblas.so
262 + dosym libcblas.so.3 usr/$(get_libdir)/blas/blis-amd/libcblas.so
263 +}
264 +
265 +pkg_postinst() {
266 + use eselect-ldso || return
267 +
268 + local libdir=$(get_libdir) me="blis-amd"
269 +
270 + # check blas
271 + elog "adding ${me}"
272 + eselect blas add ${libdir} "${EROOT}"/usr/${libdir}/blas/${me} ${me}
273 + elog "added ${me}"
274 + local current_blas=$(eselect blas show ${libdir} | cut -d' ' -f2)
275 + if [[ ${current_blas} == "${me}" || -z ${current_blas} ]]; then
276 + eselect blas set ${libdir} ${me}
277 + elog "Current eselect: BLAS/CBLAS ($libdir) -> [${current_blas}]."
278 + else
279 + elog "Current eselect: BLAS/CBLAS ($libdir) -> [${current_blas}]."
280 + elog "To use blas [${me}] implementation, you have to issue (as root):"
281 + elog "\t eselect blas set ${libdir} ${me}"
282 + fi
283 +}
284 +
285 +pkg_postrm() {
286 + use eselect-ldso && eselect blas validate
287 +}
288
289 diff --git a/sci-libs/blis-amd/files/blis-amd-2.2-blas_rpath.patch b/sci-libs/blis-amd/files/blis-amd-2.2-blas_rpath.patch
290 new file mode 100644
291 index 000000000..90ab11d52
292 --- /dev/null
293 +++ b/sci-libs/blis-amd/files/blis-amd-2.2-blas_rpath.patch
294 @@ -0,0 +1,46 @@
295 +diff --git a/Makefile b/Makefile
296 +index ea7a550..1b3a1d2 100644
297 +--- a/Makefile
298 ++++ b/Makefile
299 +@@ -689,6 +689,9 @@ else
300 + endif
301 + endif
302 +
303 ++ $(LINKER) $(SOFLAGS) -o $(BASE_LIB_PATH)/$(DEB_LIBBLAS) $? $(LDFLAGS) -Wl,--soname,$(DEB_LIBBLAS)
304 ++ $(LINKER) $(SOFLAGS) -o $(BASE_LIB_PATH)/$(DEB_LIBCBLAS) $? $(LDFLAGS) -Wl,--soname,$(DEB_LIBCBLAS)
305 ++
306 + # Local symlink for shared library.
307 + # NOTE: We use a '.loc' suffix to avoid filename collisions in case this
308 + # rule is executed concurrently with the install-lib-symlinks rule, which
309 +diff --git a/common.mk b/common.mk
310 +index e73a5d1..2aa8a23 100644
311 +--- a/common.mk
312 ++++ b/common.mk
313 +@@ -565,11 +565,14 @@ ifeq ($(MK_ENABLE_SHARED),yes)
314 + ifeq ($(MK_ENABLE_STATIC),no)
315 + LIBBLIS_L := $(LIBBLIS_SO)
316 + LIBBLIS_LINK := $(LIBBLIS_SO_PATH)
317 ++SET_RPATH ?= yes
318 + ifeq ($(IS_WIN),no)
319 ++ifeq ($(SET_RPATH),yes)
320 + # For Linux and OS X: set rpath property of shared object.
321 + LDFLAGS += -Wl,-rpath,$(BASE_LIB_PATH)
322 + endif
323 + endif
324 ++endif
325 + # On windows, use the shared library even if static is created.
326 + ifeq ($(IS_WIN),yes)
327 + LIBBLIS_L := $(LIBBLIS_SO)
328 +diff --git a/configure b/configure
329 +index 35d4f1d..93c2cd6 100755
330 +--- a/configure
331 ++++ b/configure
332 +@@ -3055,7 +3055,7 @@ main()
333 + enable_aocl_zen='yes'
334 + enable_aocl_zen_01=1
335 + else
336 +- enable_aocl_zen = 'no';
337 ++ enable_aocl_zen='no';
338 + enable_aocl_zen_01=0;
339 + fi
340 +
341
342 diff --git a/sci-libs/blis-amd/metadata.xml b/sci-libs/blis-amd/metadata.xml
343 new file mode 100644
344 index 000000000..1a481192a
345 --- /dev/null
346 +++ b/sci-libs/blis-amd/metadata.xml
347 @@ -0,0 +1,21 @@
348 +<?xml version="1.0" encoding="UTF-8"?>
349 +<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
350 +<pkgmetadata>
351 + <maintainer type="person">
352 + <email>gentoo@×××××.cc</email>
353 + <name>Aisha Tammy</name>
354 + </maintainer>
355 + <maintainer type="project">
356 + <email>sci@g.o</email>
357 + <name>Gentoo Science Project</name>
358 + </maintainer>
359 + <upstream>
360 + <remote-id type="github">amd/libflame</remote-id>
361 + </upstream>
362 + <use>
363 + <flag name="64bit-index">Enable 64bit array indexing, incompatible with runtime switching</flag>
364 + <flag name="eselect-ldso">Enable runtime library switching by eselect and ld.so</flag>
365 + <flag name="openmp">Use openmp threadding model</flag>
366 + <flag name="pthread">Use pthread threadding model</flag>
367 + </use>
368 +</pkgmetadata>