Using module commands, we can examine the system environment and decide on compiler options:
fyi. the following examples are based on system hpc.bibalex.org (184.108.40.206/login02.local) as of August 2011.
1.First, verify the environment against which you want to compile, along with available tools:
2. Do load the environment you prefer:
3. Now, you can invoke any of the known compilers, including mpicc (and also gcc, icc), mpiCC, mpif77; most users are interested to invoke something like the following:
The "-o" option provides an output file name; otherwise, your executable is saved as "a.out"; be careful to avoid overwriting your source code by putting it as parameter to -o.
If you want to see a full working example on how to compile and use the batch system, please check next section, "Sample Batch Jobs on SGE".
For more information in relation to compiling on the BA system itself, using Intel/IntelMPI compilers, please refer to the Intel Compilers Tutorial.
Here is an example job for demo purposes.
- Please familiarize yourself with at least one UNIX text editor (nano, vi, emacs); you need that to create the following files.
- This example is a minimal Hello World program written in MPI: