This is a batteries-included template for a container that provides a standardized environment so that code written for a local machine can run just as cleanly on an HPC (both Hyak/Mox and NeRSC/Cori are currently supported).
Currently we just package Anaconda and gfort, but like we can include whatever we need.
Basically just provides a really simple dispatch to docker/singularity/shifter depending on the locale.
More functionality can easily be packed in (or the base container can be replaced) as need be.
To install on Mox, use Singularity to pull it in the directory you want to install to. This will look like
module load singularity
singularity pull mcenv.sif docker://mccoygroup/mcenv:latestYou can then load the built-in support script by
env_file=/tmp/mcenv.sh
./mcenv.sif get_env > $env_file
. $env_file
rm env_fileThe built in mcenv function will help set up the environment, in particular by managing calls into docker/singularity/shifter` and providing two env variables
MCENV_PACKAGES_PATH - path to be prepended to `PYTHONPATH` to provide a custom packages directory that can be pointed to different places
MCENV_SCRIPTS_PATH - path to a scripts directory that python will look into for runnable script files
At this point mcenv can start a python shell with
mcenvrun python scripts with
mcenv --script path/to/script.pyrun arbitrary bash code
mcenv --sh path/to/script.shor just execute anything inside the env with
mcenv --exec cmds...