Quick Start for Edison Users
Quick Start for Edison Users
You should be able to compile codes the same way you do on Edison when you have the same programming environment loaded. Same as Edison, the default programming environment on Cori is PrgEnv-intel. Cray and GNU compilers are also available on Cori.
This is a quick start guide to migrate from Edison to use Cori Haswell nodes. To compile for Cori KNL nodes, please refer to more information in the Compiling Code on Cori page.
For all the compilers, Cray provides a convenient set of wrapper commands that should be used in almost all cases for compiling and linking parallel programs instead of the vendor specific compiler names. Invoking the wrappers will automatically link codes with MPI libraries and other Cray system software. All MPI and Cray system include directories are also transparently imported. In addition the wrappers append the compiler's target processor arguments for the Cori compute node processors.
NOTE: The intention is that programs be compiled on the login nodes and executed on the compute nodes. Because the compute nodes and login nodes have different operating systems, binaries created for compute nodes may not run on the login node. The wrappers mentioned above guarantee that codes compiled using the wrappers will run on the compute nodes.
For Fortran source code use ftn
% ftn -fast -o example.x example.f90
For C source code use cc
% cc -fast -o example.x example.c
For C++ source code use CC
% CC -fast -o example.x example.C
All compilers on Cori -- Intel, Cray and GNU -- are provided via three programming environments that are accessed via the module utility. Each programming environment contains the full set of compatible compilers and libraries. To change from one compiler to the other you change the programming environment via the 'module swap' command, e.g., module swap PrgEnv-intel PrgEnv-cray.
The Intel Math Kernel Library (MKL) is available on Cori for the Intel compiler, providing routines and functions that perform a wide variety of operations on vectors and matrices including sparse matrices. The library also includes fast Fourier transform (FFT) functions, vector mathematical and vector statistical functions with Fortran and C interfaces, and ScaLAPACK.
By default, the Intel compiler uses the Cray libsci math library. To use MKL on Cori you must unload the cray-libsci module:
% module unload cray-libsci
and then link your code in either of the following two ways:
% ftn -o mycode.exe *.o -mkl
% ftn -o mycode.exe *.o -mkl=cluster
Note that the -mkl option NEEDS TO APPEAR AT THE END OF THE LINE, i.e., ftn -mkl *.o will not work. Also, for Intel compilers
ftn -o mycode.x *.o -L/path/to/libs -llib works, whereas
ftn -o mycode.x -L/path/to/libs -llib *.o does not.
For more details see the Intel compiler man pages for ifort, icc, and icpc.