'UNSW - Science

UNSW - Science - HPC

Stata

If you wish to use Stata on one of the computational clusters then you will need to load the version of Stata that you wish to use via module command. Then to run your Stata script you need the following line in your PBS script at the end after crafting the rest of it using the information on the HPC web site.

stata -b do StataClusterWorkshop.do

If you wish to load or install additional Stata modules or commands you should use findit command on your local computer to find the command that you are looking for. Then create a directory called myadofiles in your cluster home directory and copy the .ado (and possibly the .hlp) file into that directory. Now that the command is there it just remains to tell Stata to look in that directory which can be done by using the following Stata command.

sysdir set PERSONAL /home/myadofiles.

An example of a Stata PBS Script is given below.

Stata PBS Examples

Whilst you are working on making sure that your Stata code works, the module command is being loaded correctly and you are referring to the right location for files you may want to use the following line to request a short term interactive terminal.

qsub -I -l nodes=1:ppn=1,vmem=8gb,walltime=1:00:00

The following Katana PBS script requests 1 CPU core with a maximum of 4Gb of memory for a job that runs for up to 12 hours. This job script assumes that you have added the module command to your .bashrc so that Stata is automatically loaded each time that a new terminal is opened.

#!/bin/bash
 
#PBS -N MyStataJob
#PBS -l nodes=1:ppn=1,vmem=4gb
#PBS -l walltime=12:00:00 
#PBS -j oe
 
cd $PBS_O_WORKDIR 
 
stata -b do StataClusterWorkshop.do 

The following PBS script requests 1 CPU core with a maximum of 8Gb of memory for a job that runs for up to 9 hours and will email you when the script is finished. It will also load Stata 12 after unloading any modules that are automatically loaded in a new terminal.

#!/bin/bash
 
#PBS -N MyStataJob
#PBS -l nodes=1:ppn=1,vmem=8gb
#PBS -l walltime=9:00:00 
#PBS -j oe
#PBS -M fred.bloggs@unsw.edu.au
#PBS -m ae
 
module purge
module add stata/12
 
cd $PBS_O_WORKDIR 
 
stata -b do StataClusterWorkshop.do