![]() |
||||||
|
|
|
Compiling and Linking Codes on Roadrunner
1.1 Available programming languages The Roadrunner cluster has compilers for the Fortran 77, Fortran 90/95, C, and C++ languages. Compiling serial codes (codes that do not use MPI) on the cluster is straightforward and similar to compiling codes on other UNIX-type platforms. Details about the compilers and compiling serial codes appear below. Compiling and linking MPI codes on the Roadrunner Linux cluster, however, is somewhat different from how MPI codes are compiled and linked on many UNIX-type platforms. On the cluster, MPI messages can be passed in more than one way, which accounts for the differences explained below. The compute nodes that make up the cluster are networked together in two distinct ways. One network uses the Myrinet protocol, which is a high-performance packet-communication and switching technology. The second network uses the more standard Fast Ethernet protocol. When your MPI code runs, messages are passed using either the Myrinet or Ethernet networks. How the messages are passed depends on how your MPI code is linked. You choose between Myrinet and Ethernet simply by linking to different libraries. You do not need to make changes to your source code. You can find details on how to link with specific libraries below. Which network protocol should you use? Most users will want to link against the Myrinet libraries because the Myrinet protocol offers a higher bandwidth and lower latency then Ethernet. In addition to having two distinct network protocols for passing messages, a number of compiler suites from different vendors or organizations are available, including those from GNU, the Portland Group (PGI), the Numerical Algorithms Group (NAG), and Absoft. Details on using each compiler appear below. IMPORTANT: Please note that whichever compiler suite you use and whether you link against the Myrinet or Ethernet libraries, no changes are necessary to your MPI source code. You use the same MPI function calls and programming constructs with either compiler suite and when linking with either library. References are made below to obtaining details from the "info" program. Enter "info info" if you are unfamiliar with the info program. Fortran77 compilers for the cluster are available from GNU, PGI, and Absoft. In addition, the NAG Fortran95 compiler will compile Fortran77 codes. Details about each compiler along with links to further documentation can be found in the table below.
2.2 Fortran90/95 Fortran90/95 compilers for the cluster are available from PGI, Absoft, and NAG. Details about each compiler along with links to further documentation can be found in the table below.
2.3 High Performance Fortran (HPF) A High Performance Fortran compiler is available from PGI. Details about the compiler along with links to further documentation can be found in the table below.
2.4 C C compilers for the cluster are available from GNU and PGI. Details about each compiler along with links to further documentation can be found in the table below.
2.5 C++ C++ compilers for the cluster are available from GNU and PGI. Details about each compiler along with links to further documentation can be found in the table below.
3.0 MPI Codes As noted above compiling and linking MPI codes on the Roadrunner Linux cluster is different from how MPI codes are compiled and linked on many UNIX-type platforms since MPI messages can be passed using either the Myrinet or Ethernet protocols. You choose how MPI messages are passed by linking with different libraries as explained in detail below. 3.1 Selecting an MPI Library You choose how MPI messages are passed and select an MPI library to link with by setting the MPIHOME environment variable. Each possible setting for MPIHOME selects both a message passing protocol (Myrinet or Ethernet) and a compiler suite (GNU, PGI, Absoft, or NAG). The possible settings for MPIHOME are shown in the table below. 3.1.1 Settings for MPIHOME
3.1.2 Setting MPIHOME in your dot files You may find it most convenient to set the environment variable MPIHOME in your .cshrc or .bash_profile file so that it is automatically set each time you connect to the Roadrunner cluster. The default dot file or files you received when your Roadrunner account was activated already contain a line that sets MPIHOME to the most popular choice from the table above. Also included are a number of lines with other possible choices which are commented out. To change MPIHOME in your dot file or files simply uncomment the appropriate line by removing the '#' from the beginning of the line or add another line. Below is an excerpt from the default .cshrc file showing the definition of MPIHOME.
3.1.3 Setting MPIHOME interactively You may wish to change the value for MPIHOME for a particular code without editing your dot files. To set the environment variable MPIHOME interactively enter
if you are using the tcsh shell or
if you are using the bash shell. In both cases <path> is one of the paths from the table above. NOTE: Setting MPIHOME interactively does not automatically change your path. You should take care to make sure that you are using the correct versions of compilers and scripts if you interactively change MPIHOME. 3.2 Compiling and linking with MPI Once you have set the environment variable MPIHOME you compile and link your code with the MPI libraries in one step using one of the commands shown in the table below.
The commands mpif77, mpif90, mpicc, and mpiCC are scripts that call the appropriate compiler and automatically include the necessary options to properly link with the MPI libraries based on the setting for MPIHOME. You do not need to explicitly include link options such as -lmpi to link with the MPI libraries. If your code requires other libraries, however, you must include the appropriate link options as arguments to the commands above. It is a good idea to use the 'which' command to verify your compiler and link library. For example:
The result indicates that janeuser is using the Myrinet libraries with the GNU compiler. 4.0 Standard libraries The standard libraries for each programming language such as the math libraries are available and accessible in the normal way. If you program using Fortran you need not compile or link with any special flags to link with the standard Fortran libraries. C programmers can link to the standard libraries in the normal way, for example using '-lm' to link with the math library. |
|
|