blob: 2db42ce2ecab28d1981b63d7aec1a3152cbc563a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
|
# Copyright 1999-2022 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
inherit unpacker
DESCRIPTION="Intel Math Kernel Library"
HOMEPAGE="https://www.intel.com/content/www/us/en/developer/tools/oneapi/onemkl.html"
SRC_URI="
https://apt.repos.intel.com/oneapi/pool/main/intel-oneapi-${PN}-$(ver_cut 1-3)-$(ver_cut 1-3)-$(ver_cut 4)_amd64.deb
https://apt.repos.intel.com/oneapi/pool/main/intel-oneapi-${PN}-devel-$(ver_cut 1-3)-$(ver_cut 1-3)-$(ver_cut 4)_amd64.deb
https://apt.repos.intel.com/oneapi/pool/main/intel-oneapi-${PN}-common-$(ver_cut 1-3)-$(ver_cut 1-3)-$(ver_cut 4)_all.deb
https://apt.repos.intel.com/oneapi/pool/main/intel-oneapi-${PN}-common-devel-$(ver_cut 1-3)-$(ver_cut 1-3)-$(ver_cut 4)_all.deb
"
S="${WORKDIR}"
LICENSE="ISSL"
SLOT="0"
KEYWORDS="~amd64"
IUSE="static-libs"
RESTRICT="strip"
# MKL uses Intel/LLVM OpenMP by default.
# One can change the threadding layer to "gnu" or "tbb"
# through the MKL_THREADING_LAYER env var.
RDEPEND="
app-eselect/eselect-blas
app-eselect/eselect-lapack
dev-cpp/tbb
dev-libs/opencl-icd-loader
sys-cluster/mpich
sys-libs/libomp
"
# bug #801460
BDEPEND="app-arch/xz-utils[extra-filters]"
QA_PREBUILT="*"
QA_TEXTRELS="*"
QA_SONAME="*"
src_prepare() {
default
# Drop conda stuff
rm -r opt/intel/oneapi/conda_channel || die
}
src_install() {
# Symlink pkgconfig and cmake files
pushd "opt/intel/oneapi/mkl/$(ver_cut 1-3)/lib/pkgconfig" || die
for file in *.pc; do
dosym "../../../opt/intel/oneapi/mkl/$(ver_cut 1-3)/lib/pkgconfig/${file}" "/usr/share/pkgconfig/${file}"
done
popd || die
pushd "opt/intel/oneapi/mkl/$(ver_cut 1-3)/lib/cmake/mkl" || die
for file in *.cmake; do
dosym "../../../../opt/intel/oneapi/mkl/$(ver_cut 1-3)/lib/cmake/mkl/${file}" "/usr/$(get_libdir)/cmake/mkl/${file}"
done
popd || die
# Symlink files in locale directory
pushd "opt/intel/oneapi/mkl/$(ver_cut 1-3)/lib/intel64/locale/en_US" || die
for file in *; do
dosym "../../../../opt/intel/oneapi/mkl/$(ver_cut 1-3)/lib/intel64/locale/en_US/${file}" "/usr/share/locale/en_US/${file}"
done
popd || die
# Move everything over to the image directory
mv "${S}/"* "${ED}" || die
# Create convenience symlink that does not include the version number
dosym "$(ver_cut 1-3)" /opt/intel/oneapi/mkl/latest
dodir /usr/$(get_libdir)/blas/mkl
dosym ../../../../opt/intel/oneapi/mkl/$(ver_cut 1-3)/lib/intel64/libmkl_rt.so usr/$(get_libdir)/blas/mkl/libblas.so
dosym ../../../../opt/intel/oneapi/mkl/$(ver_cut 1-3)/lib/intel64/libmkl_rt.so usr/$(get_libdir)/blas/mkl/libblas.so.3
dosym ../../../../opt/intel/oneapi/mkl/$(ver_cut 1-3)/lib/intel64/libmkl_rt.so usr/$(get_libdir)/blas/mkl/libcblas.so
dosym ../../../../opt/intel/oneapi/mkl/$(ver_cut 1-3)/lib/intel64/libmkl_rt.so usr/$(get_libdir)/blas/mkl/libcblas.so.3
dodir /usr/$(get_libdir)/lapack/mkl
dosym ../../../../opt/intel/oneapi/mkl/$(ver_cut 1-3)/lib/intel64/libmkl_rt.so usr/$(get_libdir)/lapack/mkl/liblapack.so
dosym ../../../../opt/intel/oneapi/mkl/$(ver_cut 1-3)/lib/intel64/libmkl_rt.so usr/$(get_libdir)/lapack/mkl/liblapack.so.3
dosym ../../../../opt/intel/oneapi/mkl/$(ver_cut 1-3)/lib/intel64/libmkl_rt.so usr/$(get_libdir)/lapack/mkl/liblapacke.so
dosym ../../../../opt/intel/oneapi/mkl/$(ver_cut 1-3)/lib/intel64/libmkl_rt.so usr/$(get_libdir)/lapack/mkl/liblapacke.so.3
newenvd - "70intel-mkl" <<-_EOF_
MKLROOT="${EPREFIX}/opt/intel/oneapi/mkl/$(ver_cut 1-3)"
PATH="${EPREFIX}/opt/intel/oneapi/mkl/$(ver_cut 1-3)/bin/intel64"
# we need to duplicate it in ROOTPATH for Portage to respect...
ROOTPATH="${EPREFIX}/opt/intel/oneapi/mkl/$(ver_cut 1-3)/bin/intel64"
LDPATH="${EPREFIX}/opt/intel/oneapi/mkl/$(ver_cut 1-3)/lib/intel64"
_EOF_
}
pkg_postinst() {
local libdir=$(get_libdir) me="mkl"
# check blas
eselect blas add ${libdir} "${EROOT}"/usr/${libdir}/blas/${me} ${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
# check lapack
eselect lapack add ${libdir} "${EROOT}"/usr/${libdir}/lapack/${me} ${me}
local current_lapack=$(eselect lapack show ${libdir} | cut -d' ' -f2)
if [[ ${current_lapack} == "${me}" || -z ${current_lapack} ]]; then
eselect lapack set ${libdir} ${me}
elog "Current eselect: LAPACK ($libdir) -> [${current_blas}]."
else
elog "Current eselect: LAPACK ($libdir) -> [${current_blas}]."
elog "To use lapack [${me}] implementation, you have to issue (as root):"
elog "\t eselect lapack set ${libdir} ${me}"
fi
}
pkg_postrm() {
eselect blas validate
eselect lapack validate
}
|