Mode-1 Multi-Core Memory Allocators OpenMP Intel TBB Pthreads Java - Threads Charm++ Prog. Message Passing (MPI) MPI - OpenMP MPI - Intel TBB MPI - Pthreads Compiler Opt. Features Threads-Perf. Math.Lib. Threads-Prof. & Tools Threads-I/O Perf. PGAS : UPC / CAF / GA Power-Perf. Home




hyPACK-2013 Mode 1 : MPI 1.X Advanced Point-to-Point Library Calls



Module 3 : MPI programs using advanced point-to-point library calls and execute on Message Passing Cluster or Multi Core Systems that support MPI library.

Example 3.1


Write MPI program to find sum of n integers on a Parallel Computing System in which procesors are connected with ring topology and use MPI point-to-point non-blocking communication library calls .

Example 3.2


Write MPI program to find sum of n integers on a Parallel Computing System in which procesors are connected with tree topology (Associative-fan-in rule for tree can be assumed) and use MPI point-to-point non-blocking communication library calls.

Example 3.3



Write MPI program to send a message from process with rank 0 to process with rank 1 and process with rank 1 to send a message to process with 0 on a Parallel Computing System (Use MPI point-to-point blocking communication library calls and order these library calls to avoid deadlock).( Assignment)

Example 3.4

Write MPI program to implement all-gather ring using MPI non-blocking library calls.( Assignment)

Example 3.5

Write MPI program to implement hypercube exchange algorithm using MPI advacned point-to-point blocking communication library calls. ( Assignment)

Example 3.6

Write MPI program to implement MPI persistent library calls to paralleize for loop consists of sequence of send and recive library calls on a Parallel Computing System .( Assignment)

Example 3.7



Write MPI program to send a message from process with rank 0 to process with rank 1, process with rank 1 sends a message to process with 2, and process with rank 2 sends a message to process with 3 and so on ... on a parallel computing system. (Use MPI MPI_Sendrecv and MPI_Sendrecv_replace communication library calls and order these library calls). ( Assignment)

Example 3.8

Write MPI program imlementing ring-based all-to-all function using different types of non-blocking communication library calls.( Assignment)


( Source - References : Books     Multi-threading     - [MC-MPI-02], [MCMPI-06], [MCMPI-07], [MCMPI-09], [MC-MPI10], [MCMPI-11], [MCMTh-12],[MCBW-44], [MCOMP-01])

Description of Programs - MPI Point-to-Point Comm. Lib. Calls

Example 3.1: Description for implementation of MPI program to find sum of n integers on parallel computer in which processors are arranged in ring topology using point-to-point non-blocking communication library calls
(Download source code : sum_ring_topology-non-block.c   )
  • Objective
  • Write a MPI program to find sum of n values using p processors of cluster. Assume that p processors are arranged in ring topology.

  • Input
  • For input data, let each process use its identifying number, i.e. the value of its rank. For example, process with rank 0 uses the number 0, process with rank 1 uses the number 1, etc.

  • Output
  • Process with rank 0 prints the final sum.

    Example 3.2:      


    Description for implementation of MPI program to find sum of n integers on parallel computer in which processors are arranged in binary tree topology (associative fan-in rule) using MPI point-to-point non-blocking library calls.
    (Download source code : sum_associative_fanin_nonblocking_tree.c   )
  • Objective
  • Write a MPI program to find sum of n values using p processors of message passing cluster. Assume that p processors are arranged in ring topology.

  • Description
  • In linear array interconnection network with a wraparound connection is called as a ring. A wraparound connection is often provided between the processors at the end.A simple way of communicating a message between processors is, by repeatedly passing message to the processor immediately to either right or left; depending on which direction yield a shorter path, until it reaches its destination, i.e., first processor in the ring.

    All the processes are involved in communication. The process with rank k (k is greater than 0) receives the accumulated or partial sum from the previous process with rank k-1. Process with rank p-1 sends the final sum to process with rank 0. Finally, process with rank 0 prints the final sum.

  • Input
  • For input data, let each process use its identifying number, i.e. the value of its rank. For example, process with rank 0 uses the number 0, process with rank 1 uses the number 1, etc.

  • Output
  • Process with rank 0 prints the final sum.

    Centre for Development of Advanced Computing