Java Programs
On the Maestro cluster, you have to load module graalvm to run Java.
Code Block (bash)
module load graalvm
the installed java programs are wrapped to be directly callable without java call, e.g. there is no need to do
Code Block (text)
java -jar /some/path/cooljavaprogram.jar options arguments ...
but just
Code Block (text)
cooljavaprogram options arguments ...
Suppose your job gets killed with OOM (out-of-memory) errors. In that case, you should allocate more memory is your srun/sbatch and, importantly pass specific java options/arguments for the program's execution. To find out what they are you can ask our module subsystem.
Code Block (bash)
maestro-submit:~ > module show sprime
-------------------------------------------------------------------
/opt/gensoft/modules/sprime/07Dec18.5e2:
module-whatis {Set environnement for sprime (07Dec18.5e2)}
prepend-path PATH /opt/gensoft/exe/sprime/07Dec18.5e2/bin
prepend-path PATH /opt/gensoft/exe/sprime/07Dec18.5e2/scripts
setenv SPRIME_JAVA_OPTS -Xmx8G
-------------------------------------------------------------------
You will notice the environment variable SPRIME_JAVA_OPTS set to 8GB by the module file, and you can change it to 16GB as follows:
Code Block (bash)
maestro-submit:sprime/07Dec18.5e2 > export SPRIME_JAVA_OPTS=-Xmx16g
maestro-submit:sprime/07Dec18.5e2 > sprime gt=../../datas/sprime/three.segments.vcf.gz outgroup=../../datas/sprime/outgroup.ids map=../../datas/sprime/three.segments.map out=out.sprime | grep Command
Command line: java -Xmx16384m -jar sprime.jar
Java users may have noticed that it also allows them to pass some useful Java variables to the program such as -verbose, -Xloggc:filename.log to log execution to file, -XX:ErrorFile=filename.err to log errors to file, and so on...
Here is an example script showing how to use this mechanism with sbatch:
Code Block (bash)
#!/bin/sh
#SBATCH --output=test_sprime.out
#SBATCH --error=test_sprime.error
#SBATCH --mem=16G
module load graalvm sprime
export SPRIME_JAVA_OPTS=-Xmx16g
sprime gt=/opt/gensoft/tests/datas/sprime/three.segments.vcf.gz outgroup=/opt/gensoft/tests/datas/sprime/outgroup.ids map=/opt/gensoft/tests/datas/sprime/three.segments.map out=out.sprime
When the script has finished running, you should see the 2 files in the directory in which you run it with sbatch:
- test_sprime.error
- test_sprime.out
Code Block (bash)
$ cat test_sprime.out
sprime.jar(version: 07Dec18.5e2)
Copyright (C) 2017 Brian L. Browning
Enter "java -jar sprime.jar" to print a list ofcommand line arguments
Start time: 11:22 AM CEST on 09 Jun 2022
Command line: java -Xmx15837m -jar sprime.jar
gt=/opt/gensoft/tests/datas/sprime/three.segments.vcf.gz
outgroup=/opt/gensoft/tests/datas/sprime/outgroup.ids
map=/opt/gensoft/tests/datas/sprime/three.segments.map
out=out.sprime
Number of outgroup samples: 100
Number of target samples: 1000
Variant analyzed: 4080
Segments detected: 3
Run time: 4 seconds
End time: 11:22 AM CEST on 09 Jun 2022
sprime.jar finished
We have verified that it worked!