Код: Выделить всё
#include
#include
#include
#include
using namespace std;
int main(int argc, char** argv) {
MPI_Init(&argc, &argv);
int rank, size;
MPI_Comm_rank(MPI_COMM_WORLD, &rank);
MPI_Comm_size(MPI_COMM_WORLD, &size);
int n;
int reduce;
if (rank == 0) {
cout > n;
}
MPI_Bcast(&n, 1, MPI_INT, 0, MPI_COMM_WORLD);
int* arr = (int*)calloc(n * n, sizeof(int));
int countofwrigthelements = (n - 1) * n / 2;
cout
Подробнее здесь: [url]https://stackoverflow.com/questions/78415806/i-cant-figure-out-where-the-error-is-in-the-code-of-the-mpi-gather-function[/url]