Hprc banner tamu.png

Difference between revisions of "Ada:Compile:Intro"

From TAMU HPRC
Jump to: navigation, search
(Toolchain selection)
(Toolchain selection)
Line 28: Line 28:
 
Each of those has their own distinct combination of compiler/MPI/math.  The newer ones will have more appeal to those using newer C++ codes.  The older ones are probably more of interest to those with legacy code.
 
Each of those has their own distinct combination of compiler/MPI/math.  The newer ones will have more appeal to those using newer C++ codes.  The older ones are probably more of interest to those with legacy code.
  
 +
After you decide upon a toolchain, you can do something like:
 +
<pre>
 +
module load intel/2016a
 +
# or
 +
ml intel/2016a # ml == module load in this case
 +
</pre>
 +
followed by:
 +
<pre>
 +
module list
 +
# or
 +
ml # ml == module list in this case
 +
</pre>
 +
to see what components are in the toolchain.
  
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 [[Ada:Computing_Environment#Modules|modules]] page.
+
'''DO NOT MIX MODULES FROM DIFFERENT TOOLCHAINS'''... it only causes grief.
 +
 
 +
For more information about the module system on ada, please visit the [[Ada:Computing_Environment#Modules|modules]] page.
  
 
=== Using the intel toolchain ===
 
=== Using the intel toolchain ===

Revision as of 15:06, 20 September 2016

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 latest (and possibly untested) Intel software stack, enter:

    module load intel

However we highly recommend users select a particular toolchain and stick with modules that use it.

At present, we support the following toolchains:

  1. intel - described above
  2. iomkl - which substitutes OpenMPI for Intel's MPI
  3. foss - which is entirely Free and Open-Source Software (GCC/OpenMPI/BLAS/LAPACK/etc)

At present, we support the following toolchain releases:

  1. intel/2015B - This has evolved over the lifetime of Ada and has the most libraries presently available. Given its evolution it isn't the crispest in terms of versioning but is well tested.
  2. intel/2016a -This is the current development environment for new projects. It isn't as rich in terms of libraries but is better versioned.
  3. intel/2016b - This will likely play a role in the future but isn't being supported yet.
  4. iomkl/2015B - Primarily created for R but has other uses.
  5. iomkl/2016a - Similar to 2015B
  6. foss/2015B - Supported to some extent.
  7. foss/2016a - For testing future
  8. foss/2016b - Available, but not supported yet

Each of those has their own distinct combination of compiler/MPI/math. The newer ones will have more appeal to those using newer C++ codes. The older ones are probably more of interest to those with legacy code.

After you decide upon a toolchain, you can do something like:

module load intel/2016a
# or
ml intel/2016a # ml == module load in this case

followed by:

module list
# or
ml # ml == module list in this case

to see what components are in the toolchain.

DO NOT MIX MODULES FROM DIFFERENT TOOLCHAINS... it only causes grief.

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.