Skip to content

Commit 8ca05b4

Browse files
committed
Merge pull request #627 from hashdist/johannr/hypre
Add hypre
2 parents 36b41d8 + 6306e2d commit 8ca05b4

2 files changed

Lines changed: 180 additions & 5 deletions

File tree

pkgs/hypre.yaml

Lines changed: 166 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,166 @@
1+
extends: [autotools_package]
2+
3+
dependencies:
4+
build: [blas, gnu-sed, lapack, mpi]
5+
6+
sources:
7+
- key: tar.gz:qs6kil25x247lxjlzlvwdhsgbv5tpcye
8+
url: http://ftp.mcs.anl.gov/pub/petsc/externalpackages/hypre-2.9.1a.tar.gz
9+
10+
defaults:
11+
# Skip build-time tests (not recommended)
12+
without_check: false
13+
# Build with Accelerate framework (on OS X)
14+
with_accelerate: false
15+
# Build with OpenBLAS
16+
with_openblas: false
17+
# Build with debug flags
18+
debug: false
19+
20+
build_stages:
21+
# lib/Makefile treats the hypre internal BLAS & LAPACK implementations
22+
# as dependencies for libHYPRE.a (the hypre library). When building with
23+
# an external BLAS library, strip out these dependencies.
24+
- name: external-BLAS
25+
before: configure
26+
handler: bash
27+
bash: |
28+
sed -i 's/.*BLASFILES.*//g' src/lib/Makefile
29+
sed -i 's/.*LAPACKFILES.*//g' src/lib/Makefile
30+
31+
- name: enter-src-dir
32+
before: configure
33+
after: external-BLAS
34+
handler: bash
35+
bash: |
36+
cd src
37+
38+
- name: set-compiler
39+
after: prologue
40+
before: configure
41+
handler: bash
42+
bash: |
43+
export CC=${MPICC}
44+
export CXX=${MPICXX}
45+
export F77=${MPIF77}
46+
47+
- when: with_openblas
48+
name: configure
49+
mode: update
50+
extra: ["--with-blas=yes",
51+
"--with-blas-libs=openblas",
52+
"--with-blas-lib-dirs=${BLAS_DIR}/lib",
53+
"--with-lapack=yes",
54+
"--with-lapack-libs=openblas",
55+
"--with-lapack-lib-dirs=${BLAS_DIR}/lib"]
56+
57+
- when: with_accelerate and not with_openblas
58+
# Libraries used for linking to Accelerate framework; `otool -L`
59+
# shows that these libraries link to the same dylibs that the
60+
# Accelerate framework libraries do. Using the
61+
# "-framework Accelerate" flag would be preferable, but setting
62+
# CFLAGS, etc. overrides the flags in the Makefile and results
63+
# in errors.
64+
name: configure
65+
mode: update
66+
extra: ["--with-blas=yes",
67+
'--with-blas-libs="blas cblas"',
68+
"--with-blas-lib-dirs=/usr/lib",
69+
"--with-lapack=yes",
70+
'--with-lapack-libs="lapack clapack f77lapack"',
71+
"--with-lapack-lib-dirs=/usr/lib"]
72+
73+
- when: not with_accelerate and not with_openblas
74+
name: configure
75+
mode: update
76+
extra: ["--with-blas=yes",
77+
'--with-blas-libs=blas',
78+
"--with-blas-lib-dirs=${BLAS_DIR}/lib",
79+
"--with-lapack=yes",
80+
'--with-lapack-libs=lapack',
81+
"--with-lapack-lib-dirs=${LAPACK_DIR}/lib"]
82+
83+
- when: debug
84+
name: configure
85+
mode: update
86+
extra: ["--enable-debug"]
87+
88+
- when: not fortran
89+
name: configure
90+
mode: update
91+
extra: ["--disable-fortran"]
92+
93+
- name: configure
94+
mode: update
95+
extra: ["--with-MPI",
96+
"--with-MPI-include=${MPI_DIR}/include",
97+
"--with-MPI-lib-dirs=${MPI_DIR}/lib",
98+
# MPI library strings for linking depends on compilers
99+
# enabled. Only the C library strings are needed (without the
100+
# lib), because hypre is a C library.
101+
'--with-MPI-lib="mpi"']
102+
103+
- name: configure
104+
mode: update
105+
extra: ["--without-babel",
106+
"--without-mli",
107+
"--without-fei",
108+
"--without-superlu"]
109+
110+
- when: platform != 'Darwin'
111+
name: configure
112+
mode: update
113+
extra: ["--enable-shared"]
114+
115+
- when: platform == 'linux'
116+
name: rpath-fix
117+
after: install
118+
handler: bash
119+
bash: |
120+
oldRPath=$(${PATCHELF} --print-rpath ${ARTIFACT}/lib/libHYPRE.so)
121+
${PATCHELF} --set-rpath ${oldRPath}:${ARTIFACT}/lib:${BLAS_DIR}/lib:${LAPACK_DIR}/lib:${MPI_DIR}/lib ${ARTIFACT}/lib/libHYPRE.so
122+
123+
- when: platform != 'linux'
124+
name: rpath-fix
125+
after: install
126+
handler: bash
127+
bash: |
128+
129+
- when: not without_check and platform == 'linux'
130+
name: check
131+
after: rpath-fix
132+
handler: bash
133+
bash: |
134+
make check
135+
make test
136+
${PATCHELF} --set-rpath ${ARTIFACT}/lib:${BLAS_DIR}/lib:${LAPACK_DIR}/lib:${MPI_DIR}/lib test/ij
137+
${PATCHELF} --set-rpath ${ARTIFACT}/lib:${BLAS_DIR}/lib:${LAPACK_DIR}/lib:${MPI_DIR}/lib test/struct
138+
${PATCHELF} --set-rpath ${ARTIFACT}/lib:${BLAS_DIR}/lib:${LAPACK_DIR}/lib:${MPI_DIR}/lib test/sstruct
139+
./test/ij
140+
./test/struct
141+
./test/sstruct -in test/sstruct.in.default -solver 40 -rhsone
142+
143+
- when: not without_check and platform != 'linux'
144+
name: check
145+
after: rpath-fix
146+
handler: bash
147+
bash: |
148+
make check
149+
make test
150+
./test/ij
151+
./test/struct
152+
./test/sstruct -in test/sstruct.in.default -solver 40 -rhsone
153+
154+
- when: without_check
155+
name: check
156+
after: rpath-fix
157+
handler: bash
158+
bash: |
159+
160+
- name: caveats
161+
after: check
162+
handler: bash
163+
bash: |
164+
echo "Please register for hypre at:"
165+
echo
166+
echo "https://computation.llnl.gov/project/linear_solvers/download/hypre-2.9.0b_reg.php"

