MVAPICH2-X 2.0 User Guide
Network-Based Computing Laboratory
Department of Computer Science and Engineering
The Ohio State University
Copyright (c) 2001-2013
Network-Based Computing Laboratory,
headed by Dr. D. K. Panda.
All rights reserved.
Last revised: October 3, 2013
Message Passing Interface (MPI) has been the most popular programming model for developing parallel scientific applications. Partitioned Global Address Space (PGAS) programming models are an attractive alternative for designing applications with irregular communication patterns. They improve programmability by providing a shared memory abstraction while exposing locality control required for performance. It is widely believed that hybrid programming model (MPI+X, where X is a PGAS model) is optimal for many scientific computing problems, especially for exascale computing.
MVAPICH2-X provides a unified high-performance runtime that supports both MPI and PGAS programming models on InfiniBand clusters. It enables developers to port parts of large MPI applications that are suited for PGAS programming model. This minimizes the development overheads that have been a huge deterrent in porting MPI applications to use PGAS models. The unified runtime also delivers superior performance compared to using separate MPI and PGAS libraries by optimizing use of network and memory resources.
MVAPICH2-X supports Unified Parallel C (UPC) and OpenSHMEM as PGAS models. It can be used to run pure MPI, MPI+OpenMP, pure PGAS (UPC/OpenSHMEM) as well as hybrid MPI(+OpenMP) + PGAS applications. MVAPICH2-X derives from the popular MVAPICH2 library and inherits many of its features for performance and scalability of MPI communication. It takes advantage of the RDMA features offered by the InfiniBand interconnect to support UPC/OpenSHMEM data transfer and OpenSHMEM atomic operations. It also provides a high-performance shared memory channel for multi-core InfiniBand clusters.
The MPI implementation of MVAPICH2-X is based on MVAPICH2, which supports all MPI-3 features. The UPC implementation is UPC Language Specification v1.2 standard compliant and is based on Berkeley UPC v2.16.0. OpenSHMEM implementation is OpenSHMEM v1.0 standard compliant and is based on OpenSHMEM Reference Implementation v1.0d. The current release supports InfiniBand transport interface (inter-node), and Shared Memory Interface (intra-node). The overall architecture of MVAPICH2-X is shown in the Figure 1.
This document contains necessary information for users to download, install, test, use, tune and troubleshoot MVAPICH2-X 2.0a. We continuously fix bugs and update this document as per user feedback. Therefore, we strongly encourage you to refer to our web page for updates.
MVAPICH2-X supports pure MPI programs, MPI+OpenMP programs, UPC programs, OpenSHMEM programs, as well as hybrid MPI(+OpenMP) + PGAS(UPC/OpenSHMEM) programs. Current version of MVAPICH2 2.0a supports UPC and OpenSHMEM as the PGAS model. High-level features of MVAPICH2-X 2.0a are listed below.
Unified Parallel C (UPC) Features
Hybrid Program Features
Unified Runtime Features
The MVAPICH2-X package can be downloaded from here. Select the link for your distro. All MVAPICH2-X RPMs are relocatable. As as initial technology preview, we are providing RHEL6 and RHEL5 RPMs. We provide RPMs compatible with either OFED-1.5.4 and Mellanox OFED (based on OFED 1.5.3), or OFED 3.5 and the stock RHEL distro InfiniBand packages.
Below are the steps to download and install MVAPICH2-X RPMs for RHEL6:
Running the install.sh script will install the software in /opt/mvapich2-x. The /opt/mvapich2-x/gnu directory contains the software built using gcc distributed with RHEL6. The /opt/mvapich2-x/intel directory contains the software built using Intel 13 compilers. The install.sh script runs the following command:
rpm -Uvh *.rpm --force --nodeps
This will upgrade any prior versions of MVAPICH2-X that may be present as well as ignore any dependency issues that may be present with the Intel RPMs (some dependencies are available after sourcing the env scripts provided by the intel compiler).
These RPMs are relocatable and advanced users may skip the install.sh script to directly use alternate commands to install the desired rpms.
Please email us at firstname.lastname@example.org if your distro does not appear on the list or if you experience any trouble installing the package on your system.
MVAPICH2-X supports MPI applications, PGAS (OpenSHMEM or UPC) applications and hybrid (MPI+
OpenSHMEM or MPI+UPC) applications. User should choose the corresponding compilers
according to the applications. These compilers (oshcc, upcc and mpicc) can be found under
Please use mpicc for compiling MPI and MPI+OpenMP applications. Below are examples to build MPI applications using mpicc:
$ mpicc -o test test.c
This command compiles test.c program into binary execution file test by mpicc.
$ mpicc -fopenmp -o hybrid mpi_openmp_hybrid.c
This command compiles a MPI+OpenMP program mpi_openmp_hybrid.c into binary execution file hybrid by mpicc, when MVAPICH2-X is built with GCC compiler. For Intel compilers, use -openmp instead of -fopenmp; For PGI compilers, use -mp instead of -fopenmp.
Below is an example to build an MPI, a OpenSHMEM or a hybrid application using oshcc:
$ oshcc -o test test.c
This command compiles test.c program into binary execution file test by oshcc.
For MPI+OpenMP hybrid programs, add compile flags -fopenmp, -openmp or -mp according to different compilers, as mentioned in mpicc usage examples.
Below is an example to build a UPC or a hybrid MPI+UPC application using upcc:
$ upcc -o test test.c
This command compiles test.c program into binary execution file test by upcc.
Note: The UPC compiler generates the following warning if MPI symbols are found in source
upcc: warning: ’MPI_*’ symbols seen at link time: should you be using
’--uses-mpi’ This warning message can be safely ignored.
This section provides instructions on how to run applications with MVAPICH2. Please note that on new multi-core architectures, process-to-core placement has an impact on performance. MVAPICH2-X inherits its process-to-core binding capabilities from MVAPICH2. Please refer to (MVAPICH2 User Guide) for process mapping options on multi-core nodes.
The MVAPICH team suggests users using this mode of job start-up. mpirun_rsh provides fast and scalable job start-up. It scales to multi-thousand node clusters. It can be use to launch MPI, OpenSHMEM, UPC and hybrid applications.
Jobs can be launched using mpirun_rsh by specifying the target nodes as part of the command as shown below:
$ mpirun_rsh -np 4 n0 n0 n1 n1 ./test
This command launches test on nodes n0 and n1, two processes per node. By default ssh is used.
$ mpirun_rsh -rsh -np 4 n0 n0 n1 n1 ./test
This command launches test on nodes n0 and n1, two processes per each node using rsh instead of ssh. The target nodes can also be specified using a hostfile.
$ mpirun_rsh -np 4 -hostfile hosts ./test
The list of target nodes must be provided in the file hosts one per line. MPI or OpenSHMEM ranks are assigned in order of the hosts listed in the hosts file or in the order they are passed to mpirun_rsh. i.e., if the nodes are listed as n0 n1 n0 n1, then n0 will have two processes, rank 0 and rank 2; whereas n1 will have rank 1 and 3. This rank distribution is known as “cyclic”. If the nodes are listed as n0 n0 n1 n1, then n0 will have ranks 0 and 1; whereas n1 will have ranks 2 and 3. This rank distribution is known as “block”.
The mpirun_rsh hostfile format allows users to specify a multiplier to reduce redundancy. It also allows users to specify the HCA to be used for communication. The multiplier allows you to save typing by allowing you to specify blocked distribution of MPI ranks using one line per hostname. The HCA specification allows you to force an MPI rank to use a particular HCA. The optional components are delimited by a ‘:’. Comments and empty lines are also allowed. Comments start with ‘#’ and continue to the next newline. Below are few examples of hostfile formats:
Many parameters of the MPI library can be configured at run-time using environmental variables. In order to pass any environment variable to the application, simply put the variable names and values just before the executable name, like in the following example:
$ mpirun_rsh -np 4 -hostfile hosts ENV1=value ENV2=value ./test
Note that the environmental variables should be put immediately before the executable. Alternatively, you may also place environmental variables in your shell environment (e.g. .bashrc). These will be automatically picked up when the application starts executing.
MVAPICH2-X provides oshrun and can be used to launch applications as shown below.
$ oshrun -np 2 ./test
This command launches two processes of test on the localhost. A list of target nodes where the processes should be launched can be provided in a hostfile and can be used as shown below. The oshrun hostfile can be in one of the two formats outlined for mpirun_rsh earlier in this document.
$ oshrun -f hosts -np 2 ./test
MVAPICH2-X provides upcrun to launch UPC and MPI+UPC applications. To use upcrun, we suggest users to set the following environment:
$ export MPIRUN_CMD=’<path-to-MVAPICH2-X-install>/bin/mpirun_rsh -np %N -hostfile hosts %P %A’
A list of target nodes where the processes should be launched can be provided in the hostfile named as “hosts”. The hostfile “hosts” should follow the same format for mpirun_rsh, as described in Section 4.2.1. Then upcrun can be used to launch applications as shown below.
$ upcrun -n 2 ./test
MVAPICH2-X also distributes the Hydra process manager along with with mpirun_rsh. Hydra can be used either by using mpiexec or mpiexec.hydra. The following is an example of running a program using it:
$ mpiexec -f hosts -n 2 ./test
This process manager has many features. Please refer to the following web page for more details.
MVAPICH2-X supports hybrid programming models. Applications can be written using both MPI and PGAS constructs. Rather than using a separate runtime for each of the programming models, MVAPICH2-X supports hybrid programming using a unified runtime and thus provides better resource utilization and superior performance.
A simple example of Hybrid MPI+OpenSHMEM program is shown below. It uses both MPI and OpenSHMEM constructs to print the sum of ranks of each processes.
start_pes in line 10 initializes the runtime for MPI and OpenSHMEM communication. An explicit call to MPI_Init is not required. The program uses MPI calls MPI_Comm_rank and MPI_Comm_size to get process rank and size, respectively (lines 14-15). MVAPICH2-X assigns same rank for MPI and PGAS model. Thus, alternatively the OpenSHMEM constructs _my_pe and _num_pes can also be used to get rank and size, respectively. In line 17, every process does a barrier using OpenSHMEM construct shmem_barrier_all.
After this, every process does a fetch-and-add of the rank to the variable sum in process 0. The sample program uses OpenSHMEM construct shmem_int_fadd (line 21) for this. Following the fetch-and-add, every process does a barrier using MPI_Barrier (line 24). Process 0 then broadcasts sum to all processes using MPI_Bcast (line 27). Finally, all processes print the variable sum. Explicit MPI_Finalize is not required.
The program outputs the following for a four-process run:
The above sample hybrid program is available at <MVAPICH2-X_INSTALL>/<gnu|intel>/share
A simple example of Hybrid MPI+UPC program is shown below. Similarly to the previous example, it uses both MPI and UPC constructs to print the sum of ranks of each UPC thread.
An explicit call to MPI_Init is not required. The program uses MPI calls MPI_Comm_rank and MPI_Comm_size to get process rank and size, respectively (lines 11-12). MVAPICH2-X assigns same rank for MPI and PGAS model. Thus, MYTHREAD and THREADS contains the UPC thread rank and UPC thread size respectively, which is equal to the return value of MPI_Comm_rank and MPI_Comm_size. In line 15, every UPC thread does a barrier using UPC construct upc_barrier.
After this, every UPC thread set its MPI rank to one element of a global shared memory array A and this element A[MYTHREAD] has affinity with the UPC thread who set the value of it (line 18). Then a local pointer need to be set to the global shared array element for MPI collective functions. Then every UPC thread does a barrier using MPI_Barrier (line 22). After the barrier, MPI_Allreduce is called (line 25) to sum up all the rank values and return the results to every UPC thread, in sum variable. Finally, all processes print the variable sum. Explicit MPI_Finalize is not required.
The program can be compiled using upcc:
The program outputs the following for a four-process run:
The above sample hybrid program is available at <MVAPICH2-X_INSTALL>/<gnu|intel>/share
We have extended the OSU Micro Benchmark (OMB) suite with tests to measure performance of OpenSHMEM operations. OSU Micro Benchmarks (OMB-4.1) have OpenSHMEM data movement and atomic operation benchmarks. The complete benchmark suite is available along with MVAPICH2-X binary package, in the folder: <MVAPICH2-X_INSTALL>/libexec/osu-micro-benchmarks. A brief description for each of the newly added benchmarks is provided below.
Put Latency (osu_oshm_put):
This benchmark measures latency of a shmem_putmem operation for different data sizes. The user is required to select whether the communication buffers should be allocated in global memory or heap memory, through a parameter. The test requires exactly two PEs. PE 0 issues shmem_putmem to write data at PE 1 and then calls shmem_quiet. This is repeated for a fixed number of iterations, depending on the data size. The average latency per iteration is reported. A few warm-up iterations are run without timing to ignore any start-up overheads. Both PEs call shmem_barrier_all after the test for each message size.
Get Latency (osu_oshm_get):
This benchmark is similar to the one above except that PE 0 does a shmem_getmem operation to read data from PE 1 in each iteration. The average latency per iteration is reported.
Put Operation Rate (osu_oshm_put_mr):
This benchmark measures the aggregate uni-directional operation rate of OpenSHMEM Put between pairs of PEs, for different data sizes. The user should select for communication buffers to be in global memory and heap memory as with the earlier benchmarks. This test requires number of PEs to be even. The PEs are paired with PE 0 pairing with PE n/2 and so on, where n is the total number of PEs. The first PE in each pair issues back-to-back shmem_putmem operations to its peer PE. The total time for the put operations is measured and operation rate per second is reported. All PEs call shmem_barrier_all after the test for each message size.
Atomics Latency (osu_oshm_atomics):
This benchmark measures the performance of atomic fetch-and-operate and atomic operate routines supported in OpenSHMEM for the integer datatype. The buffers can be selected to be in heap memory or global memory. The PEs are paired like in the case of Put Operation Rate benchmark and the first PE in each pair issues back-to-back atomic operations of a type to its peer PE. The average latency per atomic operation and the aggregate operation rate are reported. This is repeated for each of fadd, finc, add, inc, cswap and swap routines.
Collective Latency Tests:
OSU Microbenchmarks consists of the following collective latency tests:
The latest OMB Version includes the following benchmarks for various OpenSHMEM collective operations (shmem_collect, shmem_broadcast, shmem_reduce and shmem_barrier).
These benchmarks work in the following manner. Suppose users run the osu_oshm_broadcast benchmark with N processes, the benchmark measures the min, max and the average latency of the shmem_broadcast operation across N processes, for various message lengths, over a number of iterations. In the default version, these benchmarks report average latency for each message length. Additionally, the benchmarks the following options:
OSU Microbenchmarks extensions include UPC benchmarks also. Current version (OMB-4.1) has benchmarks for upc_memput and upc_memget. The complete benchmark suite is available along with MVAPICH2-X binary package, in the folder: <MVAPICH2-X_INSTALL>/libexec/osu-micro-benchmarks. A brief description for each of the benchmarks is provided below.
Put Latency (osu_upc_memput):
This benchmark measures the latency of upc_put operation between multiple UPC threads. In this benchmark, UPC threads with ranks less than (THREADS/2) issue upc_memput operations to peer UPC threads. Peer threads are identified as (MYTHREAD+THREADS/2). This is repeated for a fixed number of iterations, for varying data sizes. The average latency per iteration is reported. A few warm-up iterations are run without timing to ignore any start-up overheads. All UPC threads call upc_barrier after the test for each message size.
Get Latency (osu_upc_memget):
This benchmark is similar as the osu_upc_put benchmark that is described above. The difference is that the shared string handling function is upc_memget. The average get operation latency per iteration is reported.
MVAPICH2-X supports all the runtime parameters of MVAPICH2 (OFA-IB-CH3). A comprehensive list of all runtime parameters of MVAPICH2 2.0a can be found in User Guide. Runtime parameters specific to MVAPICH2-X are listed below.
Set UPC Shared Heap Size
Enable/Disable shared memory scheme for intra-node communication.
Set OpenSHMEM Symmetric Heap Size
Based on our experience and feedback we have received from our users, here we include some of the problems a user may experience and the steps to resolve them. If you are experiencing any other problem, please feel free to contact us by sending an email to email@example.com.
Current version of upcc available with MVAPICH2-X package gives a compilation error if the gcc version is not 4.4.7. Please install gcc version 4.4.7 to fix this.
By default, upcc compiler driver will transparently use Berkeley’s HTTP-based public UPC-to-C translator during compilation. If your system is behind a firewall or not connected to Internet, upcc can become unresponsive. This can be solved by using a local installation of UPC translator, which can be downloaded from here.
The translator can be compiled and installed using the following commands:
$ make install PREFIX=<translator-install-path>
After this, upcc can be instructed to use this translator.
$ upcc -translator=<translator-install-path> hello.upc -o hello
MVAPICH2-X RPMs are relocatable. Please use the --prefix option during RPM installation for installing MVAPICH2-X into a specific location. An example is shown below:
$ rpm -Uvh --prefix <specific-location> mvapich2-x_gnu-2.0-0.1.a.el6.x86_64.rpm berkeley_upc-osu_gnu-2.0-0.1.a.el6.x86_64.rpm openshmem-osu_gnu-2.0-0.1.a.el6.x86_64.rpm osu-micro-benchmarks_gnu-4.1-1.el6.x86_64.rpm