Fatal error in MPI_Isend: Other MPI error, error stack
Я получаю ошибку Fatal error in MPI_Isend: Other MPI error, error stack: MPI_Isend(buf=0x0000026933811C80, count=1, dtype=USER, dest=1, tag=0, MPI_COMM_WORLD, request=0x00000093708FF474) failed failed to attach to a bootstrap queue - 7764:308
Программа должна передавать на каждый процесс столбец матрицы.
код:
#include <stdio.h>
#include <mpi.h>
#include <iostream>
#include <time.h>
using namespace std;
bool IsPrime(int n);
int main(int argc, char* argv[]) {
int rank, size, m;
m = 4;
MPI_Status Status;
MPI_Request Request;
MPI_Init(&argc, &argv);
MPI_Comm_size(MPI_COMM_WORLD, &size);
MPI_Comm_rank(MPI_COMM_WORLD, &rank);
int n = size-1;
int* A = new int[m * n];
int* B = new int[m];
MPI_Datatype col;
MPI_Type_vector(m,1, n, MPI_INT, &col);
MPI_Type_commit(&col);
int j = 1;
if (rank == 0)
{
srand((unsigned)time(0));
cout << " Vector A: " << endl;
for (int i = 0; i < n * m; i++)
{
A[i] = rand() % (50 - 1 + 1) + 1;
cout << " " << A[i];
if (i == j * n - 1)
{
cout << endl;
j++;
}
}
for (int i = 0; i < m; i++)
{
B[i] = 0;
}
j = 0;
cout << "size=" << size;
for(int i=1;i<size;i++)
{
cout << "i=" << i;
MPI_Isend(&A[j], 1, col, i,0, MPI_COMM_WORLD,&Request); //место ошибки
j += 1;
}
}
else
{
MPI_Irecv(B, m, MPI_INT, 0, MPI_ANY_TAG, MPI_COMM_WORLD, &Request);
for (int k = 0; k < m; k++)
{
cout << " B[" << k << "]=" << B[k] << " rank=" << rank << " ";
}
}
if (rank == 0)
{
////MPI_Gather(&B, n, col, &A, n, col, 0, MPI_COMM_WORLD);
//cout << endl << "RESULT A:" << endl;
//j = 1;
//for (int i = 0; i < n * m; i++)
//{
// cout << " " << A[i];
// if (i == j * n - 1)
// {
// cout << endl;
// j++;
// }
//}
}
MPI_Finalize();
return 0;
}
bool IsPrime(int n)
{
if (n == 2) return true;
if (n < 2 || n % 2 == 0) return false;
for (int i = 3; i * i <= n; i += 2)
if (n % i == 0) return false;
return true;
}