Updated 2021-05-17

Run Perl on the Cluster

Overview

  • Perl is relatively straightforward to use. Simply load the module, then run using the perl command in your PBS script

Tips

  • In the PBS script load perl with module load perl. You can use module avail perl to see what versions of perl are available.
  • In the computation part of your PBS script, enter the folder where you have the Perl script. If it is in the same directory you have/are submitting the PBS script from, you can use cd $PBS_O_WORKDIR.
  • In the PBS script, use perl <perlfilename.pl> to run the script.

Walkthrough: Run Perl on the Cluster

  • This walkthrough will use a simple Perl script that prints "Hello World"
  • Perl script (hello_world.pl) can be found here
  • PBS script (perl.pbs) can be found here
  • You can transfer the files to your account on the cluster to follow along. The file transfer guide may be helpful.

Part 1: The PBS Script

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

cd $PBS_O_WORKDIR
module load perl
perl hello_world.pl
  • The #PBS directives are standard, requesting just 1 minute 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 perl script you want to run (in this case, hello_world.pl) is in the same directory you put the PBS script.

  • perl hello_world.pl runs the script

Part 2: Submit Job and Check Status

  • Make sure you're in the dir that contains the PBS Script
  • Submit as normal, with qsub <pbs script name>. In this case qsub perl.pbs
  • Check job status with qstat -t 22182721, replacing the number with the job id returned after running qsub
  • You can delete the job with qdel 22182721 , again 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 perlTest.out file. Use cat perlTest.out or open the file in a text editor to take a look.
  • perlTest.out should look like this:
Job name:   perl
Queue:      inferno
End PBS Prologue Fri Sep  7 09:11:13 EDT 2018
---------------------------------------
Hello world
---------------------------------------
Begin PBS Epilogue Fri Sep  7 09:11:14 EDT 2018
Job ID:     22279150.shared-sched.pace.gatech.edu

  • After the result files are produced, you can move the files off the cluster, refer to the file transfer guide for help.
  • Congratulations! You successfully ran a Perl script on the cluster.