0

我有个问题:

mpiexec.exe -noprompt -wdir "D:\###" -n 1 "D:\###\_simple_test.exe"

印刷

连接主机时出错,###。(10061)

连接 sock (host=###-pc, port=8678) 失败,用尽所有端点

无法连接到“###-pc:8678”,

袜子错误:错误 = -1

程序代码:

#include <stddef.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <mpi.h>

int main(int argc, char **argv)
{
    char message[20];
    int i, rank, size, type = 99;
    MPI_Status status;
    MPI_Init(&argc, &argv);
    MPI_Comm_size(MPI_COMM_WORLD, &size);
    MPI_Comm_rank(MPI_COMM_WORLD, &rank);
    if (rank == 0)
    {
        strcpy(message, "Hello, world!");
        for (i = 1; i < size; i++)
            MPI_Send(message, 14, MPI_CHAR, i, type,
                MPI_COMM_WORLD);
    }
    else
        MPI_Recv(message, 20, MPI_CHAR, 0, type,
            MPI_COMM_WORLD, &status);
    printf("Message from process = %d : %.14s\n", rank, message);
    MPI_Finalize();
    system("pause");
    return 0;
}

我该如何解决?

4

0 回答 0