From Documentation
Revision as of 10:35, 6 June 2019 by Edward (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
This page is scheduled for deletion because it is either redundant with information available on the CC wiki, or the software is no longer supported.
OPENJDK
Description: OpenJDK runtime environment and development tools.
SHARCNET Package information: see OPENJDK software page in web portal
Full list of SHARCNET supported software


Introduction

o The OpenJDK runtime environment and development tools provide java.

Version Selection

On iqaluk and cluster developement nodes (ie saw and orca) the memory settings are open hence the java command will run without any special options being required such as:

[orc-login2:~] ssh -X orc-dev2

[orc130:~] java -version
java version "1.7.0_09-icedtea"
OpenJDK Runtime Environment (rhel-2.3.3.el6_3.1-x86_64)
OpenJDK 64-Bit Server VM (build 23.2-b09, mixed mode)

o Hound does not have development nodes. However since its login nodes (hnd19, hnd20) have 128GB physical memory they have been granted more permissive memory settings than other clusters. Hence java can be run directory on them as follows to specify initial heap size of 4Mbyte and max heap of 64Mbyte on

export JAVA_OPTS="-d64 -Xms256m -Xmx512m"

[hnd20:~] java ${JAVA_OPTS} -version
java version "1.7.0_09-icedtea"
OpenJDK Runtime Environment (rhel-2.3.3.el6_3.1-x86_64)
OpenJDK 64-Bit Server VM (build 23.2-b09, mixed mode)

where
[hnd20:~] java ${JAVA_OPTS} -X
    -Xms<size>        set initial Java heap size
    -Xmx<size>        set maximum Java heap size
    -Xss<size>        set java thread stack size

[hnd20:~] java ${JAVA_OPTS} -help
    -d32          use a 32-bit data model if available
    -d64          use a 64-bit data model if available

o To dump all the details of the java runtime environment use the Print option. For example to see how the heap is effected:

[hnd19:~] java -d64 -Xms64m -Xmx128m -XX:+PrintFlagsFinal >& dumph.out
[hnd19:~] cat dumph.out | grep HeapSize
    uintx ErgoHeapSizeLimit                         = 0               {product}           
    uintx HeapSizePerGCThread                       = 87241520        {product}           
    uintx InitialHeapSize                          := 67108864        {product}           
    uintx LargePageHeapSizeThreshold                = 134217728       {product}           
    uintx MaxHeapSize                              := 134217728       {product}           
[hnd19:~] java -d64 -Xms256m -Xmx512m -XX:+PrintFlagsFinal >& dumph.out
[hnd19:~] cat dumph.out | grep HeapSize
    uintx ErgoHeapSizeLimit                         = 0               {product}           
    uintx HeapSizePerGCThread                       = 87241520        {product}           
    uintx InitialHeapSize                          := 268435456       {product}           
    uintx LargePageHeapSizeThreshold                = 134217728       {product}           
    uintx MaxHeapSize                              := 536870912       {product}

o One can construct a script to embed heap settings, for instance assuming ~/bin is in your path do

[hnd19:~/bin] cat java 
export JAVA_OPTS="-d64 -Xms256m -Xmx512m"
/usr/bin/java ${JAVA_OPTS} $@

[hnd19:~] which java
~/bin/java

o Links to the binaries are found by default in your path. There current version may also be tracked down by running:

[orc-login2:/usr/bin] ls jav*
java  javac  javadoc  javah  javap

[iqaluk:~] /usr/bin/javac -version
javac 1.7.0_09

[iqaluk:~] readlink -f /usr/bin/java
/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.9.x86_64/jre/bin/java

[iqaluk:/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.9.x86_64/bin] ls java*
java  javac  javadoc  javah  javap  java-rmi.cgi

o On clusters running the latest OS version java version 1.6.0, 1.7.0 and 1.8.0 are also available and can be used by simply prepending the path. On Bash Shell or Csh Shell set your path using respectively:

export PATH=/usr/lib/jvm/java-1.6.0/bin:$PATH
                    -- or --
set path = (/usr/lib/jvm/java-1.6.0/bin $path)

Job Submission

o Submitting jobs to the queue on newly installed clusters such as orca:

[orc-login2:~] sqsub -r 1m --mpp 3G -o ofile.%J java -Xmx512m HelloWorld
submitted as jobid 54178
[orc-login2:~] cat ofile.54178.orc-admin2.orca.sharcnet
Hello, World

o To submit java jobs to the queue on older clusters mako, guppy and gulper:

[mako2:~] export PATH=/opt/sharcnet/jdk/current/bin:$PATH
[mako2:~] sqsub -r 1m --mpp 2G -o ofile.%J java -Xmx512m HelloWorld
submitted as jobid 5927873
[mako2:~] cat ofile.5927873.krasched
Hello, World

Example Job

A simple java program used in the above job submission section:

[orc-login2:~] cat HelloWorld.java
public class HelloWorld {
    public static void main(String[] args) {
        System.out.println("Hello, World");
    }
}

To run HelloWorld interactively, login to an orca development node:

[roberpj@orc-login2:~] ssh orc-dev2
[roberpj@orc130:~/samples/java] javac HelloWorld.java
[roberpj@orc130:~/samples/java] java -Xmx512m HelloWorld
Hello, World

General Notes

o For general and large memory interactive usage iqaluk is recommended:

[iqaluk:~] javac HelloWorld.java
[iqaluk:~] java HelloWorld
Hello, World

o On orca a developement node should be used for interactive usage:

[orc-login2:~] ssh orc-dev1
[orc129:~] javac HelloWorld.java
[roberpj@orc129:~] java HelloWorld
Hello, World

o Interactive use on older clusters mako, guppy, gulper and tope:

[mako2:~] /opt/sharcnet/jdk/current/bin/javac HelloWorld.java
[mako2:~] java HelloWorld
Hello, World

Object Heap Error

In the event your job crashes on startup and generates the message "Could not reserve enough space for object heap" or "Invalid maximum heap size" check there is no space between the Xmx and 512m for instance:

-Xmx512m

References

o OpenJDK Homepage http://openjdk.java.net/

o Oracle Java Homepage http://www.oracle.com/technetwork/java/index.html