Next revision | Previous revision |
software:java:farber [2018-08-10 16:27] – created anita | software:java:farber [2021-04-27 16:21] (current) – external edit 127.0.0.1 |
---|
====== Projects in Java ====== | ====== Projects in Java on Farber ====== |
| |
Below is a basic Java example and steps you can follow and apply to your ''filename.java''. Remember Unix is case sensitive so it is very important for the filename ''HelloWorld.java'' match the class name defined in the file as ''HelloWorld''. | Below is a basic Java example and steps you can follow and apply to your ''filename.java''. Remember Unix is case sensitive so it is very important for the filename ''HelloWorld.java'' match the class name defined in the file as ''HelloWorld''. |
Check the versions of java development available on your cluster by using | Check the versions of java development available on your cluster by using |
| |
<code> | <code bash> |
$ vpkg_versions openjdk | $ vpkg_versions openjdk |
</code> | </code> |
and make sure you select the appropriate version to compile and create the ''HelloWorld.class'' file. The following example is based on the user ''traine'' in workgroup ''it_css'' on Farber using commands to create a directory ''/home/work/it_css/traine/java'' to store all the files associated with this example, ''qlogin'' to a compute node, load openjdk verison 1.8.0 using VALET, compile and test ''HellowWorld'', and lastly exit the compute node and return to the head node. | and make sure you select the appropriate version to compile and create the ''HelloWorld.class'' file. The following example is based on the user ''traine'' in workgroup ''it_css'' on Farber using commands to create a directory ''/home/work/it_css/traine/java'' to store all the files associated with this example, ''qlogin'' to a compute node, load openjdk verison 1.8.0 using VALET, compile and test ''HellowWorld'', and lastly exit the compute node and return to the head node. |
| |
<code> | <code bash> |
[farber ~]$ workgroup -g it_css | [farber ~]$ workgroup -g it_css |
[(it_css:traine)@farber ~]$ cd /home/work/it_css/traine/java | [(it_css:traine)@farber ~]$ cd /home/work/it_css/traine/java |
</code> | </code> |
| |
Once we are back on the head node, you will need a job submission script to run your java job. For this simple example, copy ''serial.qs'' from ''/opt/templates/gridengine'' on Farber, name it ''submit.qs'', and modify it to run the ''HelloWorld'' executable. | Once we are back on the head node, you will need a job submission script to run your java job. For this simple example, copy ''serial.qs'' from ''/opt/shared/templates/gridengine'' on Farber, name it ''submit.qs'', and modify it to run the ''HelloWorld'' executable. |
| |
<file bash submit.qs> | <file bash submit.qs> |
Now submit the job using ''qsub submit.qs'' on the head node. The example below shows this process incuding commands to monitor the status of job and view results of the job run. | Now submit the job using ''qsub submit.qs'' on the head node. The example below shows this process incuding commands to monitor the status of job and view results of the job run. |
| |
<code> | <code bash> |
(it_css:traine)@farber java]$ qsub submit.qs | (it_css:traine)@farber java]$ qsub submit.qs |
Your job 1392329 ("submit.qs") has been submitted | Your job 1392329 ("submit.qs") has been submitted |
</code> | </code> |
| |
<note tip>Please review the templates for job submission scripts in ''/opt/templates/gridengine'' on Farber and Mills. If you do not specify any resources, by default you will get 1 core and 1GB of memory (a simple serial job) on Farber.</note> | <note tip>Please review the templates for job submission scripts in ''/opt/shared/templates/gridengine'' on Farber. If you do not specify any resources, by default you will get 1 core and 1GB of memory (a simple serial job) on Farber.</note> |
| |