Updated 2021-05-17

Run GAMS on the Cluster

Overview

  • This guide will cover how to load and run gams/23.8.1
  • Before loading GAMS, you must first load matlab
  • After loading the modules for matlab and GAMS in your PBS script, you must add to the PBS script the necessary commands to execute GAMS

Summary

  • To load GAMS:
    • module load matlab
    • module load gams/23.8.1
  • To run GAMS:
    • gams <input filename .gms>

Walkthrough: Run GAMS on the Cluster

  • This walkthrough will solve a linear programming problem, maximizing profit with constraints of land and crops
  • The problem and example input file is from the GAMS Quick Start Tutorial
  • Input file: example.gms
  • PBS script: gams.pbs
  • To follow along, manually copy these files into the same directory in your account on the cluster, or transfer them to your account.

Part 1: The PBS Script

#PBS -N gamsTest
#PBS -A [Account] 
#PBS -l nodes=1:ppn=2
#PBS -l pmem=2gb
#PBS -l walltime=2:00
#PBS -q inferno
#PBS -j oe
#PBS -o gams.out

cd $PBS_O_WORKDIR
module load matlab
module load gams/23.8.1
gams example.gms
  • The #PBS directives are standard, requesting just 2 minutes of walltime and 1 node with 2 cores. More on #PBS directives can be found in the PBS guide
  • $PBS_O_WORKDIR is simply a variable that represents the directory you submit the PBS script from.

Warning

Make sure the .gms file you want to run is in the same directory you put the PBS script.

  • Output Files, such as the resulting .lst file, will also show up in the same directory as the PBS script.
  • module load lines load GAMS as well as the default version of Matlab
  • gams example.gms runs GAMS

Part 2: Submit Job and Check Status

  • Make sure you're in the directory that contains the PBS script and the .gms file
  • Submit as normal, with qsub <pbs script name>. In this case qsub gams.pbs
  • Check job status with qstat -u username3 -n, replacing "username3" with your gtusername
  • You can delete the job with qdel 22182721, replacing the number with the jobid returned after running qsub

Part 3: Collecting Results

  • In the directory where you submitted the PBS script, you should see a couple of newly generated files, including example.lst and gams.out
  • example.lst is the output file that GAMS produces. In addition to the .lst file, output of the job will also be put into gams.out.
  • Take a look at gams.out using any text editor, such as vim with vim gams.out
  • It should include the solution to the linear programming problem:
Reading data...
Starting Cplex...
Tried aggregator 1 time.
LP Presolve eliminated 1 rows and 1 columns.
Reduced LP has 2 rows, 3 columns, and 6 nonzeros.
Presolve time =    0.00 sec.

Iteration      Dual Objective            In Variable           Out Variable
     1  I            0.000000                 Xwheat            labor slack
     2            9950.000000                  Xcorn             land slack
LP status(1): optimal

Optimal solution found.
Objective :        9950.000000

*** Could not write to console: /dev/tty
*** Logging to standard output
--- Restarting execution
--- example.gms(12) 2 Mb
--- Reading solution for model farmproblem
*** Status: Normal completion
--- Job example.gms Stop 11/16/18 10:42:31 elapsed 0:00:00.087
---------------------------------------
Begin PBS Epilogue Fri Nov 16 10:42:31 EST 2018
Job ID:     22911618.shared-sched.pace.gatech.edu
User ID:    shollister7
Job name:   gamsTest
Resources:  neednodes=1:ppn=2,nodes=1:ppn=2,pmem=2gb,walltime=00:02:00
Rsrc Used:  cput=00:00:00,energy_used=0,mem=0kb,vmem=0kb,walltime=00:00:01
Queue:      inferno
  • A more comphrehensive report will be found in example.lst
  • After the result files are produced, you can move the .lst file as well as any other files off the cluster. Refer to the file transfer guide for help.
  • Congratulations! You successfully ran GAMS on the cluster.