pkgs/petsc/petsc.py

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ def configure(ctx, stage_args):
3636
coptflags: -O2
3737
link: shared
3838
debug: false
39-
39+
4040
Note: this is a fairly sophisticated build stage that inspects
4141
the build artifacts available to decide what to enable in PETSc.
4242
By default, this package builds PETSc with all required artifacts,
@@ -64,7 +64,7 @@ def configure(ctx, stage_args):
6464
if stage_args['coptflags']:
6565
conf_lines.append('COPTFLAGS=%s' % stage_args['coptflags'])
6666
if stage_args['link']:
67-
conf_lines.append('--with-shared-libraries=%d' %
67+
conf_lines.append('--with-shared-libraries=%d' %
6868
bool(stage_args['link'] == 'shared'))
6969
# must explicitly set --with-debugging=0 to disable debugging
7070
conf_lines.append('--with-debugging=%d' % stage_args['debug'])
@@ -91,7 +91,7 @@ def configure(ctx, stage_args):
9191
conf_lines.append('--with-blas-dir=$BLAS_DIR')
9292
conf_lines.append('--with-lapack-dir=$LAPACK_DIR')
9393

94-
# Special case, ParMETIS also provides METIS
94+
# Special case, ParMETIS also provides METIS
9595
if 'PARMETIS' in ctx.dependency_dir_vars:
9696
conf_lines.append('--with-metis-dir=$PARMETIS_DIR')
9797
conf_lines.append('--with-parmetis-dir=$PARMETIS_DIR')
@@ -116,8 +116,17 @@ def configure(ctx, stage_args):
116116
conf_lines.append('--with-suitesparse-include=${SUITESPARSE_DIR}/include/suitesparse')
117117
conf_lines.append('--with-suitesparse-lib=[${SUITESPARSE_DIR}/lib/libumfpack.a,libklu.a,libcholmod.a,libbtf.a,libccolamd.a,libcolamd.a,libcamd.a,libamd.a,libsuitesparseconfig.a]')
118118

119+
if 'HYPRE' in ctx.dependency_dir_vars:
120+
if ctx.parameters['platform'] == 'Darwin':
121+
libHYPRE = '${HYPRE_DIR}/lib/libHYPRE.a'
122+
else:
123+
libHYPRE = '${HYPRE_DIR}/lib/libHYPRE.so'
124+
conf_lines.append('--with-hypre=1')
125+
conf_lines.append('--with-hypre-include=${HYPRE_DIR}/include')
126+
conf_lines.append('--with-hypre-lib=%s' % libHYPRE)
127+
119128
for dep_var in ctx.dependency_dir_vars:
120-
if dep_var in ['BLAS', 'LAPACK', 'OPENBLAS', 'PARMETIS',
129+
if dep_var in ['BLAS', 'HYPRE', 'LAPACK', 'OPENBLAS', 'PARMETIS',
121130
'SCOTCH', 'TRILINOS', 'SUITESPARSE']:
122131
continue
123132
if dep_var == 'MPI':
@@ -131,7 +140,7 @@ def configure(ctx, stage_args):
131140
else:
132141
conf_lines.append('--with-fc=0')
133142
continue
134-
conf_lines.append('--with-%s-dir=$%s_DIR' %
143+
conf_lines.append('--with-%s-dir=$%s_DIR' %
135144
(dep_var.lower(),
136145
dep_var))
137146
for package in stage_args['download']:

0 commit comments

Comments
 (0)