这让我发疯——我不知道我做错了什么。我一遍又一遍地查看 API。我知道 MPI_Cart_create 的签名:
int MPI_Cart_create(MPI_Comm comm_old, int ndims, int *dims, int *periods,
int reorder, MPI_Comm *comm_cart)
这是我的代码:
MPI_Init (&argc, &argv);
MPI_Comm_rank(MPI_COMM_WORLD, &rank);
MPI_Comm_size(MPI_COMM_WORLD, &processCount);
MPI_Comm cart_com, old_com;
int ndims = 2;
int reorder = 0;
int dim_size[2], periods[2];
dim_size[0] = processCount;
dim_size[1] = processCount;
periods[0] = 1;
periods[1] = 1;
old_com = MPI_COMM_WORLD;
MPI_Cart_create(MPI_COMM_WORLD, ndims, dim_size, periods, reorder, &cart_com);
我得到错误:
[ubuntu:7975] *** An error occurred in MPI_Cart_create
[ubuntu:7975] *** on communicator MPI_COMM_WORLD
[ubuntu:7975] *** MPI_ERR_ARG: invalid argument of some other kind
[ubuntu:7975] *** MPI_ERRORS_ARE_FATAL (your MPI job will now abort)
即使只是一点提示也会很好....谢谢