当我编译并运行此示例时,我的 cpu 是 intel i3 m350:
#include < mpi.h> /* PROVIDES THE BASIC MPI DEFINITION AND TYPES */
#include < stdio.h>
int main(int argc, char **argv)
{
int my_rank;
int size;
MPI_Init(&argc, &argv); /*START MPI */
/*DETERMINE RANK OF THIS PROCESSOR*/
MPI_Comm_rank(MPI_COMM_WORLD, &my_rank);
/*DETERMINE TOTAL NUMBER OF PROCESSORS*/
MPI_Comm_size(MPI_COMM_WORLD, &size);
MPICH_NAME;
printf("Hello world! I'm rank %d of size %d\n", my_rank, size);
MPI_Finalize(); /* EXIT MPI */
getchar();
}
输出是:
Hello world! I'm rank0 of size 1
这意味着它没有检测到我的 4 个核心。有什么问题?