Using module commands, we can examine the system environment and decide on compiler options:
fyi. the following examples are based on the Euclid system euclid.cyi.ac.cy as of November 2012.
1. First, verify the environment against which you want to compile, along with available tools:
2. 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.
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:
Sample Bash Script
Command to submit a job on euclid
View the output of the Hello MPI World program
You may also try alternatively the interactive way, more useful for debugging purposes:
NOTE: Please remember to type "exit" as soon as possible with interactive jobs, since they consume resources.