UMBC logo
UMBC High Performance Computing Facility
Please note that this page is under construction. We are documenting the 240-node cluster maya that will be available after Summer 2014. Currently, the 84-node cluster tara still operates independently, until it becomes part of maya at the end of Summer 2014. Please see the 2013 Resources Pages under the Resources tab for tara information.
How to run Java on tara

Introduction

On this page we'll see how to use Java on the tara cluster. Before proceeding, make sure you've read the How To Run tutorial first. Java is a popular object-oriented programming language used in general-purpose computing.

Java on tara

Currently the system-default Java is the mosy up-to-date

[araim1@tara-fe1 java]$ which javac
/usr/bin/javac
[araim1@tara-fe1 java]$ javac -version
javac 1.6.0_26
[araim1@tara-fe1 java]$ 

Example batch script

We'll write a simple Java program that says "hello".
class HelloWorld
{  
    public static void main(String args[])
    {
        System.out.println("Hello World!");
    }
}

Download: ../code/java_hello/HelloWorld.java
We can compile and run on the user node to test
[araim1@tara-fe1 java_hello]$ javac HelloWorld.java 
[araim1@tara-fe1 java_hello]$ ls
HelloWorld.class  HelloWorld.java
[araim1@tara-fe1 java_hello]$ java HelloWorld
Hello World!
[araim1@tara-fe1 java_hello]$ 
We can launch it with a standard SLURM script.
#!/bin/bash
#SBATCH --job-name=hello_java
#SBATCH --output=slurm.out
#SBATCH --error=slurm.err
#SBATCH --partition=develop

java HelloWorld

Download: ../code/java_hello/run.slurm
Now we launch the job
[araim1@tara-fe1 java]$ sbatch run.slurm 
Submitted batch job 99868
[araim1@tara-fe1 java_hello]$ squeue
  JOBID PARTITION     NAME     USER ST       TIME  NODES QOS     NODELIST(REASON)
  99868   develop hello_ja   araim1  R       0:02      1 normal  n1
[araim1@tara-fe1 java_hello]$ cat slurm.out 
Hello World!
[araim1@tara-fe1 java_hello]$ cat slurm.err 
[araim1@tara-fe1 java_hello]$