2012-11-15 146 views
2

我是并行编程的新手。我正在尝试乘以两个矩阵。矩阵乘法与mpi

让操作MAT3 = MAT1 X MAT2 我广播MAT2在通信的所有进程,并切割出MAT1的排片,并将其分散到过程:我已经划分情况如下问题在commnicator组中。在所有进程都包含整个mat2和mat1的相应条带之后,它们将条带与mat2相乘,然后使用进程的本地结果执行收集操作,并将整个结果累积到根进程中。

我想知道在通用计算机中是否有更好的问题分区来乘以两个矩阵。

我的实现是在OpenMPI中。

回答

4

有关矩阵乘法的文献中有各种算法可以扩展到MPI范例。例如:

> 1Dsystolic [1] 
> 2D-systolic, Cannon’s algorithm [2]; 
> Fox’s algorithm [3]; 
> Berntsen’s algorithm [4]; 
> DNS algorithm [5]. 

如果忽略该矩阵礼(稀疏ECT),它基本上恢复关于如何其分布的处理中的同步和负载不平衡(工作的每个过程之间分配量最小化的数据)。

在这recent work你可以看到两种不同的数据分布方法和他们之间的比较。

论文:

[1] Golub G.H and Van C.H L., “Matrix Computations.”,Johns Hopkins University Press, 1989. 
[2] Whaley R. C., Petitet A., Dongarra J. J., “Automated empirical optimizations of software and the ATLAS project” Parallel Computing 27, 1.2 (2001), 3.35. 
[3] Fox G. C., Otto S. W., and Hey A. J. G., “Matrix algorithms on a hypercube I: 
Matrix multiplication”,Parallel Computing, vol. 4, pp. 17-31. 1987. 
[4] Berntsen J.,“Communication efficient matrix multiplication on hypercubes, Parallel Computing”, vol. 12, pp. 335-342, 1989. 
[5] Ranka S. and Sahni S., “Hypercube Algorithms for Image Processing and Pattern Recognition”, Springer- Verlag, New York, NY, 1990.