From Documentation
Revision as of 15:56, 16 March 2015 by Preney (Talk | contribs) (Optimization)

Jump to: navigation, search
INTEL
Description: the default compiler on all sharcnet systems
SHARCNET Package information: see INTEL software page in web portal
Full list of SHARCNET supported software


Introduction

The intel compiler module is loaded by default on all sharcnet systems. The intel compiler consists of 5 core components:

o icc -  C Compiler<br>
o icpc - C++ Compiler<br>
o mkl -  Math Kernel Library<br>
o tbb -  Threading Building Blocks<br>
o ipp -  Intel Performance Primitives<br>

Version Selection

Sharcnet provides the following versions of what is now known as the Intel® Parallel Studio XE Composer Edition for Linux.

Version 2015 Update 1

This is the latest available intel compiler on sharcnet. At this time it is provided primarily for use on the sharcnet phi goblin node and/or experimenting with new features and separately available component versions. It will be upgraded and replaced when Update 2 is released hence update is not recommended for regular usage nor is there a compatible openmpi module provided for it yet on sharcnet.

module load intel/15.0.1

or equivalently ...

module load intel/ipp/15.0.1 intel/tbb/15.0.1 intel/mkl/15.0.1 intel/icc/15.0.1 intel/ifc/15.0.1

where the individual components (flavors) may also be loaded and used individually. Compatibility with earlier intel compilers for each component is described in the release notes. The icc flavor provides the Intel C++ Compiler, while the ifc provides Intel Fortran Compiler. The release version of each component maybe found by running the module help command such as module help intel/tbb/15.0.1

Version 2013 SP1 Update 4

module load intel/14.0.4
module load mkl/11.1.4

Version 2011 Update 9

This is the default compiler on all sharcnets Centos6 production clusters.

module load intel/12.1.3
module load mkl/10.3.9

Version 11.1 Update 5

module load intel/11.1.069

Version 11.0 Update 84

This is the default compiler on sharcnets remaining two Centos5 clusters.

module load intel/11.0.083

Job Submission

sqsub -r 1h -o ofile.%J ./a.out

Example Usage

To demonstrate howto compile a simple program with the intel compiler and submit a job, consider the intel example whereby two matrices are multiplied using the mkl dgemm routine. The ifort linker line is determined by consulting https://software.intel.com/en-us/articles/intel-mkl-link-line-advisor/ which uses MKLROOT set automatically by the sharcnet intel/15.0.1 module:

cp /opt/sharcnet/intel/15.0.1/composerxe/Samples/en_US/mkl/tutorials.zip .
unzip tutorials.zip .
cd tutorials/mkl_mmx_f   [optionally go into mkl_mmx_c to run the c variant]
module unload intel mkl openmpi
module load intel/15.0.1  [or module load intel/ifc/15.0.1 intel/mkl/15.0.1]
ifort dgemm_example.f -L$MKLROOT/lib/intel64 -lmkl_intel_lp64 -lmkl_core -lmkl_sequential -lpthread -lm
sqsub -r 1h -ofile.%J ./a.out

o Note that as of version 2015 the intel examples are found in the same directory :

[saw-login1: /opt/sharcnet/intel/15.0.1/composerxe/Samples/en_US] ls
C++  Fortran  mkl

o While in earlier versions the intel examples reside in 3 different directories such as :

[saw-login1: /opt/sharcnet/intel/14.0.4/icc/composerxe/Samples/en_US] ls
C++
[saw-login1: /opt/sharcnet/intel/14.0.4/ifc/composerxe/Samples/en_US] ls
Fortran
[saw-login1: /opt/sharcnet/mkl/11.1.4/composerxe/Samples/en_US] ls
mkl

General Notes

Optimization

When running codes compiled with the intel compiler on non-intel compute nodes one should be aware of Intels Optimization Notice https://software.intel.com/en-us/articles/optimization-notice. The main implications of this warning in the sharcnet context are that a program compiled with the default Intel compiler and default Intel compiler options may run much slower on opteron (non-intel) compute nodes. The ideal solution involves profiling the code to track down and fix inefficient blocks of code and experiment using modified compiler options such as -ipo, -O3 or -xHost tested to ensure support on the intended target hardware, both in advance of running any production jobs. Other factors that can affect code speed are clock rate and memory bandwidth. Further reading on Interprocedural Optimization (IPO) can be found in the Key Features documentation reference for the Intel C++ Compiler here https://software.intel.com/en-us/compiler_15.0_ug_c and the Intel Fortran Compiler here https://software.intel.com/en-us/compiler_15.0_ug_f.

An example use of the Intel v15 compiler with these optimizations specified is:

module unload intel mkl
module load intel/15.0.1
icpc -O3 -ipo myprog.cpp

Profiling

Intel provides instrumentation options for profiling codes (comparable to gprof/gprof2dot) documented in articles Profile-Guided Optimization (PGO) located in the Key Features documentation section of the Intel C++ Compiler found here https://software.intel.com/en-us/compiler_15.0_ug_c and the Intel Fortran Compiler found here https://software.intel.com/en-us/compiler_15.0_ug_f. The Intel Data Viewer Utility tool is located at /opt/sharcnet/intel/15.0.1/composer_xe_2015.1.133/bin/intel64/loopprofileviewer.sh

Invoking C++11

The sharcnet intel/15.0.1 module supports C++11 by compiling as follows :

module unload intel mkl
module load intel/15.0.1
icpc -std=c++11 myprog.cpp

