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




Multi Cores : Mixed Mode of Programming :Using MPI & TBB

Example 1.1

Write an MPI-tbb program to compute the value of PI pie function by numerical integration of a function f(x) = 4/(1+x2) between the limits 0 and 1. You have to use MPI Collective Communication and Computation Library Calls and TBB PARALLEL For Directive. ( Code below )

Example 1.2

Write a MPI-TBB program to compute the matrix into vector Multiplication using rows wise Partitoning of input Matrices. ( Code below )

Example 1.3

Write a MPI-TBB program to compute the matrix into matrix Multiplication using rows wise Partitoning of input Matrices. ( Assignment )

Example 1.4

Write TBB program to obtain Solution of Poisson Equation (Partial differential Equations) by Finite Difference Method using One Dimensional Decomposition of Mesh. ( Assignment )


Description of Pthread Programs

Example 1.1 : Write an MPI-tbb program to compute the value of PI.

( Download source code : pi_calc_mpi_tbb.cpp )

( Download WinRAR ZIP archive:
mpi-tbb-pi-calc (WinRAR ZIP archive)


  • Objective
  • Write an MPI-tbb program to compute the value of PI.

  • Description
  • Write an MPI-tbb program to compute the value of PI pie function by numerical integration of a function f(x) = 4/(1+x2) between the limits 0 and 1. You have to use MPI Collective Communication and Computation Library Calls and TBB PARALLEL For Directive.

  • Input
  • Number of intervals and grain-size for the intelTBB

  • Output
  • Pi value calculated, time taken and error of deviation of Pi calculate from actual value

    Example 1.2 : Write a MPI-TBB program to compute the matrix into vector Multiplication.

    ( Download source code :
    mpi_tbb_matrix_vector_multiply.cpp , Matrix.input, Vector.input, Makefile, README )

    ( Download WinRAR ZIP archive:
    mpi-tbb-matrix-vector (WinRAR ZIP archive)

    • Objective
    • Write a MPI-TBB program to compute the matrix into vector Multiplication.

    • Description
    • Write a MPI-TBB program to compute the matrix into vector Multiplication using rows wise Partitoning of input Matrices. In this program the MPI part takes the input (Matrix + Vector) by one process (with rank = 0). Packs this matrix to 1D matrix of equal sizes and distributes to all available processes.The vector is 'broadcasted' as such to all the processes. Each process than makes use intelTBB to parallely execute vector-matrix multiplication process for the chunk it has received. The MPI gather is then used to obtain all small chunks of result and integrated to obtain final result.

    • Input
    • Matrix.input file and Vector.input file

    • Output
    • Final resultant Matrix

    Centre for Development of Advanced Computing