Hprc banner tamu.png

Ada:Compile:Intro

From TAMU HPRC
Revision as of 15:45, 20 September 2016 by J-perdue (talk | contribs) (Getting Started)
Jump to: navigation, search

Getting Started

Toolchain selection

For developing code on ada we recommend using the Intel software stack, which includes the Intel compilers (icc/icpc/ifort), the Intel Math Kernel Library (MKL), and the Intel MPI. Additionally, the Intel compilers are the only compilers able to compile programs for the Phi co-processors. To load the Intel software stack, enter:

    module load intel

This will set up the environment for the most recent intel tool chain version. For more information about the module system on ada, please visit the modules page.

Using the intel toolchain

After initializing the compiler environment, you can use the "man" command to obtain a complete list of the available compilation options for the language you plan to use. For example:

   
    man icc
    man icpc
    man ifort

will provide information on the C, the C++ and the Fortran compilers, respectively.

Each compiler requires appropriate file name extensions. These extensions are meant to identify files with different programming language contents, thereby enabling the compiler script to hand these files to the appropriate compiling subsystem: preprocessor, compiler, linker, etc. See table below for valid extensions for each language.

Extension Compiler Description
.c icc C source code passed to the compiler.
.C, .CC, .cc, .cpp, .cxx icpc C++ source code passed to the compiler.
.f, .for, .ftn ifort fixed form Fortran source code passd to the compiler.
.fpp ifort Fortran fixed form source code that can be preprocessed by the Intel Fortran preprocessor fpp.
.f90 ifort free form Fortran 90/95 source code passed to the compiler.
.F ifort Fortran fixed form source code, will be passed to preprocessor (fpp) and then passed to the Fortran compiler.
.o icc/icpc/ifort compiled object file--generated with the -c option--passed to the linker.


NOTE: The icpc command ("C++" compiler) uses the same compiler options as the icc ("C" compiler) command. Invoking the compiler using icpc compiles '.c', and '.i' files as C++. Invoking the compiler using icc compiles '.c' and '.i' files as C. Using icpc always links in C++ libraries. Using icc only links in C++ libraries if C++ source is provided on the command line.