Quickstart guide for programming the Cray XT4

On this page, we give some examples of commonly used instructions to compile and execute a program on the Cray XT4.

Contents:

   A. Compiling programs for compute nodes
   B. Compiling OpenMP or threaded programs
   C. Compiling MPI programs
   D. Compiling programs for login nodes
   E. Running the program


A. COMPILING PROGRAMS FOR COMPUTE NODES

The following wrappers are installed on hexagon.

Fortran 90/95 programs   ftn
Fortran 77 programs      f77
C programs               cc
C++ programs             CC

Compiling the C program test.c can be done by the command:

cc -o test.out test.c

Where test.out is my selected name of the executable file.

To switch compiler from pgi (default) to i.e. gnu is done by:

module swap PrgEnv-pgi PrgEnv-gnu

This command sets the wrappers above to use the gnu compiler instead of the pgi compiler. So after you have changed module you compile as before with i.e. ftn, f77, cc or CC.

There is currently three Programming Environments installed:

PGI         PrgEnv-pgi
PathScale   PrgEnv-pathscale
GNU         PrgEnv-gnu
Intel       PrgEnv-intel

Single source file.

Compiling a single source file (example is a C program see here for other languages):

cc -o test.out test.c
This is similar to regular linux compilation.

Multiple source files.

Compiling a multiple source files (example is a C program):

cc -o test.out test.c test2.c
This is similar to regular linux compilation.

The make utility.

When your code consists of many source files, we recommend you to use the 'make' utility. With 'make', one can automate the maintenance, update, compilation, and regeneration of object and executable files. The make utility requires by default a file called 'Makefile' in which you specify your compiler options, source/object files, and rules for compilation. After you have created the Makefile, you can build your program with the command 'make'.

An example is given below:

# START OF "Makefile"
CC=cc

# OpenMP flag
LFLAG=-mp

debug:
        $(CC) -g -o hello.out hello.c $(LFLAG)
main:
        $(CC) -o hello.out hello.c $(LFLAG)
clean:
        rm -f *.o hello.out 
# END OF FILE

B. COMPILING OPENMP PROGRAMS

To activate openMP directives, compile and link with


Fortran:
-mp=nonuma     for the PGI compiler, and
-mp                for the Pathscale compiler
C and C++:
-mp                for the PGI compiler, and
-mp                for the Pathscale compiler

Compilers for the login nodes does not support OpenMP.

C. COMPILING MPI PROGRAMS

When using the compilers given in Compiling programs for compute nodes the compile takes care of MPI automatically.

Compilers for the login nodes does not support MPI.

D. Compiling programs for login nodes

When compiling for the login node the executable will not be able to run on the compute nodes, neither will OpenMP or MPI be supported. A complete list of the login node compilers can be found here.

E. RUNNING THE PROGRAM

All executable programs should run in the batch system. If you do not do this and the system administrator detects this, he may suspend or kill your jobs without prior warning. Submitting and running your jobs through the batch system is necessary to avoid system overload and it enforces a fair share of the resources among the users. To find out more about the batch system go here.

All executables and temporary input/output should be stored in directory /work/$USER. The I/O performance of the /work filesystem is much better than that of /home. Therefore, use /work for all large data that is temporary and data that can be generated easily. These include binaries, uncompressed data files, and especially intermediate files (that exist only at runtime). /home is not mounted on the compute nodes, a job started from /home will therefor fail.