我正在使用狮子和 xcode 4.2。我使用 macports 安装了 openmpi。全部安装成功。
但是,我找不到指南来告诉我如何/包含哪些库来编译示例(见下文)
#include <mpi.h>
#include <stdio.h>
int main(int argc, char *argv[])
{
int numprocs;
int myid;
MPI_Status stat;
/* all MPI programs start with MPI_Init */
MPI_Init(&argc,&argv);
/* Comm_size tells us how many processes there are */
MPI_Comm_size(MPI_COMM_WORLD,&numprocs);
/* Comm_rank finds the rank of the process */
MPI_Comm_rank(MPI_COMM_WORLD,&myid);
/* Print out a message */
printf("Hello world, from process %d of %d\n", myid, numprocs);
/* MPI Programs end with MPI Finalize; this is a weak synchronization point */
MPI_Finalize();
return 0;
}
Xcode 报告缺少 mpi.h。