Skip to content

Commit

Permalink
Simplify petsc container
Browse files Browse the repository at this point in the history
  • Loading branch information
loganharbour committed Aug 14, 2024
1 parent cc2864d commit 84a36a8
Showing 1 changed file with 3 additions and 17 deletions.
20 changes: 3 additions & 17 deletions apptainer/petsc.def
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
{#- PETSC_GIT_REMOTE: The git remote to use to get PETSc -#}

{#- Optional jinja arguments -#}
{#- PETSC_ALT: Set to anything to use the alternate version of PETSc -#}
{#- PETSC_OPTIONS: Options to pass to the PETSc build script -#}
{#- MOOSE_JOBS: Number of jobs to pass to the PETSc build script -#}
{#- MPI_FLAVOUR: The flavour of MPI to use (options: mpich, openmpi; default: mpich) -#}
Expand Down Expand Up @@ -35,6 +34,8 @@ From: {{ APPTAINER_FROM }}
export PETSC_DIR={{ PETSC_DIR }}

%post
umask 022

# Set the MPI environment
{%- if MPI_FLAVOUR == "mpich" %}
source /opt/mpi/use-mpich
Expand All @@ -57,19 +58,10 @@ From: {{ APPTAINER_FROM }}
cd ${PETSC_SRC_DIR}
git checkout ${PETSC_GIT_SHA}

PETSC_OPTIONS+=" --skip-submodule-update"
{%- if PETSC_ALT is defined %}
PETSC_BUILD_SCRIPT=${ROOT_BUILD_DIR}/scripts/update_and_rebuild_petsc_alt.sh
{%- else %}
# Need a newer cmake for current petsc
PETSC_OPTIONS+=" --download-cmake"
PETSC_BUILD_SCRIPT=${ROOT_BUILD_DIR}/scripts/update_and_rebuild_petsc.sh
{%- endif %}

# Build PETSc
umask 022
cd ${ROOT_BUILD_DIR}
MOOSE_JOBS={{ MOOSE_JOBS }} PETSC_PREFIX=${PETSC_DIR} PETSC_SRC_DIR=${PETSC_SRC_DIR} ${ROOT_BUILD_DIR}/scripts/update_and_rebuild_petsc.sh ${PETSC_OPTIONS}
MOOSE_JOBS={{ MOOSE_JOBS }} PETSC_PREFIX=${PETSC_DIR} PETSC_SRC_DIR=${PETSC_SRC_DIR} ${ROOT_BUILD_DIR}/scripts/update_and_rebuild_petsc.sh --skip-submodule-update${PETSC_OPTIONS}

{%- if MPI_FLAVOUR == "openmpi" %}
# If we're using openmpi, we need to allow running as root
Expand All @@ -85,16 +77,10 @@ From: {{ APPTAINER_FROM }}
cd petsc
make SLEPC_DIR=${PETSC_DIR} PETSC_DIR=${PETSC_DIR} PETSC_ARCH= check

# Fix possibly bad permissions
chmod -R o=u-w,g=u-w ${PETSC_DIR}

# Clean Up
rm -rf ${ROOT_BUILD_DIR}

%files
{{ MOOSE_DIR }}/scripts/configure_petsc.sh {{ ROOT_BUILD_DIR }}/scripts/configure_petsc.sh
{{ MOOSE_DIR }}/scripts/update_and_rebuild_petsc.sh {{ ROOT_BUILD_DIR }}/scripts/update_and_rebuild_petsc.sh
{{ MOOSE_DIR }}/scripts/tao_restore_viewer.patch {{ ROOT_BUILD_DIR }}/scripts/tao_restore_viewer.patch
{%- if PETSC_ALT is defined %}
{{ MOOSE_DIR }}/scripts/update_and_rebuild_petsc_alt.sh {{ ROOT_BUILD_DIR }}/scripts/update_and_rebuild_petsc_alt.sh
{%- endif %}

0 comments on commit 84a36a8

Please sign in to comment.