From Documentation
Jump to: navigation, search
 
(84 intermediate revisions by 3 users not shown)
Line 1: Line 1:
 +
{{Template:CCDelete}}
 
{{Software
 
{{Software
|package_name=JDK
+
|package_name=OPENJDK
|package_description=The Java SE Development Kit
+
|package_description=OpenJDK runtime environment and development tools.
 
|package_idnumber=66
 
|package_idnumber=66
 
}}
 
}}
  
<u>PATH INITIALIZATION</U><BR>
+
=Introduction=
  
The binaries for this package are not included in your default path. Therefore its necessary to add the path manually using one of the following commands depending on your shell:
+
o The OpenJDK runtime environment and development tools provide java.
  
<b>Bash Shell Users: </b> export PATH=/opt/sharcnet/jdk/current/bin:$PATH
+
=Version Selection=
  
<b>Csh Users: </b> set path = (/opt/sharcnet/jdk/current/bin $path)
+
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:
  
 +
<pre>
 +
[orc-login2:~] ssh -X orc-dev2
  
<u>PROVIDED BINARIES</u>
+
[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)
 +
</pre>
  
  [roberpj@bul125:/opt/sharcnet/jdk/current/bin] ls jav*
+
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
  java javac  javadoc  javah  javap  javaws
+
  
 +
<pre>
 +
export JAVA_OPTS="-d64 -Xms256m -Xmx512m"
  
<u>MEMORY ALLOCATION ON ORCA LOGIN NODE</u>
+
[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)
  
Java will crash immediately when run interactively on orcas login nodes unless a command line argument with format XmxNNNN (where NNNN specifies the requested memory allocation pool) is specified.  The value should be chosen less then the 1GB hard memory limit of the login node. For instance 512mb would be acceptable:
+
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
  
  [roberpj@orc-login1:~] java -Xmx512m -version
+
[hnd20:~] java ${JAVA_OPTS} -help
  java version "1.6.0_13"
+
    -d32          use a 32-bit data model if available
  Java(TM) SE Runtime Environment (build 1.6.0_13-b03)
+
    -d64          use a 64-bit data model if available
Java HotSpot(TM) 64-Bit Server VM (build 11.3-b02, mixed mode)
+
</pre>
 +
 
 +
o To dump all the details of the java runtime environment use the Print option. For example to see how the heap is effected:
 +
 
 +
<pre>
 +
[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}
 +
</pre>
 +
 
 +
o One can construct a script to embed heap settings, for instance assuming ~/bin is in your path do
 +
 
 +
<pre>
 +
[hnd19:~/bin] cat java
 +
export JAVA_OPTS="-d64 -Xms256m -Xmx512m"
 +
/usr/bin/java ${JAVA_OPTS} $@
 +
 
 +
[hnd19:~] which java
 +
~/bin/java
 +
</pre>
 +
 
 +
o Links to the binaries are found by default in your path.  There current version may also be tracked down by running:
 +
 
 +
<pre>
 +
[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
 +
</pre>
 +
 
 +
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:
 +
 
 +
<pre>
 +
export PATH=/usr/lib/jvm/java-1.6.0/bin:$PATH
 +
                    -- or --
 +
set path = (/usr/lib/jvm/java-1.6.0/bin $path)
 +
</pre>
 +
 
 +
=Job Submission=
 +
 
 +
o Submitting jobs to the queue on newly installed clusters such as orca:
 +
 
 +
<pre>
 +
[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
 +
</pre>
 +
 
 +
o To submit java jobs to the queue on older clusters mako, guppy and gulper:
 +
 
 +
<pre>
 +
[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
 +
</pre>
 +
 
 +
=Example Job=
 +
 
 +
A simple java program used in the above job submission section:
 +
 
 +
<pre>
 +
[orc-login2:~] cat HelloWorld.java
 +
public class HelloWorld {
 +
    public static void main(String[] args) {
 +
        System.out.println("Hello, World");
 +
    }
 +
}
 +
</pre>
 +
 
 +
To run HelloWorld interactively, login to an orca development node:
 +
 
 +
<pre>
 +
[roberpj@orc-login2:~] ssh orc-dev2
 +
[roberpj@orc130:~/samples/java] javac HelloWorld.java
 +
[roberpj@orc130:~/samples/java] java -Xmx512m HelloWorld
 +
Hello, World
 +
</pre>
 +
 
 +
=General Notes=
 +
 
 +
o For general and large memory interactive usage iqaluk is recommended:
 +
 
 +
<pre>
 +
[iqaluk:~] javac HelloWorld.java
 +
[iqaluk:~] java HelloWorld
 +
Hello, World
 +
</pre>
 +
 
 +
o On orca a developement node should be used for interactive usage:
 +
 
 +
<pre>
 +
[orc-login2:~] ssh orc-dev1
 +
[orc129:~] javac HelloWorld.java
 +
[roberpj@orc129:~] java HelloWorld
 +
Hello, World
 +
</pre>
 +
 
 +
o Interactive use on older clusters mako, guppy, gulper and tope:
 +
 
 +
<pre>
 +
[mako2:~] /opt/sharcnet/jdk/current/bin/javac HelloWorld.java
 +
[mako2:~] java HelloWorld
 +
Hello, World
 +
</pre>
 +
 
 +
==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:
 +
 
 +
<pre>
 +
-Xmx512m
 +
</pre>
 +
 
 +
=References=
 +
 
 +
o OpenJDK Homepage
 +
http://openjdk.java.net/
 +
 
 +
o Oracle Java Homepage
 +
http://www.oracle.com/technetwork/java/index.html

Latest revision as of 09:35, 6 June 2019

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