Get Services >  High Performance Computing >  Application Software >  Compilers

Compiling/Running User-Written Programs

The following compilers, debuggers and performance tuning tools are available on HPC systems. Check their man pages or the subsequent sessions in this user guide for the usage and options.

Compilers

icc

Intel C/C++ Compiler

ifort

Intel Fortran Compiler

gcc, g++

GNU project C and C++ Compiler

g77, f77

GNU project Fortran Compiler

javac, java

Java Compiler and Java Interpreter

 

Debuggers

idb

Intel debugger

gdb

GNU debugger

jdb

Java debugger

 

Profilers

gprof

GNU profiler


How to compile and run  C/Fortran program

You can compile your C/C++/Fortran program on any Login nodes: atlas3-c01, atlas4-c01, atlas5-c01, atlas5-c49. The following are examples on how to compile and run your C/C++/ Fortran program.


C/C++ Code

icc  myprog.c
icc  myprog.cpp

 

 

Fortran Code

ifort  myprog.f
ifort  myprog.f90


If the above compilation is successful, it will generate the executable file "a.out". To run the executable, you can enter command:
./a.out
You can specify the output file name for the executable program by "-o" as:
icc  -o myprog.exe  myprog.c
 

How to run the program in LSF Batch queues

If your program needs long hours to complete, you are recommended to submit the job to a batch LSF queue. For example:

bsub -q linux64 -o out.o ./myprog.exe

If your program includes command line argument, you can submit the job as:

bsub -q linux64 -o out.o "./myprog.exe arg1 arg2"

Take note if you compile the codes on Atlas2/3/4, you shall submit the jobs to queue "linux64"; if you compile the codes on Cougars, you shall submit to queue "ia64".

Please refer to the "How to Run Batch Jobs" under "Getting Started" for more information on LSF.

For parallel programming with MPI or OpenMP, please check at Parallel Computing section.

Using Scientific Libraries

LAPACK (Linear Algebra PACKage)

LAPACK is written in Fortran77 and provides routines for solving systems of simultaneous linear equations, least-squares solutions of linear systems of equations, eigenvalue problems, and singular value problems. LAPACK routines are written so that as much as possible of the computation is performed by calls to the Basic Linear Algebra Subprograms (BLAS)

The Lapack home page is at http://www.netlib.org/lapack/index.html.

A user guide can be found at http://www.netlib.org/lapack/lug/index.html.

For information on available optimized BLAS libraries, as well as other BLAS-related questions, please refer to the BLAS FAQ: http://www.netlib.org/blas/faq.html.

To compile your code and link it to LAPACK libraries and BLAS libraries (on atlas3,atlas4 only),

g77 -o example1 example1.f -llapack -lblas


Intel MKL (Math Kernel Library)

This is a library of highly optimized, extensively threaded math routines for applications that require maximum performance. Core math functions include BLAS, LAPACK, ScaLAPACK1.

To compile your code and link to MKL libraries:

Dynamic

icc -o test test.c -lmkl_intel_lp64 -lmkl_solver_lp64 -lmkl_intel_thread -lmkl_core -liomp5

ifort -o test1 test1.f -lmkl_intel_lp64 -lmkl_solver_lp64 -lmkl_intel_thread -lmkl_core -liomp5

alternatively,

icc -o test test.c -mkl:parallel

ifort -o test1 test1.f -mkl:parallel

Static

icc -o test test.c -Wl,--start-group $MKLPATH/libmkl_intel_lp64.a $MKLPATH/libmkl_mkl_solver_lp64.a $MKLPATH/libmkl_intel_thread.a $MKLPATH/libmkl_core.a -Wl,--end-group -liomp5

ifort -o test1 test1.f -Wl,--start-group $MKLPATH/libmkl_intel_lp64.a $MKLPATH/libmkl_mkl_solver_lp64.a $MKLPATH/libmkl_intel_thread.a $MKLPATH/libmkl_core.a -Wl,--end-group -liomp5

 

Last Modified on 4th November 2011. Copyright - All Rights Reserved.

 

top