Run Perl on the Cluster¶
- Perl is relatively straightforward to use. Simply load the module, then run using the
perlcommand in your
- In the
PBSscript load perl with
module load perl. You can use
module avail perlto see what versions of perl are available.
- In the computation part of your
PBSscript, enter the folder where you have the Perl script. If it is in the same directory you have/are submitting the
PBSscript from, you can use
- In the
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 -l nodes=1:ppn=2 #PBS -l pmem=2gb #PBS -l walltime=1:00 #PBS -q force-6 #PBS -j oe #PBS -o perlTest.out cd $PBS_O_WORKDIR module load perl perl hello_world.pl
#PBSdirectives are standard, requesting just 1 minute of walltime and 1 node with 2 cores. More on
#PBSdirectives can be found in the PBS guide
$PBS_O_WORKDIRis simply a variable that represents the directory you submit the PBS script from.
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.plruns the script
Part 2: Submit Job and Check Status¶
- Make sure you're in the dir that contains the
- Submit as normal, with
qsub <pbs script name>. In this case
- 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
PBSscript, you should see a
cat perlTest.outor open the file in a text editor to take a look.
perlTest.outshould look like this:
Job name: perl Queue: force-6 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.