Skip to content

Programming language resources

Bob Yantosca edited this page Sep 21, 2023 · 24 revisions

Fortran

Many numerically-intensive science applications (such as GEOS-Chem) are written in Fortran, which generates highly-optimized executables suitable for running on HPC installations. There are several Fortran compilers available, but we recommend the GNU Fortran (aka gfortran), which is open-source, and therefore suitable for running in cloud computing environments.

Python

We use GCPy and other Python code to analyze and visualize output from GEOS-Chem simulations. Python, which is open-source, contains many packages that are suitable for scientific applications. Please also see our list of Python tools for GEOS-Chem.

Installing your own Python environments

You can also use mamba to install custom Python environments for your research applications. By default mamba installs your packages in your home directory under ~/.conda. While a safe place to keep this data it is also very low performance due to filesystem latency. It also makes it hard to share your Python environments with other people on the cluster.

You can tell mamba to install to a different location. We recommend installing Python environments to your /n/jacob_lab/Users/$USER directory (where $USER is the environment variable that stores your Cannon username).

  1. Make sure that the Python 3.10.9 module is loaded into your Linux environment. This also loads the mamba package manager.

    module list python
    
    Currently Loaded Modules Matching: python
      1) module load python/3.10.9-fasrc01

    If python is not loaded, then type:

    $ module load python/3.10.9-fasrc01
  2. Create the following directory:

    $ cd /n/jacob_lab/Users/$USER
    $ mkdir -p mamba
  3. Add the following environment variables to your ~/.my_personal_settings or ~/.bash_aliases file (whichever one you have):

    # Specify installation path for Python packages and environments
    export MAMBA_PREFIX="/n/jacob_lab/Users/$USER/mamba"
    export MAMBA_ENVS_PATH="${MAMBA_PREFIX}/envs"
    export MAMBA_PKGS_DIRS="${MAMBA_PREFIX}/pkgs"
  4. Apply the changes by typing:

    $ source ~/.bashrc
  5. Create the environment. We recommend using a YAML configuration file (such as

    $ mamba env create -n ENV-NAME --file=CONFIG-FILE-NAME

    where ENV-NAME is the name of your Python environment and CONFIG-FILE-NAME is the name of a YAML configuration file containing a list of packages to be installed. If you don't have a configuration file, you can modify an existing configuration file (such as the environment.yml file that ships with GCPy).

  6. To activate the environment, type:

    $ mamba activate ENV-NAME

    and to deactivate the environment, type:

    $ mamba deactivate

Recreating a Mamba environment

Follow these instructions to recreate a Mamba environment on a new machine.

  1. Activate your current Mamba environment and export the package list to a YAML file:

    $ mamba activate my-env
    $ mamba env export > my-environment.yml
    $ mamba deactivate
  2. Log into the new machine and transfer the my-environment.yml file there. Then use the following commands:

    $ mamba create --name my-env
    $ mamba activate my-env
    $ mamba env update --name root --file my-environment.yml
    $ mamba deactivate my-env
  3. Delete your original Mamba environment on the old machine (if necessary):

    $ mamba remove --name my-env --all

Matlab

Group members: Feel free to add Need links here.

Clone this wiki locally