1 |
commit: 869afac343923dc6dda4ec194dea7e43e28b8213 |
2 |
Author: Justin Lecher <jlec <AT> gentoo <DOT> org> |
3 |
AuthorDate: Sun Dec 27 16:19:43 2015 +0000 |
4 |
Commit: Justin Lecher <jlec <AT> gentoo <DOT> org> |
5 |
CommitDate: Sun Dec 27 16:19:43 2015 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/sci.git/commit/?id=869afac3 |
7 |
|
8 |
sci-libs/mkl: Use numeric eclasses |
9 |
|
10 |
Package-Manager: portage-2.2.26 |
11 |
Signed-off-by: Justin Lecher <jlec <AT> gentoo.org> |
12 |
|
13 |
sci-libs/mkl/metadata.xml | 3 + |
14 |
sci-libs/mkl/mkl-11.2.3.187-r1.ebuild | 184 ++++++++++++++++++---------------- |
15 |
2 files changed, 103 insertions(+), 84 deletions(-) |
16 |
|
17 |
diff --git a/sci-libs/mkl/metadata.xml b/sci-libs/mkl/metadata.xml |
18 |
index cb75c05..a5d2014 100644 |
19 |
--- a/sci-libs/mkl/metadata.xml |
20 |
+++ b/sci-libs/mkl/metadata.xml |
21 |
@@ -10,4 +10,7 @@ |
22 |
capacities. The package is installed as binary and has a restrictive |
23 |
license. Please see license terms and home page for proper use. |
24 |
</longdescription> |
25 |
+ <use> |
26 |
+ <flag name="int64">Build the 64 bits integer library</flag> |
27 |
+ </use> |
28 |
</pkgmetadata> |
29 |
|
30 |
diff --git a/sci-libs/mkl/mkl-11.2.3.187-r1.ebuild b/sci-libs/mkl/mkl-11.2.3.187-r1.ebuild |
31 |
index 77a85b5..59efa7b 100644 |
32 |
--- a/sci-libs/mkl/mkl-11.2.3.187-r1.ebuild |
33 |
+++ b/sci-libs/mkl/mkl-11.2.3.187-r1.ebuild |
34 |
@@ -10,7 +10,9 @@ INTEL_DPV=2015_update3 |
35 |
INTEL_SUBDIR=composerxe |
36 |
INTEL_SINGLE_ARCH=false |
37 |
|
38 |
-inherit intel-sdp multilib alternatives-2 |
39 |
+NUMERIC_MODULE_NAME=${PN} |
40 |
+ |
41 |
+inherit alternatives-2 intel-sdp numeric-int64-multibuild |
42 |
|
43 |
DESCRIPTION="Intel Math Kernel Library: linear algebra, fft, math functions" |
44 |
HOMEPAGE="http://software.intel.com/en-us/articles/intel-mkl/" |
45 |
@@ -34,111 +36,125 @@ INTEL_AMD64_RPMS=( |
46 |
mkl-mic mkl-mic-devel |
47 |
mkl-sp2dp mkl-sp2dp-devel |
48 |
) |
49 |
-INTEL_DAT_RPMS=(mkl-common mkl-cluster-common mkl-f95-common) |
50 |
+INTEL_DAT_RPMS=( |
51 |
+ mkl-common |
52 |
+ mkl-cluster-common |
53 |
+ mkl-f95-common |
54 |
+ ) |
55 |
+ |
56 |
+pkg_setup() { |
57 |
+ intel-sdp_pkg_setup |
58 |
+} |
59 |
|
60 |
src_prepare() { |
61 |
- chmod u+w -R opt |
62 |
+ chmod u+w -R opt || die |
63 |
} |
64 |
|
65 |
-mkl_add_prof() { |
66 |
- local pcname=${1} libs cflags x |
67 |
+_mkl_add_pc_file() { |
68 |
+ local pcname=${1} cflags="" suffix="" |
69 |
shift |
70 |
- [[ ${pcname} = *int64* ]] && cflags=-DMKL_ILP64 |
71 |
- cat <<-EOF > ${pcname}.pc |
72 |
- prefix=${INTEL_SDP_EDIR}/mkl |
73 |
- libdir=\${prefix}/lib/${IARCH} |
74 |
- libdir_comp=${INTEL_SDP_EDIR}/compiler/lib/${IARCH} |
75 |
- includedir=\${prefix}/include |
76 |
- Name: ${pcname} |
77 |
- Description: ${DESCRIPTION} |
78 |
- Version: ${PV} |
79 |
- URL: ${HOMEPAGE} |
80 |
- Libs: -L\${libdir} -L\${libdir_comp} ${libs} |
81 |
- Cflags: -I\${includedir} ${cflags} |
82 |
- EOF |
83 |
- insinto /usr/$(get_libdir)/pkgconfig |
84 |
- doins ${pcname}.pc |
85 |
- for x in $*; do |
86 |
- alternatives_for ${x} ${pcname/-${x}} 0 \ |
87 |
- /usr/$(get_libdir)/pkgconfig/${x}.pc ${pcname}.pc |
88 |
+ numeric-int64_is_int64_build && cflags=-DMKL_ILP64 && suffix="-int64" |
89 |
+ |
90 |
+ local IARCH=$(convert2intel_arch ${MULTIBUILD_ID}) |
91 |
+ |
92 |
+ create_pkgconfig \ |
93 |
+ --prefix "${INTEL_SDP_EDIR}/mkl" \ |
94 |
+ --libdir "\${prefix}/lib/${IARCH}" \ |
95 |
+ --includedir "\${prefix}/include" \ |
96 |
+ --name ${pcname} \ |
97 |
+ --libs "-L\${libdir} -L${INTEL_SDP_EDIR}/compiler/lib/${IARCH} $* -lpthread -lm" \ |
98 |
+ --cflags "-I\${includedir} ${cflags}" \ |
99 |
+ ${pcname}${suffix} |
100 |
+} |
101 |
+ |
102 |
+_mkl_add_alternative_provider() { |
103 |
+ local prov=$1; shift |
104 |
+ local alt |
105 |
+ for alt in $*; do |
106 |
+ NUMERIC_MODULE_NAME=${prov} \ |
107 |
+ numeric-int64-multibuild_install_alternative ${alt} ${prov} |
108 |
done |
109 |
} |
110 |
|
111 |
-# mkl_prof [_ilp64 or _lp64] |
112 |
# help: http://software.intel.com/en-us/articles/intel-mkl-link-line-advisor/ |
113 |
-mkl_prof() { |
114 |
+mkl_add_pc_file() { |
115 |
local bits="" |
116 |
- if [[ ${IARCH} == intel64 ]]; then |
117 |
- bits=_lp64 |
118 |
- [[ ${1} == int64 ]] && bits=_ilp64 |
119 |
- fi |
120 |
+ [[ ${MULTIBUILD_ID} =~ amd64 ]] && bits=_lp64 |
121 |
+ numeric-int64_is_int64_build && bits=_ilp64 |
122 |
+ |
123 |
local gf="-Wl,--no-as-needed -Wl,--start-group -lmkl_gf${bits}" |
124 |
local gc="-Wl,--no-as-needed -Wl,--start-group -lmkl_intel${bits}" |
125 |
local intel="-Wl,--start-group -lmkl_intel${bits}" |
126 |
local core="-lmkl_core -Wl,--end-group" |
127 |
- local prof=mkl${IARCH:((${#IARCH} - 2)):2} |
128 |
- [[ ${1} == int64 ]] && prof=${prof}-int64 |
129 |
- local libs |
130 |
- |
131 |
- libs="${gf} -lmkl_sequential ${core} -lpthread" \ |
132 |
- mkl_add_prof ${prof}-gfortran blas lapack |
133 |
- libs="${intel} -lmkl_sequential ${core} -lpthread" \ |
134 |
- mkl_add_prof ${prof}-intel blas lapack cblas lapacke |
135 |
- libs="${gf} -lmkl_gnu_thread ${core} -fopenmp -lpthread" \ |
136 |
- mkl_add_prof ${prof}-gfortran-openmp blas lapack |
137 |
- libs="${gc} -lmkl_gnu_thread ${core} -fopenmp -lpthread" \ |
138 |
- mkl_add_prof ${prof}-gcc-openmp cblas lapacke |
139 |
- libs="${intel} -lmkl_intel_thread ${core} -openmp -lpthread" \ |
140 |
- mkl_add_prof ${prof}-intel-openmp blas lapack cblas lapacke |
141 |
- libs="-lmkl_rt -lpthread" \ |
142 |
- mkl_add_prof ${prof}-dynamic blas lapack cblas lapacke |
143 |
- libs="-lmkl_rt -liomp5 -lpthread" \ |
144 |
- mkl_add_prof ${prof}-dynamic-openmp blas lapack cblas lapacke |
145 |
+ |
146 |
+ # blas lapack cblas lapacke |
147 |
+ _mkl_add_pc_file mkl-gfortran ${gf} -lmkl_sequential ${core} |
148 |
+ _mkl_add_pc_file mkl-intel ${intel} -lmkl_sequential ${core} |
149 |
+ _mkl_add_pc_file mkl-gfortran-openmp ${gf} -lmkl_gnu_thread ${core} -fopenmp |
150 |
+ _mkl_add_pc_file mkl-gcc-openmp ${gc} -lmkl_gnu_thread ${core} -fopenmp |
151 |
+ _mkl_add_pc_file mkl-intel-openmp ${intel} -lmkl_intel_thread ${core} -openmp |
152 |
+ _mkl_add_pc_file mkl-dynamic -lmkl_rt |
153 |
+ _mkl_add_pc_file mkl-dynamic-openmp -lmkl_rt -liomp5 |
154 |
|
155 |
# blacs and scalapack |
156 |
local scal="-lmkl_scalapack${bits:-_core}" |
157 |
local blacs="-lmkl_blacs_intelmpi${bits}" |
158 |
core="-lmkl_core ${blacs} -Wl,--end-group" |
159 |
|
160 |
- libs="${gf} -lmkl_sequential ${core} -lpthread" \ |
161 |
- mkl_add_prof ${prof}-gfortran-blacs blacs |
162 |
- libs="${scal} ${gf} -lmkl_sequential ${core} -lpthread" \ |
163 |
- mkl_add_prof ${prof}-gfortran-scalapack scalapack |
164 |
- libs="${intel} -lmkl_sequential ${core} -lpthread" \ |
165 |
- mkl_add_prof ${prof}-intel-blacs blacs |
166 |
- libs="${scal} ${intel} -lmkl_sequential ${core} -lpthread" \ |
167 |
- mkl_add_prof ${prof}-intel-scalapack scalapack |
168 |
- libs="${gf} -lmkl_gnu_thread ${core} -fopenmp -lpthread" \ |
169 |
- mkl_add_prof ${prof}-gfortran-openmp-blacs blacs |
170 |
- libs="${scal} ${gf} -lmkl_gnu_thread ${core} -fopenmp -lpthread" \ |
171 |
- mkl_add_prof ${prof}-gfortran-openmp-scalapack scalapack |
172 |
- libs="${gc} -lmkl_gnu_thread ${core} -fopenmp -lpthread" \ |
173 |
- mkl_add_prof ${prof}-gcc-openmp-blacs blacs |
174 |
- libs="${scal} ${gc} -lmkl_gnu_thread ${core} -fopenmp -lpthread" \ |
175 |
- mkl_add_prof ${prof}-gcc-openmp-scalapack scalapack |
176 |
- libs="${intel} -lmkl_intel_thread ${core} -liomp5 -lpthread" \ |
177 |
- mkl_add_prof ${prof}-intel-openmp-blacs blacs |
178 |
- libs="${scal} ${intel} -lmkl_intel_thread ${core} -liomp5 -lpthread" \ |
179 |
- mkl_add_prof ${prof}-intel-openmp-scalapack scalapack |
180 |
- libs="-lmkl_rt ${blacs} -lpthread" \ |
181 |
- mkl_add_prof ${prof}-dynamic-blacs blacs |
182 |
- libs="${scal} -lmkl_rt ${blacs} -lpthread" \ |
183 |
- mkl_add_prof ${prof}-dynamic-scalapack scalapack |
184 |
- libs="-lmkl_rt ${blacs} -liomp5 -lpthread" \ |
185 |
- mkl_add_prof ${prof}-dynamic-openmp-blacs blacs |
186 |
- libs="${scal} -lmkl_rt ${blacs} -liomp5 -lpthread" \ |
187 |
- mkl_add_prof ${prof}-dynamic-openmp-scalapack scalapack |
188 |
+ _mkl_add_pc_file mkl-gfortran-blacs ${gf} -lmkl_sequential ${core} |
189 |
+ _mkl_add_pc_file mkl-gfortran-scalapack ${scal} ${gf} -lmkl_sequential ${core} |
190 |
+ _mkl_add_pc_file mkl-intel-blacs ${intel} -lmkl_sequential ${core} |
191 |
+ _mkl_add_pc_file mkl-intel-scalapack ${scal} ${intel} -lmkl_sequential ${core} |
192 |
+ _mkl_add_pc_file mkl-gfortran-openmp-blacs ${gf} -lmkl_gnu_thread ${core} -fopenmp |
193 |
+ _mkl_add_pc_file mkl-gfortran-openmp-scalapack ${scal} ${gf} -lmkl_gnu_thread ${core} -fopenmp |
194 |
+ _mkl_add_pc_file mkl-gcc-openmp-blacs ${gc} -lmkl_gnu_thread ${core} -fopenmp |
195 |
+ _mkl_add_pc_file mkl-gcc-openmp-scalapack ${scal} ${gc} -lmkl_gnu_thread ${core} -fopenmp |
196 |
+ _mkl_add_pc_file mkl-intel-openmp-blacs ${intel} -lmkl_intel_thread ${core} -liomp5 |
197 |
+ _mkl_add_pc_file mkl-intel-openmp-scalapack ${scal} ${intel} -lmkl_intel_thread ${core} -liomp5 |
198 |
+ _mkl_add_pc_file mkl-dynamic-blacs -lmkl_rt ${blacs} |
199 |
+ _mkl_add_pc_file mkl-dynamic-scalapack ${scal} -lmkl_rt ${blacs} |
200 |
+ _mkl_add_pc_file mkl-dynamic-openmp-blacs -lmkl_rt ${blacs} -liomp5 |
201 |
+ _mkl_add_pc_file mkl-dynamic-openmp-scalapack ${scal} -lmkl_rt ${blacs} -liomp5 |
202 |
+} |
203 |
+ |
204 |
+mkl_add_alternative_provider() { |
205 |
+ # blas lapack cblas lapacke |
206 |
+ _mkl_add_alternative_provider mkl-gfortran blas lapack |
207 |
+ _mkl_add_alternative_provider mkl-intel blas lapack cblas lapacke |
208 |
+ _mkl_add_alternative_provider mkl-gfortran-openmp blas lapack |
209 |
+ _mkl_add_alternative_provider mkl-gcc-openmp cblas lapacke |
210 |
+ _mkl_add_alternative_provider mkl-intel-openmp blas lapack cblas lapacke |
211 |
+ _mkl_add_alternative_provider mkl-dynamic blas lapack cblas lapacke |
212 |
+ _mkl_add_alternative_provider mkl-dynamic-openmp blas lapack cblas lapacke |
213 |
+ |
214 |
+ # blacs and scalapack |
215 |
+ _mkl_add_alternative_provider mkl-gfortran-blacs blacs |
216 |
+ _mkl_add_alternative_provider mkl-gfortran-scalapack scalapack |
217 |
+ _mkl_add_alternative_provider mkl-intel-blacs blacs |
218 |
+ _mkl_add_alternative_provider mkl-intel-scalapack scalapack |
219 |
+ _mkl_add_alternative_provider mkl-gfortran-openmp-blacs blacs |
220 |
+ _mkl_add_alternative_provider mkl-gfortran-openmp-scalapack scalapack |
221 |
+ _mkl_add_alternative_provider mkl-gcc-openmp-blacs blacs |
222 |
+ _mkl_add_alternative_provider mkl-gcc-openmp-scalapack scalapack |
223 |
+ _mkl_add_alternative_provider mkl-intel-openmp-blacs blacs |
224 |
+ _mkl_add_alternative_provider mkl-intel-openmp-scalapack scalapack |
225 |
+ _mkl_add_alternative_provider mkl-dynamic-blacs blacs |
226 |
+ _mkl_add_alternative_provider mkl-dynamic-scalapack scalapack |
227 |
+ _mkl_add_alternative_provider mkl-dynamic-openmp-blacs blacs |
228 |
+ _mkl_add_alternative_provider mkl-dynamic-openmp-scalapack scalapack |
229 |
} |
230 |
|
231 |
src_install() { |
232 |
+ local IARCH |
233 |
+ local ldpath="LDPATH=" |
234 |
intel-sdp_src_install |
235 |
- echo -n > 35mkl "LDPATH=" |
236 |
- for IARCH in ${INTEL_ARCH}; do |
237 |
- mkl_prof |
238 |
- sed -i -e '/mkl/s/$/:/' 35mkl |
239 |
- echo -n >> 35mkl "${INTEL_SDP_EDIR}/mkl/lib/${IARCH}" |
240 |
- [[ ${IARCH} == intel64 ]] && mkl_prof int64 |
241 |
- done |
242 |
- echo >> 35mkl |
243 |
- doenvd 35mkl |
244 |
+ |
245 |
+ numeric-int64-multibuild_foreach_all_abi_variants mkl_add_pc_file |
246 |
+ mkl_add_alternative_provider |
247 |
+ |
248 |
+ use abi_x86_64 && ldpath+="${INTEL_SDP_EDIR}/mkl/lib/$(convert2intel_arch abi_x86_64)" |
249 |
+ use abi_x86_32 && ldpath+=":${INTEL_SDP_EDIR}/mkl/lib/$(convert2intel_arch abi_x86_32)" |
250 |
+ |
251 |
+ echo "${ldpath}" > "${T}"/35mkl || die |
252 |
+ doenvd "${T}"/35mkl |
253 |
} |