Gentoo Archives: gentoo-commits

From: Matthias Maier <tamiko@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: sci-mathematics/petsc/, sci-mathematics/petsc/files/
Date: Wed, 29 Apr 2020 21:35:52
Message-Id: 1588196133.e50be8a41d664ed38d2903406bac8f3f28ffb695.tamiko@gentoo
1 commit: e50be8a41d664ed38d2903406bac8f3f28ffb695
2 Author: Matthias Maier <tamiko <AT> gentoo <DOT> org>
3 AuthorDate: Wed Apr 29 20:45:17 2020 +0000
4 Commit: Matthias Maier <tamiko <AT> gentoo <DOT> org>
5 CommitDate: Wed Apr 29 21:35:33 2020 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=e50be8a4
7
8 sci-mathematics/petsc: version bump to 13.0
9
10 Package-Manager: Portage-2.3.99, Repoman-2.3.22
11 Signed-off-by: Matthias Maier <tamiko <AT> gentoo.org>
12
13 sci-mathematics/petsc/Manifest | 1 +
14 .../files/petsc-3.13.0-do_not_run_mpiexec.patch | 34 ++++
15 .../files/petsc-3.13.0-fix_sandbox_violation.patch | 18 ++
16 .../files/petsc-3.13.0-make_hypre_configure.patch | 90 ++++++++++
17 sci-mathematics/petsc/petsc-3.13.0.ebuild | 189 +++++++++++++++++++++
18 5 files changed, 332 insertions(+)
19
20 diff --git a/sci-mathematics/petsc/Manifest b/sci-mathematics/petsc/Manifest
21 index 35342d214c5..f7372ecf5e1 100644
22 --- a/sci-mathematics/petsc/Manifest
23 +++ b/sci-mathematics/petsc/Manifest
24 @@ -1,2 +1,3 @@
25 DIST petsc-3.11.3.tar.gz 33279017 BLAKE2B 870b8245e5e06d8538ea3ee1d01fa2cebade4a0bd79dfcf17d74e6201f41d21ca021e206744ece28847b434ece142a2789851b5514a8a1e3f82a8551288b695b SHA512 e545f69e87bc72950939ff3cec3e0ba225a5b3e7f1cb93b0fb6123194eb7240ac1d97ba397235d8ab872c653caab1427673124e5e1e706b796c0ae46ec1bcffa
26 DIST petsc-3.12.1.tar.gz 34592587 BLAKE2B b48056a1fe1d507338f7d145f5fceeab2b2f576470d8af90c9d7828de9b775daadf11198fecc46b5e48fcf1eb38addb366e3a908dab5c4ffaf7f9b71ff17b3d8 SHA512 df33170922c0b34136d2fd5bdc3c68a80d3a5873d66bfb03b2cea4a6456393c7181a8da673911b89ea0fcb51d5fd89b5b4c8b76ddb1df573180a92d029fbc1fb
27 +DIST petsc-3.13.0.tar.gz 35080264 BLAKE2B 0ac58e53751dbc6e053e3591cdf2363194e0cf7a493f252d879031e0135da16fa24e66974dd7bf07ce18558a75f8dd794e87f96590ad9e550d11edfeb462f727 SHA512 0590bb63d9c6dfd6ac03b1b88e5a8c11d42a0fd014084603d4d085060b126aa4341b4ec3a4d2b12146b971da327ccc7ede370e5633282bf44f269465aea32953
28
29 diff --git a/sci-mathematics/petsc/files/petsc-3.13.0-do_not_run_mpiexec.patch b/sci-mathematics/petsc/files/petsc-3.13.0-do_not_run_mpiexec.patch
30 new file mode 100644
31 index 00000000000..4c46658dec7
32 --- /dev/null
33 +++ b/sci-mathematics/petsc/files/petsc-3.13.0-do_not_run_mpiexec.patch
34 @@ -0,0 +1,34 @@
35 +diff --git a/config/BuildSystem/config/packages/MPI.py b/config/BuildSystem/config/packages/MPI.py
36 +index 7e424e71..ee502bd2 100644
37 +--- a/config/BuildSystem/config/packages/MPI.py
38 ++++ b/config/BuildSystem/config/packages/MPI.py
39 +@@ -210,28 +210,11 @@ shared libraries and run with --known-mpi-shared-libraries=1')
40 + raise RuntimeError('Could not locate MPIEXEC - please specify --with-mpiexec option')
41 + # Support for spaces and () in executable names; also needs to handle optional arguments at the end
42 + # TODO: This support for spaces and () should be moved to core BuildSystem
43 +- self.mpiexec = self.mpiexec.replace(' ', '\\ ').replace('(', '\\(').replace(')', '\\)').replace('\ -',' -')
44 +- if (hasattr(self, 'ompi_major_version') and int(self.ompi_major_version) >= 3):
45 +- (out, err, ret) = Configure.executeShellCommand(self.mpiexec+' -help all', checkCommand = noCheck, timeout = 60, log = self.log, threads = 1)
46 +- if out.find('--oversubscribe') >=0:
47 +- self.mpiexec = self.mpiexec + ' --oversubscribe'
48 ++ self.mpiexec = self.mpiexec + ' --oversubscribe'
49 +
50 + # using mpiexec environmental variables make sure mpiexec matches the MPI libraries and save the variables for testing in PetscInitialize()
51 + # the variable HAVE_MPIEXEC_ENVIRONMENTAL_VARIABLE is not currently used. PetscInitialize() can check the existence of the environmental variable to
52 + # determine if the program has been started with the correct mpiexec (will only be set for parallel runs so not clear how to check appropriately)
53 +- (out, err, ret) = Configure.executeShellCommand(self.mpiexec+' -n 1 printenv', checkCommand = noCheck, timeout = 60, threads = 1, log = self.log)
54 +- if ret:
55 +- self.logWrite('Unable to run '+self.mpiexec+' with option "-n 1 printenv"\nThis could be ok, some MPI implementations such as SGI produce a non-zero status with non-MPI programs\n'+out+err)
56 +- else:
57 +- if out.find('MPIR_CVAR_CH3') > -1:
58 +- if hasattr(self,'ompi_major_version'): raise RuntimeError("Your libraries are from OpenMPI but it appears your mpiexec is from MPICH");
59 +- self.addDefine('HAVE_MPIEXEC_ENVIRONMENTAL_VARIABLE', 'MPIR_CVAR_CH3')
60 +- elif out.find('MPIR_CVAR_CH3') > -1:
61 +- if hasattr(self,'ompi_major_version'): raise RuntimeError("Your libraries are from OpenMPI but it appears your mpiexec is from MPICH");
62 +- self.addDefine('HAVE_MPIEXEC_ENVIRONMENTAL_VARIABLE', 'MPICH')
63 +- elif out.find('OMPI_COMM_WORLD_SIZE') > -1:
64 +- if hasattr(self,'mpich_numversion'): raise RuntimeError("Your libraries are from MPICH but it appears your mpiexec is from OpenMPI");
65 +- self.addDefine('HAVE_MPIEXEC_ENVIRONMENTAL_VARIABLE', 'OMP')
66 +
67 + self.addMakeMacro('MPIEXEC', self.mpiexec)
68 + self.mpiexec = self.mpiexec + ' -n 1'
69
70 diff --git a/sci-mathematics/petsc/files/petsc-3.13.0-fix_sandbox_violation.patch b/sci-mathematics/petsc/files/petsc-3.13.0-fix_sandbox_violation.patch
71 new file mode 100644
72 index 00000000000..c0dfd53a011
73 --- /dev/null
74 +++ b/sci-mathematics/petsc/files/petsc-3.13.0-fix_sandbox_violation.patch
75 @@ -0,0 +1,18 @@
76 +diff --git a/config/PETSc/options/installDir.py b/config/PETSc/options/installDir.py
77 +index 860faf0f..87898811 100755
78 +--- a/config/PETSc/options/installDir.py
79 ++++ b/config/PETSc/options/installDir.py
80 +@@ -40,13 +40,6 @@ class Configure(config.base.Configure):
81 + self.dir = os.path.abspath(os.path.expanduser(self.framework.argDB['prefix']))
82 + self.petscDir = self.dir
83 + self.petscArch = ''
84 +- try:
85 +- os.makedirs(os.path.join(self.dir,'PETScTestDirectory'))
86 +- os.rmdir(os.path.join(self.dir,'PETScTestDirectory'))
87 +- except Exception as e:
88 +- self.logPrint('Error trying to to test write permissions on directory '+str(e))
89 +- self.installSudoMessage = 'You do not have write permissions to the --prefix directory '+self.dir+'\nYou will be prompted for the sudo password for any external package installs'
90 +- self.installSudo = 'sudo '
91 + else:
92 + self.dir = os.path.abspath(os.path.join(self.petscdir.dir, self.arch.arch))
93 + self.petscDir = self.petscdir.dir
94
95 diff --git a/sci-mathematics/petsc/files/petsc-3.13.0-make_hypre_configure.patch b/sci-mathematics/petsc/files/petsc-3.13.0-make_hypre_configure.patch
96 new file mode 100644
97 index 00000000000..1453fd519e8
98 --- /dev/null
99 +++ b/sci-mathematics/petsc/files/petsc-3.13.0-make_hypre_configure.patch
100 @@ -0,0 +1,90 @@
101 +diff --git a/config/BuildSystem/config/packages/hypre.py b/config/BuildSystem/config/packages/hypre.py
102 +index 4d915c31..1b05a1ee 100644
103 +--- a/config/BuildSystem/config/packages/hypre.py
104 ++++ b/config/BuildSystem/config/packages/hypre.py
105 +@@ -5,10 +5,6 @@ class Configure(config.package.GNUPackage):
106 + def __init__(self, framework):
107 + config.package.GNUPackage.__init__(self, framework)
108 + #self.version = '2.18.2'
109 +- self.minversion = '2.14'
110 +- self.versionname = 'HYPRE_RELEASE_VERSION'
111 +- self.versioninclude = 'HYPRE_config.h'
112 +- self.requiresversion = 1
113 + #self.gitcommit = 'v'+self.version
114 + self.gitcommit = '93baaa8c9' # v2.18.2+valgrind-fix
115 + self.download = ['git://https://github.com/hypre-space/hypre','https://github.com/hypre-space/hypre/archive/'+self.gitcommit+'.tar.gz']
116 +diff --git a/include/petsc/private/petschypre.h b/include/petsc/private/petschypre.h
117 +index 81ca7136..b403e70e 100644
118 +--- a/include/petsc/private/petschypre.h
119 ++++ b/include/petsc/private/petschypre.h
120 +@@ -6,12 +6,6 @@
121 + #include <HYPRE_config.h>
122 + #include <HYPRE_utilities.h>
123 +
124 +-/* from version 2.16 on, HYPRE_BigInt is 64 bit for 64bit installations
125 +- and 32 bit for 32bit installations -> not the best name for a variable */
126 +-#if PETSC_PKG_HYPRE_VERSION_LT(2,16,0)
127 +-typedef PetscInt HYPRE_BigInt;
128 +-#endif
129 +-
130 + /*
131 + With scalar type == real, HYPRE_Complex == PetscScalar;
132 + With scalar type == complex, HYPRE_Complex is double __complex__ while PetscScalar may be std::complex<double>
133 +diff --git a/src/mat/impls/hypre/mhypre.c b/src/mat/impls/hypre/mhypre.c
134 +index 0f7470e6..cce3e2b0 100644
135 +--- a/src/mat/impls/hypre/mhypre.c
136 ++++ b/src/mat/impls/hypre/mhypre.c
137 +@@ -15,10 +15,6 @@
138 + #include <_hypre_parcsr_ls.h>
139 + #include <_hypre_sstruct_ls.h>
140 +
141 +-#if PETSC_PKG_HYPRE_VERSION_LT(2,18,0)
142 +-#define hypre_ParCSRMatrixClone(A,B) hypre_ParCSRMatrixCompleteClone(A)
143 +-#endif
144 +-
145 + static PetscErrorCode MatHYPRE_CreateFromMat(Mat,Mat_HYPRE*);
146 + static PetscErrorCode MatHYPRE_IJMatrixPreallocate(Mat,Mat,HYPRE_IJMatrix);
147 + static PetscErrorCode MatHYPRE_IJMatrixFastCopy_MPIAIJ(Mat,HYPRE_IJMatrix);
148 +@@ -63,7 +59,6 @@ static PetscErrorCode MatHYPRE_IJMatrixPreallocate(Mat A_d, Mat A_o, HYPRE_IJMat
149 + nnz_o[i] = 0;
150 + }
151 + }
152 +-#if PETSC_PKG_HYPRE_VERSION_GE(2,16,0)
153 + { /* If we don't do this, the columns of the matrix will be all zeros! */
154 + hypre_AuxParCSRMatrix *aux_matrix;
155 + aux_matrix = (hypre_AuxParCSRMatrix*)hypre_IJMatrixTranslator(ij);
156 +@@ -73,9 +68,6 @@ static PetscErrorCode MatHYPRE_IJMatrixPreallocate(Mat A_d, Mat A_o, HYPRE_IJMat
157 + aux_matrix = (hypre_AuxParCSRMatrix*)hypre_IJMatrixTranslator(ij);
158 + hypre_AuxParCSRMatrixNeedAux(aux_matrix) = 1;
159 + }
160 +-#else
161 +- PetscStackCallStandard(HYPRE_IJMatrixSetDiagOffdSizes,(ij,nnz_d,nnz_o));
162 +-#endif
163 + ierr = PetscFree(nnz_d);CHKERRQ(ierr);
164 + ierr = PetscFree(nnz_o);CHKERRQ(ierr);
165 + }
166 +@@ -233,11 +225,7 @@ static PetscErrorCode MatHYPRE_IJMatrixFastCopy_MPIAIJ(Mat A, HYPRE_IJMatrix ij)
167 + /* need to shift the diag column indices (hdiag->j) back to global numbering since hypre is expecting this */
168 + hjj = hdiag->j;
169 + pjj = pdiag->j;
170 +-#if PETSC_PKG_HYPRE_VERSION_GE(2,16,0)
171 + for (i=0; i<pdiag->nz; i++) hjj[i] = pjj[i];
172 +-#else
173 +- for (i=0; i<pdiag->nz; i++) hjj[i] = cstart + pjj[i];
174 +-#endif
175 + ierr = PetscArraycpy(hdiag->data,pdiag->a,pdiag->nz);CHKERRQ(ierr);
176 + if (sameint) {
177 + ierr = PetscArraycpy(hoffd->i,poffd->i,pA->A->rmap->n + 1);CHKERRQ(ierr);
178 +@@ -247,12 +235,8 @@ static PetscErrorCode MatHYPRE_IJMatrixFastCopy_MPIAIJ(Mat A, HYPRE_IJMatrix ij)
179 +
180 + /* need to move the offd column indices (hoffd->j) back to global numbering since hypre is expecting this
181 + If we hacked a hypre a bit more we might be able to avoid this step */
182 +-#if PETSC_PKG_HYPRE_VERSION_GE(2,16,0)
183 + PetscStackCallStandard(hypre_CSRMatrixBigInitialize,(hoffd));
184 + jj = (PetscInt*) hoffd->big_j;
185 +-#else
186 +- jj = (PetscInt*) hoffd->j;
187 +-#endif
188 + pjj = poffd->j;
189 + for (i=0; i<poffd->nz; i++) jj[i] = garray[pjj[i]];
190 +
191
192 diff --git a/sci-mathematics/petsc/petsc-3.13.0.ebuild b/sci-mathematics/petsc/petsc-3.13.0.ebuild
193 new file mode 100644
194 index 00000000000..961ff927f72
195 --- /dev/null
196 +++ b/sci-mathematics/petsc/petsc-3.13.0.ebuild
197 @@ -0,0 +1,189 @@
198 +# Copyright 1999-2020 Gentoo Authors
199 +# Distributed under the terms of the GNU General Public License v2
200 +
201 +EAPI=7
202 +
203 +PYTHON_COMPAT=( python3_{6,7,8} )
204 +
205 +inherit flag-o-matic fortran-2 python-any-r1 toolchain-funcs
206 +
207 +DESCRIPTION="Portable, Extensible Toolkit for Scientific Computation"
208 +HOMEPAGE="http://www.mcs.anl.gov/petsc/"
209 +SRC_URI="http://ftp.mcs.anl.gov/pub/petsc/release-snapshots/${P}.tar.gz"
210 +
211 +LICENSE="BSD-2"
212 +SLOT="0"
213 +KEYWORDS="~amd64 ~x86"
214 +IUSE="afterimage boost complex-scalars cxx debug doc fftw
215 + fortran hdf5 hypre mpi metis mumps scotch sparse superlu threads X"
216 +
217 +# hypre and superlu curretly exclude each other due to missing linking to hypre
218 +# if both are enabled
219 +REQUIRED_USE="
220 + afterimage? ( X )
221 + complex-scalars? ( !hypre !superlu )
222 + hdf5? ( mpi )
223 + hypre? ( cxx mpi !superlu )
224 + mumps? ( mpi scotch )
225 + scotch? ( mpi )
226 + superlu? ( !hypre )
227 +"
228 +
229 +RDEPEND="
230 + virtual/blas
231 + virtual/lapack
232 + afterimage? ( media-libs/libafterimage )
233 + boost? ( dev-libs/boost )
234 + fftw? ( sci-libs/fftw:3.0[mpi?] )
235 + hdf5? ( sci-libs/hdf5[mpi?] )
236 + hypre? ( >=sci-libs/hypre-2.18.0[mpi?] )
237 + metis? ( >=sci-libs/parmetis-4 )
238 + mpi? ( virtual/mpi[cxx?,fortran?] )
239 + mumps? ( sci-libs/mumps[mpi?] sci-libs/scalapack )
240 + scotch? ( sci-libs/scotch[mpi?] )
241 + sparse? ( sci-libs/suitesparse >=sci-libs/cholmod-1.7.0 )
242 + superlu? ( >=sci-libs/superlu-5 )
243 + X? ( x11-libs/libX11 )
244 +"
245 +
246 +DEPEND="${RDEPEND}
247 + ${PYTHON_DEPS}
248 + virtual/pkgconfig
249 + dev-util/cmake
250 +"
251 +
252 +PATCHES=(
253 + "${FILESDIR}"/${PN}-3.7.0-disable-rpath.patch
254 + "${FILESDIR}"/${PN}-3.13.0-fix_sandbox_violation.patch
255 + "${FILESDIR}"/${PN}-3.13.0-make_hypre_configure.patch
256 + "${FILESDIR}"/${PN}-3.13.0-do_not_run_mpiexec.patch
257 +)
258 +
259 +# petsc uses --with-blah=1 and --with-blah=0 to en/disable options
260 +petsc_enable() {
261 + use "$1" && echo "--with-${2:-$1}=1" || echo "--with-${2:-$1}=0"
262 +}
263 +# add external library:
264 +# petsc_with use_flag libname libdir
265 +# petsc_with use_flag libname include linking_libs
266 +petsc_with() {
267 + local myuse p=${2:-${1}}
268 + if use ${1}; then
269 + myuse="--with-${p}=1"
270 + if [[ $# -ge 4 ]]; then
271 + myuse="${myuse} --with-${p}-include=${EPREFIX}${3}"
272 + shift 3
273 + myuse="${myuse} --with-${p}-lib=$@"
274 + else
275 + myuse="${myuse} --with-${p}-dir=${EPREFIX}${3:-/usr}"
276 + fi
277 + else
278 + myuse="--with-${p}=0"
279 + fi
280 + echo ${myuse}
281 +}
282 +
283 +# select between configure options depending on use flag
284 +petsc_select() {
285 + use "$1" && echo "--with-$2=$3" || echo "--with-$2=$4"
286 +}
287 +
288 +src_configure() {
289 + # bug 548498
290 + # PETSc runs mpi processes during configure that result in a sandbox
291 + # violation by trying to open /proc/mtrr rw. This is not easy to
292 + # mitigate because it happens in libpciaccess.so called by libhwloc.so,
293 + # which is used by libmpi.so.
294 + addpredict /proc/mtrr
295 + # if mpi is built with knem support it needs /dev/knem too
296 + addpredict /dev/knem
297 +
298 + # configureMPITypes with openmpi-2* insists on accessing the scaling
299 + # governor rw.
300 + addpredict /sys/devices/system/cpu/
301 +
302 + local mylang
303 + local myopt
304 +
305 + use cxx && mylang="cxx" || mylang="c"
306 + use debug && myopt="debug" || myopt="opt"
307 +
308 + # environmental variables expected by petsc during build
309 +
310 + export PETSC_DIR="${S}"
311 + export PETSC_ARCH="linux-gnu-${mylang}-${myopt}"
312 +
313 + if use debug; then
314 + strip-flags
315 + filter-flags -O*
316 + fi
317 +
318 + # C Support on CXX builds is enabled if possible i.e. when not using
319 + # complex scalars (no complex type for both available at the same time)
320 +
321 + econf \
322 + scrollOutput=1 \
323 + FFLAGS="${FFLAGS} -fPIC" \
324 + CFLAGS="${CFLAGS} -fPIC" \
325 + CXXFLAGS="${CXXFLAGS} -fPIC" \
326 + LDFLAGS="${LDFLAGS}" \
327 + --prefix="${EPREFIX}/usr/$(get_libdir)/petsc" \
328 + --with-shared-libraries \
329 + --with-single-library \
330 + --with-clanguage=${mylang} \
331 + $(use cxx && ! use complex-scalars && echo "with-c-support=1") \
332 + --with-petsc-arch=${PETSC_ARCH} \
333 + --with-precision=double \
334 + --with-gnu-compilers \
335 + --with-blas-lapack-lib="$($(tc-getPKG_CONFIG) --libs blas lapack)" \
336 + $(petsc_enable debug debugging) \
337 + $(petsc_enable mpi) \
338 + $(petsc_select mpi cc mpicc $(tc-getCC)) \
339 + $(petsc_select mpi cxx mpicxx $(tc-getCXX)) \
340 + $(petsc_enable fortran) \
341 + $(use fortran && echo "$(petsc_select mpi fc mpif77 $(tc-getF77))") \
342 + $(petsc_enable mpi mpi-compilers) \
343 + $(petsc_select complex-scalars scalar-type complex real) \
344 + --with-windows-graphics=0 \
345 + --with-matlab=0 \
346 + --with-cmake:BOOL=1 \
347 + $(petsc_enable threads pthread) \
348 + $(petsc_with afterimage afterimage \
349 + /usr/include/libAfterImage -lAfterImage) \
350 + $(use_with hdf5) \
351 + $(petsc_with hypre hypre \
352 + /usr/include/hypre -lHYPRE) \
353 + $(use_with sparse suitesparse) \
354 + $(petsc_with superlu superlu \
355 + /usr/include/superlu -lsuperlu) \
356 + $(use_with X x) \
357 + $(use_with X x11) \
358 + $(petsc_with scotch ptscotch \
359 + /usr/include/scotch \
360 + [-lptesmumps,-lptscotch,-lptscotcherr,-lscotch,-lscotcherr]) \
361 + $(petsc_with mumps scalapack \
362 + /usr/include/scalapack -lscalapack) \
363 + $(use_with mumps mumps \
364 + /usr/include \
365 + [-lcmumps,-ldmumps,-lsmumps,-lzmumps,-lmumps_common,-lpord]) \
366 + --with-imagemagick=0 \
367 + --with-python=0 \
368 + $(use_with boost) \
369 + $(use_with fftw)
370 +}
371 +
372 +src_install() {
373 + emake DESTDIR="${ED}" install
374 +
375 + # add PETSC_DIR to environmental variables
376 + cat >> 99petsc <<- EOF
377 + PETSC_DIR=${EPREFIX}/usr/$(get_libdir)/petsc
378 + LDPATH=${EPREFIX}/usr/$(get_libdir)/petsc/lib
379 + EOF
380 + doenvd 99petsc
381 +
382 + if use doc ; then
383 + docinto html
384 + dodoc -r docs/*.html docs/changes docs/manualpages
385 + fi
386 +}