aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAisha Tammy <gentoo@aisha.cc>2020-10-08 19:45:59 +0000
committerAisha Tammy <gentoo@aisha.cc>2020-10-08 19:47:42 +0000
commit4d809d8e82496f7b7b3f2b5dba5ca8690a14c387 (patch)
tree32d5f8fe4ef019127239016b3ac34b31ebebb7c7
parentdev-util/ndctl: nvdimm controller for kernel (diff)
downloadsci-4d809d8e.tar.gz
sci-4d809d8e.tar.bz2
sci-4d809d8e.zip
sci-libs/blis-amd: optimized blis for AMD CPUs
Package-Manager: Portage-3.0.8, Repoman-3.0.1 Signed-off-by: Aisha Tammy <gentoo@aisha.cc>
-rw-r--r--sci-libs/blis-amd/Manifest1
-rw-r--r--sci-libs/blis-amd/blis-amd-2.2.ebuild128
-rw-r--r--sci-libs/blis-amd/blis-amd-9999.ebuild128
-rw-r--r--sci-libs/blis-amd/files/blis-amd-2.2-blas_rpath.patch46
-rw-r--r--sci-libs/blis-amd/metadata.xml21
5 files changed, 324 insertions, 0 deletions
diff --git a/sci-libs/blis-amd/Manifest b/sci-libs/blis-amd/Manifest
new file mode 100644
index 000000000..86192778f
--- /dev/null
+++ b/sci-libs/blis-amd/Manifest
@@ -0,0 +1 @@
+DIST blis-amd-2.2.tar.gz 9066754 BLAKE2B 9425a927b8dd37cc5a0843a0c5d7958906bcdbdd83b015d2428e2372e0cdc6206ed8ab9c4c0c6e6eccee091498b524061ffed8adcd9b0c857cc9c64446b3a19f SHA512 a7d58bda40c833b5388e0f7b316352cfcb186db535534682b647e2ca7b130518959b3c78043261e9f1f85f99a168bd20b919c6c2c184ee4f4d269da88d41a5d6
diff --git a/sci-libs/blis-amd/blis-amd-2.2.ebuild b/sci-libs/blis-amd/blis-amd-2.2.ebuild
new file mode 100644
index 000000000..eb6c16385
--- /dev/null
+++ b/sci-libs/blis-amd/blis-amd-2.2.ebuild
@@ -0,0 +1,128 @@
+# Copyright 1999-2020 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+PYTHON_COMPAT=( python3_{7..9} )
+inherit fortran-2 python-any-r1
+
+DESCRIPTION="AMD optimized BLAS-like Library Instantiation Software Framework"
+HOMEPAGE="https://developer.amd.com/amd-aocl/"
+
+if [[ ${PV} == 9999 ]]; then
+ inherit git-r3
+ EGIT_REPO_URI="https://github.com/amd/blis"
+else
+ SRC_URI="https://github.com/amd/blis/archive/${PV}.tar.gz -> ${P}.tar.gz"
+ S="${WORKDIR}"/blis-"${PV}"
+ KEYWORDS="~amd64 ~arm ~arm64 ~ppc ~ppc64 ~x86"
+fi
+
+LICENSE="BSD"
+SLOT="0"
+IUSE="64bit-index doc eselect-ldso openmp pthread static-libs"
+REQUIRED_USE="?? ( openmp pthread ) ?? ( eselect-ldso 64bit-index )"
+
+RDEPEND+="
+ >=app-eselect/eselect-blas-0.2
+ !sci-libs/blis
+"
+DEPEND+="${RDEPEND}
+ ${PYTHON_DEPS}
+"
+
+PATCHES=(
+ "${FILESDIR}"/${P}-blas_rpath.patch
+)
+
+pkg_pretend() {
+ elog "It is very important that you set the BLIS_CONFNAME"
+ elog "variable when compiling blis as it tunes the"
+ elog "compilation to the specific CPU architecture."
+ elog "To look at valid BLIS_CONFNAMEs, look at directories in"
+ elog "\t https://github.com/amd/blis/tree/master/config"
+ elog "At the very least, it should be set to the ARCH of"
+ elog "the machine this will be run on, which gives a"
+ elog "performance increase of ~4-5x."
+}
+
+src_configure() {
+ local myconf=(
+ --prefix="${BROOT}"/usr
+ --libdir="${BROOT}"/usr/$(get_libdir)
+ --enable-cblas
+ --enable-blas
+ --enable-arg-max-hack
+ --enable-verbose-make
+ --without-memkind
+ --enable-shared
+ $(use_enable static-libs static)
+ )
+
+ use 64bit-index && \
+ myconf+=(
+ --int-size=64
+ --blas-int-size=64
+ )
+
+ # threading backend - openmp/pthreads/no
+ if use openmp; then
+ myconf+=( --enable-threading=openmp )
+ elif use pthread; then
+ myconf+=( --enable-threading=pthreads )
+ else
+ myconf+=( --enable-threading=no )
+ fi
+
+ # not an autotools configure script
+ ./configure "${myconf[@]}" \
+ "${EXTRA_ECONF[@]}" \
+ ${BLIS_CONFNAME:-generic} || die
+}
+
+src_compile() {
+ SET_RPATH=no \
+ DEB_LIBBLAS=libblas.so.3 \
+ DEB_LIBCBLAS=libcblas.so.3 \
+ default
+}
+
+src_test() {
+ emake check
+}
+
+src_install() {
+ default
+ use doc && dodoc README.md docs/*.md
+
+ use eselect-ldso || return
+
+ insinto /usr/$(get_libdir)/blas/blis-amd
+ doins lib/${BLIS_CONFNAME:-generic}/lib{c,}blas.so.3
+ dosym libblas.so.3 usr/$(get_libdir)/blas/blis-amd/libblas.so
+ dosym libcblas.so.3 usr/$(get_libdir)/blas/blis-amd/libcblas.so
+}
+
+pkg_postinst() {
+ use eselect-ldso || return
+
+ local libdir=$(get_libdir) me="blis-amd"
+
+ # check blas
+ elog "adding ${me}"
+ eselect blas add ${libdir} "${EROOT}"/usr/${libdir}/blas/${me} ${me}
+ elog "added ${me}"
+ local current_blas=$(eselect blas show ${libdir} | cut -d' ' -f2)
+ if [[ ${current_blas} == "${me}" || -z ${current_blas} ]]; then
+ eselect blas set ${libdir} ${me}
+ elog "Current eselect: BLAS/CBLAS ($libdir) -> [${current_blas}]."
+ else
+ elog "Current eselect: BLAS/CBLAS ($libdir) -> [${current_blas}]."
+ elog "To use blas [${me}] implementation, you have to issue (as root):"
+ elog "\t eselect blas set ${libdir} ${me}"
+ fi
+}
+
+pkg_postrm() {
+ use eselect-ldso && eselect blas validate
+}
diff --git a/sci-libs/blis-amd/blis-amd-9999.ebuild b/sci-libs/blis-amd/blis-amd-9999.ebuild
new file mode 100644
index 000000000..672277b36
--- /dev/null
+++ b/sci-libs/blis-amd/blis-amd-9999.ebuild
@@ -0,0 +1,128 @@
+# Copyright 1999-2020 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+PYTHON_COMPAT=( python3_{7..9} )
+inherit fortran-2 python-any-r1
+
+DESCRIPTION="AMD optimized BLAS-like Library Instantiation Software Framework"
+HOMEPAGE="https://developer.amd.com/amd-aocl/"
+
+if [[ ${PV} == 9999 ]]; then
+ inherit git-r3
+ EGIT_REPO_URI="https://github.com/amd/blis"
+else
+ SRC_URI="https://github.com/amd/blis/archive/${PV}.tar.gz -> ${P}.tar.gz"
+ S="${WORKDIR}"/blis-"${PV}"
+ KEYWORDS="~amd64 ~arm ~arm64 ~ppc ~ppc64 ~x86"
+fi
+
+LICENSE="BSD"
+SLOT="0"
+IUSE="64bit-index doc eselect-ldso openmp pthread static-libs"
+REQUIRED_USE="?? ( openmp pthread ) ?? ( eselect-ldso 64bit-index )"
+
+RDEPEND+="
+ >=app-eselect/eselect-blas-0.2
+ !sci-libs/blis
+"
+DEPEND+="${RDEPEND}
+ ${PYTHON_DEPS}
+"
+
+PATCHES=(
+ "${FILESDIR}"/${PN}-2.2-blas_rpath.patch
+)
+
+pkg_pretend() {
+ elog "It is very important that you set the BLIS_CONFNAME"
+ elog "variable when compiling blis as it tunes the"
+ elog "compilation to the specific CPU architecture."
+ elog "To look at valid BLIS_CONFNAMEs, look at directories in"
+ elog "\t https://github.com/amd/blis/tree/master/config"
+ elog "At the very least, it should be set to the ARCH of"
+ elog "the machine this will be run on, which gives a"
+ elog "performance increase of ~4-5x."
+}
+
+src_configure() {
+ local myconf=(
+ --prefix="${BROOT}"/usr
+ --libdir="${BROOT}"/usr/$(get_libdir)
+ --enable-cblas
+ --enable-blas
+ --enable-arg-max-hack
+ --enable-verbose-make
+ --without-memkind
+ --enable-shared
+ $(use_enable static-libs static)
+ )
+
+ use 64bit-index && \
+ myconf+=(
+ --int-size=64
+ --blas-int-size=64
+ )
+
+ # threading backend - openmp/pthreads/no
+ if use openmp; then
+ myconf+=( --enable-threading=openmp )
+ elif use pthread; then
+ myconf+=( --enable-threading=pthreads )
+ else
+ myconf+=( --enable-threading=no )
+ fi
+
+ # not an autotools configure script
+ ./configure "${myconf[@]}" \
+ "${EXTRA_ECONF[@]}" \
+ ${BLIS_CONFNAME:-generic} || die
+}
+
+src_compile() {
+ SET_RPATH=no \
+ DEB_LIBBLAS=libblas.so.3 \
+ DEB_LIBCBLAS=libcblas.so.3 \
+ default
+}
+
+src_test() {
+ emake check
+}
+
+src_install() {
+ default
+ use doc && dodoc README.md docs/*.md
+
+ use eselect-ldso || return
+
+ insinto /usr/$(get_libdir)/blas/blis-amd
+ doins lib/${BLIS_CONFNAME:-generic}/lib{c,}blas.so.3
+ dosym libblas.so.3 usr/$(get_libdir)/blas/blis-amd/libblas.so
+ dosym libcblas.so.3 usr/$(get_libdir)/blas/blis-amd/libcblas.so
+}
+
+pkg_postinst() {
+ use eselect-ldso || return
+
+ local libdir=$(get_libdir) me="blis-amd"
+
+ # check blas
+ elog "adding ${me}"
+ eselect blas add ${libdir} "${EROOT}"/usr/${libdir}/blas/${me} ${me}
+ elog "added ${me}"
+ local current_blas=$(eselect blas show ${libdir} | cut -d' ' -f2)
+ if [[ ${current_blas} == "${me}" || -z ${current_blas} ]]; then
+ eselect blas set ${libdir} ${me}
+ elog "Current eselect: BLAS/CBLAS ($libdir) -> [${current_blas}]."
+ else
+ elog "Current eselect: BLAS/CBLAS ($libdir) -> [${current_blas}]."
+ elog "To use blas [${me}] implementation, you have to issue (as root):"
+ elog "\t eselect blas set ${libdir} ${me}"
+ fi
+}
+
+pkg_postrm() {
+ use eselect-ldso && eselect blas validate
+}
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
new file mode 100644
index 000000000..90ab11d52
--- /dev/null
+++ b/sci-libs/blis-amd/files/blis-amd-2.2-blas_rpath.patch
@@ -0,0 +1,46 @@
+diff --git a/Makefile b/Makefile
+index ea7a550..1b3a1d2 100644
+--- a/Makefile
++++ b/Makefile
+@@ -689,6 +689,9 @@ else
+ endif
+ endif
+
++ $(LINKER) $(SOFLAGS) -o $(BASE_LIB_PATH)/$(DEB_LIBBLAS) $? $(LDFLAGS) -Wl,--soname,$(DEB_LIBBLAS)
++ $(LINKER) $(SOFLAGS) -o $(BASE_LIB_PATH)/$(DEB_LIBCBLAS) $? $(LDFLAGS) -Wl,--soname,$(DEB_LIBCBLAS)
++
+ # Local symlink for shared library.
+ # NOTE: We use a '.loc' suffix to avoid filename collisions in case this
+ # rule is executed concurrently with the install-lib-symlinks rule, which
+diff --git a/common.mk b/common.mk
+index e73a5d1..2aa8a23 100644
+--- a/common.mk
++++ b/common.mk
+@@ -565,11 +565,14 @@ ifeq ($(MK_ENABLE_SHARED),yes)
+ ifeq ($(MK_ENABLE_STATIC),no)
+ LIBBLIS_L := $(LIBBLIS_SO)
+ LIBBLIS_LINK := $(LIBBLIS_SO_PATH)
++SET_RPATH ?= yes
+ ifeq ($(IS_WIN),no)
++ifeq ($(SET_RPATH),yes)
+ # For Linux and OS X: set rpath property of shared object.
+ LDFLAGS += -Wl,-rpath,$(BASE_LIB_PATH)
+ endif
+ endif
++endif
+ # On windows, use the shared library even if static is created.
+ ifeq ($(IS_WIN),yes)
+ LIBBLIS_L := $(LIBBLIS_SO)
+diff --git a/configure b/configure
+index 35d4f1d..93c2cd6 100755
+--- a/configure
++++ b/configure
+@@ -3055,7 +3055,7 @@ main()
+ enable_aocl_zen='yes'
+ enable_aocl_zen_01=1
+ else
+- enable_aocl_zen = 'no';
++ enable_aocl_zen='no';
+ enable_aocl_zen_01=0;
+ fi
+
diff --git a/sci-libs/blis-amd/metadata.xml b/sci-libs/blis-amd/metadata.xml
new file mode 100644
index 000000000..1a481192a
--- /dev/null
+++ b/sci-libs/blis-amd/metadata.xml
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <maintainer type="person">
+ <email>gentoo@aisha.cc</email>
+ <name>Aisha Tammy</name>
+ </maintainer>
+ <maintainer type="project">
+ <email>sci@gentoo.org</email>
+ <name>Gentoo Science Project</name>
+ </maintainer>
+ <upstream>
+ <remote-id type="github">amd/libflame</remote-id>
+ </upstream>
+ <use>
+ <flag name="64bit-index">Enable 64bit array indexing, incompatible with runtime switching</flag>
+ <flag name="eselect-ldso">Enable runtime library switching by eselect and ld.so</flag>
+ <flag name="openmp">Use openmp threadding model</flag>
+ <flag name="pthread">Use pthread threadding model</flag>
+ </use>
+</pkgmetadata>