小编Már*_*ana的帖子

MPI 和 C 中的矩阵向​​量乘法

我正在尝试使用 MPI 和 C 将方阵乘以向量。我必须使用 MPI_Allgather 将矩阵的所有部分发送到所有进程。这就是我到目前为止所拥有的

#include "mpi.h" 
#include <stdlib.h>
#include <stdio.h>
#include <math.h>
#include <string.h>
#include <time.h>
#define DIM 500

int main(int argc, char *argv[])
{

      int i, j, n; 
      int nlocal;        /* Number of locally stored rows of A */ 
      double *fb;
      double a[DIM*DIM], b[DIM], x[DIM];     /* Will point to a buffer that stores the entire vector b */ 
      int npes, myrank; 
      MPI_Status status; 

       MPI_Init(&argc,&argv);

     /* Get information about the communicator */ 
     MPI_Comm_rank(MPI_COMM_WORLD, &myrank);
     MPI_Comm_size(MPI_COMM_WORLD, &npes);  

     /* …
Run Code Online (Sandbox Code Playgroud)

c mpi matrix-multiplication

5
推荐指数
1
解决办法
7512
查看次数

标签 统计

c ×1

matrix-multiplication ×1

mpi ×1