User Tools

Site Tools


guide:compiling

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
guide:compiling [2015/08/20 15:23]
ischeepers [GNU]
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 and the M9000:+The following is a list of C, C++ and Fortran compilers available on the CHPC cluster:
 ====Intel==== ====Intel====
   * ''icc'' (for C and C++)   * ''icc'' (for C and C++)
Line 9: Line 9:
   * ''g++''   * ''g++''
   * ''gfortran''   * ''gfortran''
- 
-<del>Sun Studio</del> 
-  * ''cc'' 
-  * ''CC'' 
-  * ''f90''/''f95'' 
  
 =====Environment===== =====Environment=====
Line 23: Line 18:
   * Remove a module from the environment <code>module remove <module></code> or <code>module rm <module></code>   * Remove a module from the environment <code>module remove <module></code> or <code>module rm <module></code>
  
-To execute multiple module commands from a file (eg. a shell script), create a shell script, e.g.: 
-<code>#!/bin/bash -l 
- 
-module load dell/moab_7.1.3_batch 
-module load dell/torque/4.2.2_batch 
  
-module list</code> 
- 
-This script has to be loaded via the "source" command:  <code>source module_loader.sh</code>  
 =====Compiling===== =====Compiling=====
 ====Example Code==== ====Example Code====
Line 86: Line 73:
 ===Fortran=== ===Fortran===
 <code>gfortran -o hello hello.f90</code> <code>gfortran -o hello hello.f90</code>
-====Sun Studio==== 
-The following code snippets demonstrate how to compile the above code examples use the Sun Studio compiler suite: 
-===C=== 
-<code>cc -fast -o hello hello.c</code> 
-===Fortran=== 
-<code>f90 -fast -o hello hello.f90</code> 
  
 =====OpenMP===== =====OpenMP=====
Line 105: Line 86:
 <code>ifort -openmp omp_hello.f -o hello</code> <code>ifort -openmp omp_hello.f -o hello</code>
  
 +===Java===
 +
 +An example of compiling and executing a simple Java program:
 +====MyFirstJavaProgram.java====
 +<code> 
 +public class MyFirstJavaProgram {
 +  public static void main(String []args) {
 +    System.out.println("Hello World"); // prints Hello World
 +  }
 +}
 +</code>
 +
 +To compile this, make sure you have the java module loaded, then:
 +<code>
 +javac MyFirstJavaProgram.java</code>
 +
 +A bytecode-compiled file should be created, named MyFirstJavaProgram.class
 +
 +To execute it, run as follows:
 +<code>
 +java MyFirstJavaProgram
 +</code>
 =====MPI===== =====MPI=====
 MPI (Message Passing Interface -- [[http://www.open-mpi.org]]) is provided using the OpenMPI libraries.  To compile MPI code use the ''mpicc'' or ''mpif90'' compilers. MPI (Message Passing Interface -- [[http://www.open-mpi.org]]) is provided using the OpenMPI libraries.  To compile MPI code use the ''mpicc'' or ''mpif90'' compilers.
/app/dokuwiki/data/attic/guide/compiling.1440076981.txt.gz · Last modified: 2021/12/09 16:42 (external edit)