Underworld

a long term geodynamics simulation platform

Environment Variables Checklist


Environment Variables on Computer Clusters

Whether using a pre-installed Underworld module or your own copy of Underworld on a computer cluster, you should not need to set up any environment variables. See Cluster for more details.


How Can I Check My Environment Variables?

To view all of your environment variables, type:

env

To view a particular environment variable, for example MPI_DIR, type:

echo $MPI_DIR


How Can I Edit and Save My Environment Variables?

One way this can be done is from your shell file:

  • ~/.bashrc (if using bash) by listing each environment variable with 'export' if front of it
  • ~/.tcshrc (if using tcsh) by listing each environment variable with 'setenv' if front of it.

I Can't See My Shell File

Your shell file is a hidden file (the . in front hides it from normal view). So to check whether you have your own shell file, navigate into your home directory and type the following, which lists all files (including hidden files):

ls -a

If you still cannot see a shell file, you have probably been using the system default (e.g. /etc/bashrc) instead.

To create your own shell file (in this example a bash shell file), create a new file in your home directory called .bashrc using an editor. For example, if you are using the editor VIM, type:

vim ~/.bashrc

To add the system default (if there is one) to your bash shell file, type the following into your new file:

. /etc/bashrc

then save the file. You can now add your environment variable to your new shell file. After adding your environment variables, save and close your shell file and activate your changes (see below).

Activating Changes Made to My Shell File

After editing, saving and closing your shell file, to activate the changes you will need to either exit your terminal application or type the following:

source ~/.bashrc

Note: Your ~/.bashrc file should be sourced by your .bash_profile. If not, add the following to your .bash_profile:

source ~/.bashrc


Note on Keeping Environment Variables Up-to-date

When updating your copy of Underworld to a later version (see Updates), before you compile the updated version check first that your environment variables are still up-to-date (for example that they are pointing to the latest versions of each software dependency). If you are on a computer cluster, you can take a look at the sample bashrc file in the Machines directory of your copy of Underworld for the particular cluster you are using. If you update your .bashrc file (if using bash), remember to source your .bashrc file after making amendments to update your environment variables..


Local Machines

Below are sample lists of environment variables for Linux, for the case of all software having been installed in /usr/local.


MPI (such as OpenMPI or MPICH)

bash

export MPI_DIR=/usr/local/mpich

tcsh

setenv MPI_DIR /usr/local/mpich

Note: Gentoo users should use MPI_DIR=/usr instead of /usr/local/mpich

Note: You will also need to add the location of your MPI implementation binaries to your path. If you are using Mpich 2 on a mac, you will need to add the location of the Mpich 2 dynamic libraries to your path as well. Follow links to more information for MPICH and OpenMPI.


Python

bash

export PYTHON_DIR=/usr/local/python

tcsh

setenv PYTHON_DIR /usr/local/python

More information on Python ...


PETSC

bash

export PETSC_DIR=/usr/local/petsc-2.3.2
export PETSC_ARCH=linux

tcsh

setenv PETSC_DIR /usr/local/petsc-2.3.2
setenv PETSC_ARCH linux

Note: if you are using PETSc 2.3.2 on a mac, you will also need to add the dynamic libraries to your path (see Adding PETSc 2.3.2 to your Path.

More information including instructions on how to check your machine architecture...


HDF5

bash

export HDF5_DIR=/usr/local/hdf5

tcsh

setenv HDF5_DIR /usr/local/hdf5

More information on HDF5 ...


Visualisation

You will need to add the environment variable for the application for each file format in which you wish to export (for further information on installing these, please refer to Dependencies). For example, if these applications were installed in /usr/local:

bash

export PNG_DIR=/usr/local
export JPEG_DIR=/usr/local
export TIFF_DIR=/usr/local
export LIBFAME_DIR=/usr/local
export LIBAVCODEC_DIR=/usr/local/libavcodec

tcsh

setenv PNG_DIR /usr/local
setenv JPEG_DIR /usr/local
setenv TIFF_DIR /usr/local
setenv LIBFAME_DIR /usr/local/libfame
setenv LIBAVCODEC_DIR /usr/local/libavcodec


Editor

You will need to set the EDITOR environment variable to a suitable editor, before you can svn commit. For example, for vim:

bash

export EDITOR "vim"

tcsh

setenv EDITOR="vim"


-- Wendy Mason - 22 January 2010