计算机与现代化 ›› 2011, Vol. 7 ›› Issue (7): 84-87.doi:

• 算法分析与设计 • 上一篇    下一篇

一种基于MPI与OpenMP的矩阵乘法并行算法

张艳华1,刘祥港2   

  1. 1.天津科技大学计算机科学与信息工程学院,天津 300222; 2.天津科技大学计算中心,天津 300222
  • 收稿日期:2011-05-10 修回日期:1900-01-01 出版日期:2011-07-15 发布日期:2011-07-15

Parallel Algorithm of Matrix Multiplication Based on MPI & OpenMP

ZHANG Yan-hua1, LIU Xiang-gang2   

  1. 1.College of Computer Science and Information Technology, Tianjin University of Science & Technology, Tianjin 300222, China;2.Computing Center, Tianjin University of Science & Technology, Tianjin 300222, China
  • Received:2011-05-10 Revised:1900-01-01 Online:2011-07-15 Published:2011-07-15

摘要: 阐述MPI与OpenMP进行并行计算的特点,并在Visual Studio 2010上构建一个基于两者的混合编程平台。程序在该平台上执行时能够同时实现多进程与进程内多线程编程,设计并实现一种基于数据划分的矩阵乘法的并行算法,将数据分解为两部分交给两个计算节点分别完成,并在每个计算节点内将数据进一步划分,交给多个线程同时执行。通过与非并行矩阵乘法、MPI矩阵乘法、OpenMP矩阵乘法运算性能进行比较,验证该算法可以有效地挖掘计算机的处理能力。

关键词: 数据划分, 混合并行计算, MPI, OpenMP, 矩阵乘法

Abstract: How MPI and OpenMP act separately on parallel computing is introduced, and a platform is established using MPI and OpenMP on Visual Studio 2010. The multi-process and multithreadings are realized on it. A matrix multiplication parallel algorithm on data partitioning is designed and implemented. The matrix data are divided into two parts for two computers. Each computer completes one part by using multithreadings. The experiments prove that data processing capability is improved compared with matrix multiplication, matrix multiplication on MPI and matrix multiplication on OpenMP.

Key words: data partitioning, mixture parallel computing, MPI, OpenMP, matrix multiplication