Skip to main content

Build SAM from Source

·236 words·2 mins
Jin Li
Author
Jin Li
Fate lies within the lightcone.

Build SAM
#

Prerequisites
#

SAM relies on the MOOSE framework. We build MOOSE by following the instructions on the MOOSE website first.

Install Mambaforge3
#

For Linux users:

1
2
curl -L -O https://github.com/conda-forge/miniforge/releases/latest/download/Mambaforge-Linux-x86_64.sh
bash Mambaforge-Linux-x86_64.sh -b -p ~/mambaforge3

After installing, put Mambaforge’s path to system environment PATH:

1
export PATH=$HOME/mambaforge3/bin:$PATH

so that the system recognizes the mamba command.

Then initialize mambaforge by

1
mamba init

This command will append several mamba initialization to your ~/.bashrc file. Since I use zsh, I moved those lines from ~/.bashrc to ~/.zshrc.

Then restart the terminal.

Install MOOSE
#

  1. Add the INL public channel to Conda:

    1
    
    conda config --add channels https://conda.software.inl.gov/public
  2. Create moose environment in Conda

    1
    
    mamba create -n moose moose-dev
  3. Activate the environment

    1
    
    mamba activate moose

Clone SAM and Build
#

Clone SAM from ANL’s GitLab
#

  1. Get an access token to the GitLab repository.

    GitLab -> Settings -> Access Tokens

  2. Clone the SAM repository to your computer or cluster

    1
    2
    3
    
    mkdir ~/Documents
    cd ~/Documents
    git clone https://git-nse.egs.anl.gov/*YourUserName_or_SAM*/SAM.git

    It will ask you for the GitLab username and password. Use the access token you generated for the password.

Build libmesh
#

  1. Get moose submodule

    1
    2
    3
    
    cd SAM
    git submodule init
    git submodule update --recursive

Build SAM
#

  1. Build SAM

    1
    2
    
    cd ~/Documents/SAM
    make -j4
  2. Run the tests

    1
    
    ./run_tests -j4

    If SAM was built correctly, all the tests will pass.