SAPAC logo The South Australian Partnership for Advanced Computing spacer
Information about Information for Search SAPAC Contact SAPAC

Hydra - Compiling programs

The following compilers are provided on Hydra. They should all be accessible, with the default path provided once a choice has been made for the $COMPILER environment variable in your .cshrc.hydra file. If you are unsure about how do do this, refer to the Getting Started section of this User Guide.

  • GNU Compilers
    • gcc (also aliased to cc) for C and C++ programs.
    • g77 (also aliased to f77) for Fortran 77 programs.

  • Portland Group Compilers
    • pgcc for C and C++ programs.
    • pgf77 and pgf90 for Fortran 77 and Fortran 90 programs.
    • pghpf for High Performance Fortran programs.

  • Intel Compilers
    • icc and icpc for C and C++ programs.
    • ifc for Fortran programs.

NOTE: You may find that some programs will only compile, or will run faster, using certain compilers, so you may want to try them all.

Check the man pages and the Documentation section of this User Guide for details on usage and options for each compiler.

MPI Programs

MPI programs can be compiled using mpicc (for C programs), mpiCC (C++), mpif77 (Fortran 77) or mpif90 (Fortran 90). This uses the underlying Compiler Suite that has been set to the $COMPILER environment variable in your .cshrc.hydra file. This could be one of gnu|pgi|intel and will have also set the $MPICHDIR environment variable and the appropriate MPI include ($MPICHINCDIR) and library ($MPICHLIBDIR) directory environment variables.

NOTE: You will also need to set the $MPICH environment variable to either myrinet|ethernet in your .cshrc.hydra file to indicate which type of network communication you will be using.

Use the which command to check you are getting the right version of the MPI compilers. For example, when using the Intel compiler Suite:

which mpicc

should return

/opt/shared/mpich-gm/1.2.6..14a-intel/bin/mpicc

NOTE: You can also use the C and Fortran compilers directly and just link in the MPI libraries compiled with the Intel compiler, for example:

  icc -I$MPICHINCDIR -L$MPICHLIBDIR -o MyMpiProgram MyMpiProgram.c -lm -lmpich -lgm -lpthread

High Performance Fortran Programs

HPF programs can be compiled using the Portland Group High Performance Fortran compiler pghpf, so you should make sure that you have set COMPILER pgi in your .cshrc.hydra file.

When compiling to run a program over Myrinet you should:

  • use the -Mmpi flag
  • Set $MPICH myrinet in your .cshrc.hydra file so the compiler can use MPI over Myrinet for inter-processor communications
  • use the flags -lgm and -lpthread when linking.
  • use -L$MPICHLIBDIR to link to the Myrinet libraries.

For example:

pghpf -Mmpi -L$MPICHLIBDIR -o MyHPFProgram MyHPFProgram.f -lgm -lpthread

OpenMP Programs

OpenMP directives for shared memory parallel programming are supported by the Portland Group and Intel compilers, however these will only be able to run on a single node of Hydra (i.e. 2 processors).


General Tips and Information

  • All of the compilers will produce much faster code if you use compiler optimisation flags. Check the documentation or man pages of the compiler you are using to find the appropriate optimisation flags. Some compilers use increasing numbers, e.g. -O1, -O2, etc. Some compilers (e.g. PGI) provide provide a -fast compiler flag, which attempts to provide the best general optimisation settings. The PGI compiler also has a flag -fastsse that attempts to exploit the SSE instructions which allow the CPU to execute two instructions per cycle instead of just one, so it's worth testing that out also.

  • NOTE: You should NOT use these optimisation flags when developing and debugging programs. They should only be used once you have checked that the program works, and you want to make it run faster. This is because it may take substantially longer to compile the program at a higher optimisation level. Also, there is a greater chance of finding compiler problems or bugs at higher optimisation levels. The compiler may not be able to compile the program, or the output of the program may be incorrect. It is a good idea to check that the results of your programs compiled with a high optimisation level are the same as those with the default optimisation. If you detect an error when using a high optimisation level, try compiling that routine or program again at a lower optimisation level.

  • NOTE: Programs should only be compiled on the front end (the head node) of the cluster.

     

    Hydra User's Guide

SAPAC SITE MAP