Using GrADS2 on Shaheen
Introduction
Grid Analysis and Display System or GrADS is an interactive desktop tool that is used for easy access, manipulation, and visualization of earth science data.
Since it has quite a few dependencies, we found it more suitable to make it available on Shaheen by creating a container image with CentOS 7.4 as Linux operating system of choice and all the dependencies required by GrADS2/2.2.1.
At the moment singularity can only open and display X11 window on login nodes. On compute node however, GrADS functionalities can be called in non-GUI mode.
Please make sure your GUI based computations a not memory hungry because it can compromise other users' experience on that login node.
Get the container image
First get the container image from DockerHub to Shaheen filesystem
cd $HOME
mkdir $HOME/tmp
export SINGULARITY_TMPDIR=$HOME/tmp
module load singularity
singularity pull docker://krccl/grads:2.2.1
The above commands will end up grads_2.2.1.sif
which is your Singularity image file.
GrADS requires some supplementary data dowloaded and pointed to by a couple of environment variables.
You can download the data from ftp://cola.gmu.edu/grads/data2.tar.gz and untar
it in your /project
directory. The other file you will need is you User Defined Plug-in Table (UDPT). Its a text file that tells GrADS where the plugins are located. Since we are using a container, the following file will work for it. Let’s can this file udpt
.
gxprint Cairo /software/grads-2.2.1/lib/libgxpCairo.so
gxdisplay Cairo /software/grads-2.2.1/lib/libgxdCairo.so
The following two variable will then be set:
export SINGULARITYENV_GAUDPT=/path/to/your/udpt
export SINGULARITYENV_GADDIR=/path/to/your/data/directory
Interactive session
To launch it interactively with a command prompt on a compute node:
shaima0d@cdl3> salloc -p debug
salloc: Granted job allocation 24441493
shaima0d@gateway1> srun --pty bash
shaima0d@nid00009> module load singularity
shaima0d@nid00009> export SINGULARITYENV_GAUDPT=/scratch/shaima0d/grads_test/grads_data/udpt
shaima0d@nid00009> export SINGULARITYENV_GADDIR=/scratch/shaima0d/grads_test/grads_data
shaima0d@nid00009> singularity exec grads_2.2.1.sif grads -bl
Grid Analysis and Display System (GrADS) Version 2.2.1
Copyright (C) 1988-2018 by George Mason University
GrADS comes with ABSOLUTELY NO WARRANTY
See file COPYRIGHT for more information
Config: v2.2.1 little-endian readline grib2 netcdf hdf4-sds hdf5 opendap-grids geotiff shapefile
Issue 'q config' and 'q gxconfig' commands for more detailed configuration information
GX Package Initialization: Size = 11 8.5
Running in Batch mode
ga-> open model.ctl
Scanning description file: model.ctl
Data file model.dat is open as file 1
LON set to 0 360
LAT set to -90 90
LEV set to 1000 1000
Time values set: 1987:1:2:0 1987:1:2:0
E set to 1 1
ga-> set gxout shaded
ga-> set display color white
ga-> c
ga-> d ps
Contouring: 500 to 1000 interval 50
ga-> gxprint ps.eps
Created EPS file ps.eps
ga-> quit
GX Package Terminated
Batch job
The command we ran in the interactive session can be coded in grads script for batch processing. Here is an example grads script that is our workload, let’s call it script.gs
'reinit'
'open model.ctl'
'set gxout shaded'
'set display color white'
'c'
'd ps'
'gxprint ps.eps'
'quit'
Here is an example jobscript for submit our workload to SLURM and schedule a job to run on a single node on our behalf:
#!/bin/bash
#SBATCH --time=00:30:00
#SBATCH --nodes=1
module load singularity
export SINGULARITYENV_GAUDPT=/scratch/shaima0d/grads_test/grads_data/udpt
export SINGULARITYENV_GADDIR=/scratch/shaima0d/grads_test/grads_data
srun singularity exec grads_2.2.1.sif grads -bcl 'script.gs'
and the output looks similar as above:
shaima0d@cdl3> cat slurm-24441646.out
Grid Analysis and Display System (GrADS) Version 2.2.1
Copyright (C) 1988-2018 by George Mason University
GrADS comes with ABSOLUTELY NO WARRANTY
See file COPYRIGHT for more information
Config: v2.2.1 little-endian readline grib2 netcdf hdf4-sds hdf5 opendap-grids geotiff shapefile
Issue 'q config' and 'q gxconfig' commands for more detailed configuration information
GX Package Initialization: Size = 11 8.5
Running in Batch mode
All files closed; all defined objects released;
All GrADS attributes have been reinitialized
GX Package Terminated