【发布时间】:2013-12-23 05:01:20
【问题描述】:
我目前正在尝试使用 C 实现矩阵-矩阵乘法。我有以下代码
for(index=0; index<p; index++)
{
/* calculate the partial sum for matC given the row band of A and
B */
for (i=0; i<n/p; i++)
for (j=0; j<n; j++)
for (k=0; k<n; k++)
storage_matC[i*n+j] += storage_matA[i*n+k]*storage_matB[k*n+j];
if(index < p-1)
{
/* mpi send storage_matB to the next process (id+1)%p */
MPI_Send(storage_matB, n, MPI_FLOAT, (id+1)%p, 0, MPI_COMM_WORLD);
/* mpi receive storage_matB from the previous process */
MPI_Recv(&storage_matB, n, MPI_FLOAT, id, 0, MPI_COMM_WORLD, MPI_STATUS_IGNORE);
}
}
我需要能够发送当前进程中使用的matrix_b,然后在当前进程中从前一个进程中接收。我的程序只是挂在那里,我必须终止它。 有人可以告诉我如何解决这个问题...
非常感谢您的宝贵时间,非常感谢您的帮助!
【问题讨论】: