77
88{#- Optional jinja arguments -#}
99{#- CONDA_ALT_CHANNEL: An alternate channel to add to conda -#}
10+ {#- CONDUIT_GIT_SHA: The git SHA to use for conduit -#}
11+ {#- CONDUIT_GIT_REMOTE: The git remote to use to get conduit -#}
12+ {#- CONDUIT_OPTIONS: Options to pass to conduit build -#}
13+ {#- MFEM_GIT_SHA: The git SHA to use for MFEM -#}
14+ {#- MFEM_GIT_REMOTE: The git remote to use to get MFEM -#}
15+ {#- MFEM_OPTIONS: Options to pass to mfem build -#}
1016{#- MOOSE_TOOLS_VERSION: The version to pin moose-tools to (if any) -#}
1117{#- MOOSE_JOBS: Number of jobs to pass to the builds -#}
12- {#- WITH_LIBTORCH: The libtorch distribution to use (cpu, cu121, etc); default: cpu -#}
1318{#- PROFILING: Set to anything to build for profiling (add gperftools) -#}
19+ {#- WITH_LIBTORCH: The libtorch distribution to use (cpu, cu121, etc); default: cpu -#}
20+ {#- WITH_MFEM: Whether or not to build mfem (default: 1 to build, 0 to not build) -#}
1421
1522{#- Set WITH_LIBTORCH default if not set -#}
1623{%- if WITH_LIBTORCH is not defined %}
1724{%- set WITH_LIBTORCH = 'cpu' %}
1825{%- endif %}
26+ {#- Set WITH_MFEM default if not set -#}
27+ {%- if WITH_MFEM is not defined %}
28+ {%- set WITH_MFEM = '1' %}
29+ {%- endif %}
1930
2031{#- The within-container build directory to use -#}
2132{%- set ROOT_BUILD_DIR = '/root/build' -%}
2233
2334{#- Location to install miniforge3 -#}
2435{%- set MOOSE_MINIFORGE = '/opt/miniforge3' -%}
2536
26- {#- The installation location for wasp -#}
27- {%- set WASP_DIR = '/opt/wasp' -%}
37+ {#- Name of the environment to create in conda -#}
38+ {%- set MOOSE_CONDA_ENV_NAME = 'moose' -%}
39+
2840{#- The installation location for gperftools -#}
2941{%- set GPERF_DIR = '/opt/gperftools' -%}
3042{#- The installation location for pprof -#}
3143{%- set PPROF_DIR = '/opt/pprof' -%}
3244{#- The installation location for libtorch -#}
33- {%- set LIBTORCH_DEST = '/opt' -%}
34-
45+ {%- set LIBTORCH_DIR = '/opt/libtorch' -%}
46+ {#- The script used to install conduit -#}
47+ {%- set CONDUIT_BUILD_SCRIPT = 'update_and_rebuild_conduit.sh' -%}
48+ {#- The installation location for conduit -#}
49+ {%- set CONDUIT_DIR = '/opt/conduit' -%}
50+ {#- The script used to install mfem -#}
51+ {%- set MFEM_BUILD_SCRIPT = 'update_and_rebuild_mfem.sh' -%}
52+ {#- The installation location for mfem -#}
53+ {%- set MFEM_DIR = '/opt/mfem' -%}
54+ {#- The installation location for wasp -#}
55+ {%- set WASP_DIR = '/opt/wasp' -%}
3556{#- The script used to install wasp -#}
3657{%- set WASP_BUILD_SCRIPT = 'update_and_rebuild_wasp.sh' -%}
3758
@@ -50,9 +71,14 @@ Fingerprints: 0CFFCAB55E806363601C442D211817B01E0911DB
5071 export WASP_DIR={{ WASP_DIR }}
5172 export PATH=${WASP_DIR}/bin:$PATH
5273
74+ {%- if WITH_MFEM %}
75+ export CONDUIT_DIR={{ CONDUIT_DIR }}
76+ export MFEM_DIR={{ MFEM_DIR }}
77+ {%- endif %}
78+
5379{%- if WITH_LIBTORCH %}
5480 # Make libtorch visible to moose
55- export LIBTORCH_DIR={{ LIBTORCH_DEST }}/libtorch
81+ export LIBTORCH_DIR={{ LIBTORCH_DIR }}
5682 # Adding this to not get GPU initialization errors from MPICH
5783 export MPIR_CVAR_ENABLE_GPU=0
5884{%- endif %}
@@ -105,17 +131,9 @@ Fingerprints: 0CFFCAB55E806363601C442D211817B01E0911DB
105131 chmod 755 /opt/code-server/bin/*
106132 chmod 644 /opt/code-server/extensions/*
107133
108- # Clone WASP
109- cd ${ROOT_BUILD_DIR}
110- WASP_SRC_DIR=${ROOT_BUILD_DIR}/wasp
111- git clone ${WASP_GIT_REMOTE} ${WASP_SRC_DIR}
112- cd ${WASP_SRC_DIR}
113- git checkout ${WASP_GIT_SHA}
114- git submodule update --init --recursive
115-
116134{%- if WITH_LIBTORCH %}
117135 # Libtorch-related vars
118- LIBTORCH_DEST={{ LIBTORCH_DEST }}
136+ LIBTORCH_DEST=$(realpath -m {{ LIBTORCH_DIR }}/..)
119137 LIBTORCH_VER=2.1.0
120138 LIBTORCH_DISTRIBUTION={{ WITH_LIBTORCH }}
121139
@@ -138,6 +156,39 @@ Fingerprints: 0CFFCAB55E806363601C442D211817B01E0911DB
138156{%- endif %}
139157{%- endif %}
140158
159+ {%- if WITH_MFEM %}
160+ # Load MFEM jinja variables
161+ CONDUIT_GIT_SHA={{ CONDUIT_GIT_SHA }}
162+ CONDUIT_GIT_REMOTE={{ CONDUIT_GIT_REMOTE }}
163+ CONDUIT_BUILD_SCRIPT=${ROOT_BUILD_DIR}/{{ CONDUIT_BUILD_SCRIPT }}
164+ CONDUIT_DIR={{ CONDUIT_DIR }}
165+ MFEM_BUILD_SCRIPT=${ROOT_BUILD_DIR}/{{ MFEM_BUILD_SCRIPT }}
166+ MFEM_DIR={{ MFEM_DIR }}
167+ MFEM_GIT_SHA={{ MFEM_GIT_SHA }}
168+ MFEM_GIT_REMOTE={{ MFEM_GIT_REMOTE }}
169+
170+ # Clone conduit
171+ cd ${ROOT_BUILD_DIR}
172+ git clone $CONDUIT_GIT_REMOTE
173+ CONDUIT_SRC_DIR=${ROOT_BUILD_DIR}/conduit
174+ cd ${CONDUIT_SRC_DIR}
175+ git checkout $CONDUIT_GIT_SHA
176+ git submodule update --init
177+
178+ # Clone MFEM
179+ cd ${ROOT_BUILD_DIR}
180+ git clone $MFEM_GIT_REMOTE
181+ MFEM_SRC_DIR=${ROOT_BUILD_DIR}/mfem
182+ cd ${MFEM_SRC_DIR}
183+ git checkout $MFEM_GIT_SHA
184+
185+ # Install conduit
186+ CONDUIT_DIR=${CONDUIT_DIR} CONDUIT_SRC_DIR=${CONDUIT_SRC_DIR} ${CONDUIT_BUILD_SCRIPT} {{ CONDUIT_OPTIONS }}
187+
188+ # Install MFEM
189+ MFEM_DIR=${MFEM_DIR} MFEM_SRC_DIR=${MFEM_SRC_DIR} CONDUIT_DIR=${CONDUIT_DIR} ${MFEM_BUILD_SCRIPT} {{ MFEM_OPTIONS }}
190+ {%- endif %}
191+
141192 # Install miniforge in MOOSE_MINIFORGE
142193 MINIFORGE_SCRIPT=${ROOT_BUILD_DIR}/miniforge3.sh
143194 curl -L https://github.com/conda-forge/miniforge/releases/download/${MINIFORGE_VERSION}/Miniforge3-${MINIFORGE_VERSION}-Linux-x86_64.sh -o ${MINIFORGE_SCRIPT}
@@ -160,6 +211,14 @@ Fingerprints: 0CFFCAB55E806363601C442D211817B01E0911DB
160211 # Needed for coverage
161212 pip3 --no-cache install lcov-cobertura
162213
214+ # Clone WASP
215+ cd ${ROOT_BUILD_DIR}
216+ WASP_SRC_DIR=${ROOT_BUILD_DIR}/wasp
217+ git clone ${WASP_GIT_REMOTE} ${WASP_SRC_DIR}
218+ cd ${WASP_SRC_DIR}
219+ git checkout ${WASP_GIT_SHA}
220+ git submodule update --init --recursive
221+
163222 # Build and install wasp
164223 # This is redundant; hopefully we can use the one from conda in the future
165224 WASP_SRC_DIR=${WASP_SRC_DIR} ${WASP_BUILD_SCRIPT} -D CMAKE_INSTALL_PREFIX:STRING=${WASP_DIR}
@@ -208,6 +267,8 @@ Fingerprints: 0CFFCAB55E806363601C442D211817B01E0911DB
208267%files
209268 {{ FILES_DIR }}/opt/code-server/bin/code-server-setup-extensions /opt/code-server/bin/code-server-setup-extensions
210269 {{ FILES_DIR }}/opt/code-server/bin/code-server-start /opt/code-server/bin/code-server-start
270+ {{ MOOSE_DIR }}/scripts/{{ MFEM_BUILD_SCRIPT }} {{ ROOT_BUILD_DIR }}/{{ MFEM_BUILD_SCRIPT }}
271+ {{ MOOSE_DIR }}/scripts/{{ CONDUIT_BUILD_SCRIPT }} {{ ROOT_BUILD_DIR }}/{{ CONDUIT_BUILD_SCRIPT }}
211272 {{ MOOSE_DIR }}/scripts/{{ WASP_BUILD_SCRIPT }} {{ ROOT_BUILD_DIR }}/{{ WASP_BUILD_SCRIPT }}
212273 {{ MOOSE_DIR }}/scripts/configure_wasp.sh {{ ROOT_BUILD_DIR }}/configure_wasp.sh
213274{%- if WITH_LIBTORCH %}
0 commit comments