---
title: "MOOSE"
canonical: "https://kb.uconn.edu/space/SH/27675230302/MOOSE"
format: markdown
---
MOOSE is an open-source, parallel finite element framework.

MOOSE can be installed two different ways.

One through a conda miniforge environment and one available through MOOSE’s github repository.

This guide will provide the steps on how to install MOOSE both through conda and by source from MOOSE’s HPC guide.

## MOOSE conda install

MOOSE provides a conda guide located here:

[https://mooseframework.inl.gov/getting_started/installation/moose_conda_binary.html](https://mooseframework.inl.gov/getting_started/installation/moose_conda_binary.html) 

## MOOSE source install

MOOSE provides a HPC source install guide located here:

[https://mooseframework.inl.gov/getting_started/installation/hpc_install_moose.html](https://mooseframework.inl.gov/getting_started/installation/hpc_install_moose.html) 

Using their HPC guide above, here are the exact commands that can be used to download, install, and test MOOSE.

Submit an interactive SLURM job to a compute node, the following example will request 1 node and 40 cores.

```
srun -N 1 -n 40 -p general --pty bash # this allocates 1 nodes with 40 cores, helpful to build MOOSE and their dependencies faster
```

Once a node is assigned to the srun job, perform the following commands: (you replace the openmpi version for a version of MPI that would like to be used)

```
module load openmpi/5.0.6 cmake
export CC=mpicc CXX=mpicxx FC=mpif90 F90=mpif90 F77=mpif77

mkdir -p ~/projects
cd ~/projects
git clone https://github.com/idaholab/moose.git
cd moose
git checkout master

export MOOSE_JOBS=40 METHOD=opt

cd ~/projects/moose/scripts

./update_and_rebuild_petsc.sh

./update_and_rebuild_libmesh.sh

./update_and_rebuild_wasp.sh

cd ../test/

make -j 40

./run_tests -j 40  
```

It will take time to install and run the MOOSE tests, but if MOOSE installed successfully, all the tests should pass.

### MOOSE conda job submission

Here's an example as batch file that you can use to run MOOSE from the conda installation requesting 1 node, 40 cores, and 5G of RAM per cpu core:

```
#!/bin/bash 
#SBATCH --job-name=yourjobname
#SBATCH --output=yourjoboutput.out 
#SBATCH --nodes=1 ## no of nodes 
#SBATCH --partition=general 
#SBATCH --ntasks=40 
#SBATCH --mem-per-cpu=5G
#SBATCH --constraint=epyc128
#SBATCH --exclude=cn[473-479]
#SBATCH --mail-user=emailhere@uconn.edu
#SBATCH --mail-type=END

module load openmpi/5.0.6
source /gpfs/homefs1/yournetidhere/miniconda3/etc/profile.d/conda.sh 

conda activate moose  

mpirun -np 40 /gpfs/homefs1/netidhere/path/to/your/binary -i yourinputhere.i

```

This will run the MOOSE.

> ℹ️ If the MOOSE conda environment got installed within miniforge, replace miniconda3 with miniforge for the path to the conda.sh file in the above submission script.

### MOOSE source job submission

Here's an example as batch file that you can use to run MOOSE from the source installation requesting 1 node, 40 cores, and 5G of RAM per cpu core:

```
#!/bin/bash 
#SBATCH --job-name=yourjobname
#SBATCH --output=yourjoboutput.out 
#SBATCH --nodes=1 ## no of nodes 
#SBATCH --partition=general 
#SBATCH --ntasks=40 
#SBATCH --mem-per-cpu=5G
#SBATCH --constraint=epyc128
#SBATCH --exclude=cn[473-479]
#SBATCH --mail-user=emailhere@uconn.edu
#SBATCH --mail-type=END

module load openmpi/5.0.6

mpirun -np 40 /gpfs/homefs1/netidhere/path/to/your/binary -i yourinputhere.i

```