mpi运行 发表于 2018-03-Wed | 阅读次数: 12brew install openmpiexport OMPI_CXX=g++-712mpic++ helloworld.cpp -o helloworld.outmpirun -n 2 ./helloworld.out123456789101112131415161718#include <cstdio>#include <mpi.h>int main (int argc, char **argv){ int rank, size; MPI_Init (&argc, &argv); /* starts MPI */ MPI_Comm_rank (MPI_COMM_WORLD, &rank); /* get current process id */ MPI_Comm_size (MPI_COMM_WORLD, &size); /* get number of processes */ printf( "Hello world from process %d of %d\n", rank, size ); MPI_Finalize(); return 0;}请作者喝一杯咖啡☕️打赏微信支付