Information Technology
Running LinBUGS on Ada

10-Apr-2007


Introduction

BUGS (Bayesian inference Using Gibbs Sampling) is a piece of computer software for the Bayesian analysis of complex statistical models using Markov chain Monte Carlo (MCMC) methods. LinBUGS is the Linux version of OpenBUGS. This document will describe how to run a basic LinBUGS job on Ada using the PBS job scheduler.


Running LinBUGS with PBS

The steps for running LinBUGS with PBS on Ada are described below:

1. Prepare the Data Directory

Create a directory to store your input and output data files. In this example, the input and output files and the PBS script will all be stored in the same directory. This is not required but is presented this way here to simplify the instructions. Start by creating a working directory called bugs, for example:


adauser@adahost:~> cd /home/adauser # go to your home directory
adauser@adahost:~> mkdir bugs # create a work directory named bugs

Create a LinBUGS script file in this directory and call it bugs.script. Then create a LinBUGS model file called bugs.model, a file with the model's initial values called bugs.init, and a data file called bugs.data. The script file, bugs.script, might look something like the following:


modelCheck("./bugs.model")
modelData("./bugs.data")
modelCompile()
modelInits("./bugs.init")
modelGenInits()
modelUpdate(5000)
samplesSet(alpha)
samplesSet(beta)
samplesSet(sigma)
samplesSet(tau)
dicSet()
modelUpdate(10000)
samplesStats("*")
samplesCoda("*","./output")
modelQuit()


2. Initialize your Environment to run LinBUGS

In order to run LinBUGS, you need to initialize your environment using the module command as follows:


adauser@adahost:~> module load openbugs

This command will set the appropriate environment variables that you need to run LinBUGS.

3. Prepare and Run the PBS Job

Once the data files are in place, create a PBS batch job script called bugs.pbs in the same directory with the following contents:


#PBS -N BUGS #PBS -q compute #PBS -l nodes=1:ppn=1,walltime=04:00:00 #PBS -m abe #PBS -V ## this line is important
##to inherit the correct environment variables #PBS -M username@rice.edu
echo "My job ran on: "
cat $PBS_NODEFILE
cd $PBS_O_WORKDIR
linbugs < bugs.script > outputfile
               ##this will run LinBUGS with "bugs.script" as the input script,
               ##and an output file named "outputfile".

Now run the PBS job from this working directory as follows:


adauser@adahost:~> qsub ./bugs.pbs ## this will submit the job to the job scheduler

ClassicBUGS Interface

If you simply need to get to the ClassicBUGS command-line interface, run the following commands:


adauser@adahost:~> module load openbugs adauser@adahost:~> linbugs
OpenBUGS ClassicBUGS release 2.1.1
type 'modelQuit()' to quit
Bugs>

 


More Information

For information about LinBUGS, please see the OpenBUGS website.

 

IT
Division of Information Technology
MS-119, P.O. Box 1892, Rice University, Houston, Texas 77251-1892
713-348-HELP(4357)