Hprc banner tamu.png

Difference between revisions of "Ada:Compile:Intro"

From TAMU HPRC
Jump to: navigation, search
(Created page with "== Getting Started == For developing code on ada we recommend using the Intel Cluster Toolkit Compiler Edition (ictce). This toolkit includes the intel compilers (icc/icpc/if...")
 
(Toolchain selection)
 
(46 intermediate revisions by 5 users not shown)
Line 1: Line 1:
 
== Getting Started ==
 
== Getting Started ==
  
For developing code on ada we recommend using the Intel Cluster Toolkit Compiler Edition (ictce). This toolkit includes the intel compilers (icc/icpc/ifort), intel Math Kernel Library (MKL), and intel MPI stack. Use the following command to load the ictce module:
+
=== Toolchain selection ===
  
<pre>    module load icte</pre>
+
For developing code on Ada we recommend using the '''intel''' software stack (which is often referenced as a "toolchain" here at HPRC), which includes the Intel compilers (icc/icpc/ifort), the Intel Math Kernel Library (MKL), and the Intel MPI. '''A note for Ada Users:''' the Intel compilers are the only compilers able to compile programs for the Phi co-processors.
This will set up the environment for the most recent ictce version. For more information about the module system on ada, please visit [[help/modules.php|modules]] page.
 
  
After initializing the compiler environment, you can use the &quot;man&quot; command to obtain a complete list of the available compilation options for the language you plan to use. For example:
+
We highly recommend users select a particular toolchain and stick with modules that use it. At present, we support the following toolchains:
 +
* '''intel''' - described above
 +
* '''iomkl''' - which substitutes OpenMPI for Intel's MPI
 +
* '''foss''' - which is entirely Free and Open-Source Software (GCC/OpenMPI/BLAS/LAPACK/etc)
  
<pre>   man icc
+
<font color=teal>Detailed information about each of the currently supported toolchain releases can be found on our [[SW:Toolchains | Toolchains]] page.</font><br>
    man icpc
 
    man ifort</pre>
 
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. The default output file name is a.out but can be changed using compiler flags. See table below for valid extensions for each language.
+
Toolchains, like software packages on our clusters, are organized with the [[SW:Modules | Modules System]]. You can load a toolchain with the following command:
 +
[ netID@cluser ~]$ '''module load ''[toolchain Name]'''''
 +
<font color=teal>'''Important Note:''' Do '''NOT''' mix modules from different toolchains. Remember to '''ALWAYS''' purge all modules when switching toolchains.</font><br>
 +
More information on using the Modules System can be found on our [[SW:Modules | Modules System]] page.
  
 +
=== Using the intel toolchain ===
  
 +
After initializing the compiler environment, you can use the &quot;man&quot; command to obtain a complete list of the available compilation options for the language you plan to use. The following three commands will provide information on the C, C++, and Fortran compilers, respectively.
 +
[ netID@cluster ~]$ '''man icc'''
 +
[ netID@cluster ~]$ '''man icpc'''
 +
[ netID@cluster ~]$ '''man ifort'''
  
Extension
+
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.
  
Compiler
+
{| class="<!-- mw-collapsible mw-collapsed--> wikitable" style="text-align: center;"
 +
|+ Basic Valid File Extensions
 +
! 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.
 +
|}
  
Description
+
'''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.
  
.c
 
  
icc
+
[[Category:Ada]]
 
+
[[Category:Terra]]
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.
 
 
 
* [[scalar.php|Serial/Scalar Programs]]
 
* [[openmp.php|OpenMP Programs]]
 
* [[mpi.php|MPI Programs]]
 

Latest revision as of 09:56, 25 April 2018

Getting Started

Toolchain selection

For developing code on Ada we recommend using the intel software stack (which is often referenced as a "toolchain" here at HPRC), which includes the Intel compilers (icc/icpc/ifort), the Intel Math Kernel Library (MKL), and the Intel MPI. A note for Ada Users: the Intel compilers are the only compilers able to compile programs for the Phi co-processors.

We highly recommend users select a particular toolchain and stick with modules that use it. At present, we support the following toolchains:

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

Detailed information about each of the currently supported toolchain releases can be found on our Toolchains page.

Toolchains, like software packages on our clusters, are organized with the Modules System. You can load a toolchain with the following command:

[ netID@cluser ~]$ module load [toolchain Name]

Important Note: Do NOT mix modules from different toolchains. Remember to ALWAYS purge all modules when switching toolchains.
More information on using the Modules System can be found on our Modules System 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. The following three commands will provide information on the C, C++, and Fortran compilers, respectively.

[ netID@cluster ~]$ man icc
[ netID@cluster ~]$ man icpc
[ netID@cluster ~]$ man ifort

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.

Basic Valid File Extensions
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.