Difference between revisions of "HowTo:Compilers"
(→An Example) |
|||
Line 81: | Line 81: | ||
{| style="border-spacing: 8px;" | {| style="border-spacing: 8px;" | ||
| valign="top" width="50%" style="padding:1em; border:1px solid #aaaaaa; background-color:#e1eaf1; border-radius:7px" | | | valign="top" width="50%" style="padding:1em; border:1px solid #aaaaaa; background-color:#e1eaf1; border-radius:7px" | | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
== More Information == | == More Information == |
Revision as of 16:59, 14 June 2016
Contents
Compilers at the Centre for Advanced Computing
This is an introduction to the Fortran, C, and C++ compilers used on our clusters and servers. It is meant to give the user a basic idea about the usage of the compilers and about code optimization options.
Available CompilersWe are currently supporting two Compiler Suites on the Linux platform:
Setup
|
Compiling and Linking
Compiling and linking is best done with a makefile. Here are a few common flags. Consult man pages for specific details (for instance "man gcc"). Compilingcompiler -c [options] name.ext where "compiler" stands for the compiler name, for instance "gfortran" for the GNU Fortran compiler. The file extension "ext" determines what source code is being compiled, for instance "f" means "fixed format" Fortran, f90 means "free format" Fortran (90), or "c" stands for C. "[options]" denotes additional compiler flags that usually start with a '-'. Linkingcompiler -o name [options] [libraries] list "compiler" see above. "name" is the name of the executable (if not specified, the default is "a.out". [options] see above. [libraries] is a list of libraries that need to be linked in, usually as a list of file names with full path, or as '-L' and '-l' combinations [see below]. "list" means a list of object files, usually with ".o" extension. Using the compilers and the linker in the above manner requires the proper setting of the PATH environment variable, i.e. prior set-up. Options / flagsThere are hundreds of compiler flags, and many of them are not required most of the time. A few that are in more frequent use are:
There are many more flags. They are documented in the man pages (e.g. "man ifort" for the Intel Fortran compiler), as well in the documentation for the compiler. Some compiler flags are only useful for parallel programs and will be discussed later. |
More InformationAs already pointed out, this FAQ is not an introduction to MPI programming. The standard reference text on MPI is: Marc Snir, Steve Otto, Steven Huss-Lederman, David Walker, and Jack Dongarra: This text specifies all MPI routines and concepts, and includes a large number of examples. Most people will find it sufficient for all their needs. A quite good online tutorial for MPI programming can be found at the Maui HPCC site. There is also an official MPI webpage which contains the standards documents for MPI and gives access to the MPI Forum. We are conducting Workshops on a regular basis, some devoted to MPI programming. They are announced on our web site. We might see you there sometime soon. Some ToolsStandard debugging and profiling tools such as Sun Studio are designed for serial or multi-threaded programs. They do not handle multi-process runs very well. Quite often, the best way to check the performance of an MPI program is timing it by insertion of suitable routines. MPI supplies a "wall-clock" routine called MPI_WTIME(), that lets you determine how much actual time was spent in a specific segment of your code. An other method is calling the subroutines ETIME and DTIME, which can give you information about the actual CPU time used. However, it is advisable to carefully read the documentation before using them with MPI programs. In this case, refer to the Sun Studio 12: Fortran Library Reference. We also provide a package called the HPCVL Working Template (HWT), which was created by Gang Liu. The HWT provides 3 main functionalities:
The HWT is based on libraries and script files. It is easy to use and portable (written largely in Fortran). Fortran, C, C++, and any mixture thereof are supported, as well as MPI and OpenMP for parallelism. Documentation of the HWT is available. The package is installed on our clusters in /opt/hwt. HelpSend email to cac.help@queensu.ca. We have scientific programmers on staff who will probably be able to help you out. Of course, we can't do the coding for you but we do our best to get your code ready for parallel machines and clusters. |