Skip to content

Commit fe47d01

Browse files
committed
Add package builder for MFEM solver BP
1 parent 8cb2600 commit fe47d01

File tree

1 file changed

+89
-0
lines changed

1 file changed

+89
-0
lines changed
Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
# Copyright (c) 2021, Lawrence Livermore National Security, LLC. Produced at
2+
# the Lawrence Livermore National Laboratory. LLNL-CODE-734707. All Rights
3+
# reserved. See files LICENSE and NOTICE for details.
4+
#
5+
# This file is part of CEED, a collection of benchmarks, miniapps, software
6+
# libraries and APIs for efficient high-order finite element and spectral
7+
# element discretizations for exascale applications. For more information and
8+
# source code availability see http://github.com/ceed.
9+
#
10+
# The CEED research is supported by the Exascale Computing Project (17-SC-20-SC)
11+
# a collaborative effort of two U.S. Department of Energy organizations (Office
12+
# of Science and the National Nuclear Security Administration) responsible for
13+
# the planning and preparation of a capable exascale ecosystem, including
14+
# software, applications, hardware, advanced system engineering and early
15+
# testbed platforms, in support of the nation's exascale computing imperative.
16+
17+
# Download and build METIS v4/v5.
18+
19+
if [[ -z "$pkg_sources_dir" ]]; then
20+
echo "This script ($0) should not be called directly. Stop."
21+
return 1
22+
fi
23+
if [[ -z "$OUT_DIR" ]]; then
24+
echo "The variable 'OUT_DIR' is not set. Stop."
25+
return 1
26+
fi
27+
if [[ -z "$MFEM_SOURCE_DIR" ]]; then
28+
echo "mfem must be built"
29+
return 1
30+
fi
31+
pkg_src_dir="solvers"
32+
SOLVERS_SOURCE_DIR="$pkg_sources_dir/$pkg_src_dir"
33+
pkg_bld_dir="$OUT_DIR/solvers"
34+
mfem_solvers_branch="${mfem_solvers_branch:-main}"
35+
pkg_var_prefix="solvers_"
36+
pkg="mfem solvers bp (branch $mfem_solvers_branch)"
37+
38+
function solvers_clone()
39+
{
40+
pkg_repo_list=("[email protected]:ceed/solvers.git"
41+
"https://github.com/ceed/solvers.git")
42+
pkg_git_branch="${mfem_solvers_branch:-master}"
43+
cd "$pkg_sources_dir" || return 1
44+
if [[ -d "$pkg_src_dir" ]]; then
45+
update_git_package
46+
return
47+
fi
48+
for pkg_repo in "${pkg_repo_list[@]}"; do
49+
echo "Cloning $pkg from $pkg_repo ..."
50+
git clone "$pkg_repo" "$pkg_src_dir" && return 0
51+
done
52+
echo "Could not successfully clone $pkg. Stop."
53+
return 1
54+
55+
}
56+
57+
function mfem_solvers_build()
58+
{
59+
if package_build_is_good; then
60+
echo "Using successfully built $pkg from OUT_DIR."
61+
return 0
62+
elif [[ ! -d "$pkg_bld_dir" ]]; then
63+
echo "Cloning solvers from $SOLVERS_SOURCE_DIR to OUT_DIR ..."
64+
cd "$OUT_DIR" && git clone "$SOLVERS_SOURCE_DIR" || {
65+
echo "Cloning $SOLVERS_SOURCE_DIR to OUT_DIR failed. Stop."
66+
return 1
67+
}
68+
fi
69+
cd "$pkg_bld_dir/mfem-solver-bp"
70+
echo "Building $pkg, sending output to ${pkg_bld_dir}_build.log ..." && {
71+
cd "$pkg_bld_dir/mfem-solver-bp" && \
72+
(echo "MFEM_DIR=$OUT_DIR/mfem" > Make.user) && \
73+
if [[ "$MFEM_BRANCH" == "split-nonconforming-tet" ]]; then
74+
echo "USER_CXXFLAGS=-DMFEM_SIMPLEX_LOR" >> Make.user
75+
fi
76+
make -j $num_proc_build
77+
} &> "${pkg_bld_dir}_build.log" || {
78+
echo " ... building $pkg FAILED, see log for details."
79+
return 1
80+
}
81+
echo "Build successful."
82+
}
83+
84+
85+
function build_package()
86+
{
87+
solvers_clone && get_package_git_version && mfem_solvers_build
88+
}
89+

0 commit comments

Comments
 (0)