Run Scala on the Cluster¶
- This guide will focus on running Scala in batch mode. Additionally, Scala includes an interactive interpreter (like python).
- If you wish to use Scala in interactive mode, follow these steps to set up a VNC session. In your VNC session, open a terminal, load Scala (
module load scala) and run with the command
- In the
PBSscript, load scala with
module load scala.
you can use
module avail scala to see what versions of scala are available.
- The line to run a scala file is
scala <filename>.scala. Add this to the computation part of your
PBSscript to run.
Walkthrough: Run Scala on the Cluster¶
- This walkthrough will use a simple Scala program that prints "Hello World"
- Scala Program: Hello.scala
- PBS Script: scala.pbs
- 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 helloWorldScala #PBS -l nodes=1:ppn=2 #PBS -l pmem=2gb #PBS -l walltime=1:00 #PBS -q force-6 #PBS -j oe #PBS -o helloWorldScala.out cd $PBS_O_WORKDIR module load scala scala Hello.scala
#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 scala script you want to run (in this case, Hello.scala) is in the same directory you put the PBS script.
module load scalaloads scala. To see what scala versions are available, run
module avail scala, and load the one you want
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 -u <gtusername3> -n, replacing "gtusername3" with your gt username.
- 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
PBSscript, you should see a
helloWorldScala.outfile, which contains the results of the job. Use
cat helloWorldScala.outor open the file in a text editor to take a look.
helloWorldScala.outshould look something like this:
Job name: helloWorldScala Queue: force-6 End PBS Prologue Wed Oct 3 14:11:57 EDT 2018 --------------------------------------- Hello World! --------------------------------------- Begin PBS Epilogue Wed Oct 3 14:12:25 EDT 2018 Job ID: 22604573.shared-sched.pace.gatech.edu User ID: shollister7 Job name: helloWorldScala Resources: neednodes=1:ppn=2,nodes=1:ppn=2,pmem=2gb,walltime=00:01:00 Rsrc Used: cput=00:00:19,energy_used=0,mem=159992kb,vmem=9238056kb,walltime=00:00:29
- 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 Scala program on the cluster.