where a description of C++11 Features Supported by Intel® C++ Compiler is provided in the Intel document located here https://software.intel.com/en-us/articles/c0x-features-supported-by-intel-c-compiler.

Intel Debuggers

Note that as of Intel 15 the idb debugger has been replaced by GNU gdb-ia and GNU gdb-mic as discussed in https://software.intel.com/en-us/articles/debugging-intel-xeon-phi-applications-on-linux-host.

gdb

source /opt/sharcnet/intel/15.0.1/composer_xe_2015.1.133/pkg_bin/debuggervars.sh
gdb-ia  or  gdb-mic

idb

For compiler versions prior to Intel 15 the gui based idb command may not launch properly on some systems due to java version resource limit incompatibilities. In such situations either use the command line variant idbc or switch to a sharcnet cluster development node or the sharcnet vdi-centos6 machine. For example on an orca development node one would do:

 ssh -Y orca.sharcnet.ca
 ssh -Y orc-devel2
 idb

Invoking Compilers

icc and icpc

As described in Innvoking the Intel® C++ Compiler found here https://software.intel.com/en-us/node/522355 for Linux OS:

You can invoke the Intel® C++ Compiler for Linux OS on the command line by using either icc to compile C source files r icpc to compile C++ source files.

When you invoke the compiler with icc, the compiler builds C source files using C libraries and C include files. If you use icc with a C++ source file, it is compiled as a C++ file. Use icc to link C object files.

When you invoke the compiler with icpc the compiler builds C++ source files using C++ libraries and C++ include files. If you use icpc with a C source file, it is compiled as a C++ file. Use icpc to link C++ object files.

The icc or icpc command does the following:

Compiles and links the input source file(s).
Produces one executable file, a.out, in the current directory.

The extensions for C/C++ defined in Understanding File Extensions here https://software.intel.com/en-us/node/522359.

For C source files use: file.c
For C++ source files use: file.C, file.CC, file.cc, file.cpp or file.cxx

ifort

As described in Innvoking the Intel® Fortran Compiler https://software.intel.com/en-us/node/522357 for Linux OS:

You can invoke the Intel® Fortran Compiler on the command line using the ifort command. The syntax of the ifort command is:

ifort [options]input_file(s)

The ifort command can compile and link projects in one step or compile them then link them as a separate step.

In most cases, a single ifort command will invoke both the compiler and linker. You can also use ld (Linux* OS and OS X*) to build libraries of object modules. These commands provide syntax instructions at the command line if you request it with the help option.

The ifort command automatically references the appropriate Intel® Fortran Run-Time Libraries when it invokes the linker. To link one or more object files created by the Intel® Fortran compiler, you should use the ifort command instead of the link command.

The ifort command invokes a driver program that is the user interface to the compiler and linker. It accepts a list of command options and file names and directs processing for each file. The driver program does the following:

Calls the Intel® Fortran Compiler to process Fortran files.
Passes the linker options to the linker.
Passes object files created by the compiler to the linker.
Passes libraries to the linker.
Calls the linker or librarian to create the executable or library file.

Release Note Changes

o An error message about -lguide not found in Intel 11 occur since libgruide.a and libguide.so is deprecated in the newer releases of the intel compiler suite, replaced by libiomp and liboimp5 in release 12. To remedy this -lguide should be replaced with -liomp5.

References

o Intel User and Reference Guide for the Intel® C++ Compiler 15.0
https://software.intel.com/en-us/compiler_15.0_ug_c

o User and Reference Guide for the Intel® Fortran Compiler 15.0
https://software.intel.com/en-us/compiler_15.0_ug_f

o Intel Developer Zone Support
https://software.intel.com/en-us/support

o Intel Developer Forums for Asking Questions
https://software.intel.com/en-us/forum see:

https://software.intel.com/en-us/forums/opencl
https://software.intel.com/en-us/forums/intel-c-compiler
https://software.intel.com/en-us/forums/intel-inspector-xe
https://software.intel.com/en-us/forums/intel-math-kernel-library
https://software.intel.com/en-us/forums/intel-many-integrated-core
https://software.intel.com/en-us/forums/intel-threading-building-blocks
https://software.intel.com/en-us/forums/intel-integrated-performance-primitives
https://software.intel.com/en-us/forums/intel-fortran-compiler-for-linux-and-mac-os-x

o C++11 Features Supported by Intel® C++ Compiler
https://software.intel.com/en-us/articles/c0x-features-supported-by-intel-c-compiler

o Intel Parallel Studio XE (Sharcnet has Composer Edition)
https://software.intel.com/en-us/intel-parallel-studio-xe

o Getting Started with the Intel C++ Compiler
https://www.sharcnet.ca/Software/Intel/ICC/

o Getting Started with the Intel Fortran Compiler
https://www.sharcnet.ca/Software/Intel/IFC/

o Intel Guide for Developing Multithreaded Applications - Parts 1 & 2
https://www.sharcnet.ca/Software/Intel/docs/100407_Parallel_Programming_01.pdf
https://www.sharcnet.ca/Software/Intel/docs/100412_Parallel_Programming_02.pdf

o Intel Parallel Debugger Extensions for Intel Composer XE (version 12 only)
http://software.intel.com/en-us/articles/parallel-debugger-extension/

o Intel Compiler Version Number Mapping
http://software.intel.com/en-us/articles/intel-compiler-and-composer-update-version-numbers-to-compiler-version-number-mapping