2012-11-15 254 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.