This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision Next revision | Previous revision | ||
|
guide:compiling [2014/02/10 17:59] ischeepers [MPI] |
guide:compiling [2021/12/09 16:42] (current) |
||
|---|---|---|---|
| Line 1: | Line 1: | ||
| ======Compiling====== | ======Compiling====== | ||
| =====Compilers===== | =====Compilers===== | ||
| - | The following is a list of C, C++ and Fortran compilers available on the SUN cluster | + | The following is a list of C, C++ and Fortran compilers available on the CHPC cluster: |
| ====Intel==== | ====Intel==== | ||
| * '' | * '' | ||
| * '' | * '' | ||
| - | ====GNU==== | + | ====GNU |
| * '' | * '' | ||
| * '' | * '' | ||
| * '' | * '' | ||
| - | |||
| - | < | ||
| - | * '' | ||
| - | * '' | ||
| - | * '' | ||
| =====Environment===== | =====Environment===== | ||
| Line 23: | Line 18: | ||
| * Remove a module from the environment < | * Remove a module from the environment < | ||
| - | To execute multiple module commands from a file (eg. a shell script), create a shell script, e.g.: | ||
| - | < | ||
| - | module load dell/ | ||
| - | module load dell/ | ||
| - | |||
| - | module list</ | ||
| - | |||
| - | This script has to be loaded via the " | ||
| =====Compiling===== | =====Compiling===== | ||
| ====Example Code==== | ====Example Code==== | ||
| Line 86: | Line 73: | ||
| ===Fortran=== | ===Fortran=== | ||
| < | < | ||
| - | ====Sun Studio==== | ||
| - | The following code snippets demonstrate how to compile the above code examples use the Sun Studio compiler suite: | ||
| - | ===C=== | ||
| - | < | ||
| - | ===Fortran=== | ||
| - | < | ||
| =====OpenMP===== | =====OpenMP===== | ||
| Line 105: | Line 86: | ||
| < | < | ||
| + | ===Java=== | ||
| + | |||
| + | An example of compiling and executing a simple Java program: | ||
| + | ====MyFirstJavaProgram.java==== | ||
| + | < | ||
| + | public class MyFirstJavaProgram { | ||
| + | public static void main(String []args) { | ||
| + | System.out.println(" | ||
| + | } | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | To compile this, make sure you have the java module loaded, then: | ||
| + | < | ||
| + | javac MyFirstJavaProgram.java</ | ||
| + | |||
| + | A bytecode-compiled file should be created, named MyFirstJavaProgram.class | ||
| + | |||
| + | To execute it, run as follows: | ||
| + | < | ||
| + | java MyFirstJavaProgram | ||
| + | </ | ||
| =====MPI===== | =====MPI===== | ||
| MPI (Message Passing Interface -- [[http:// | MPI (Message Passing Interface -- [[http:// | ||
| To run an MPI job see the man pages for PBS Pro. On the login node, type "man qsub". To obtain an interactive node, | To run an MPI job see the man pages for PBS Pro. On the login node, type "man qsub". To obtain an interactive node, | ||
| - | use "qsub -I" | + | use '' |
| + | |||
| + | '' | ||
| + | |||
| + | To test it: | ||
| + | |||
| + | < | ||
| + | |||
| + | You should see something similar to: | ||
| + | < | ||
| + | Hello world! I'm 7 of 8 on cnode-2-6 | ||
| + | Hello world! I'm 6 of 8 on cnode-2-6 | ||
| + | Hello world! I'm 5 of 8 on cnode-2-6 | ||
| + | Hello world! I'm 1 of 8 on cnode-2-6 | ||
| + | Hello world! I'm 0 of 8 on cnode-2-6 | ||
| + | Hello world! I'm 3 of 8 on cnode-2-6 | ||
| + | Hello world! I'm 2 of 8 on cnode-2-6 | ||
| + | Hello world! I'm 4 of 8 on cnode-2-6 | ||
| + | </ | ||