mpi测试程序
#include<stdio.h>#include<mpi.h>#include<stdlib.h>#include<time.h>int main(int argc, char* argv[]){int myid, numprocs, namelen;char processor_name[MPI_MAX_PROC...
·
#include<stdio.h>
#include<mpi.h>
#include<stdlib.h>
#include<time.h>
int main(int argc, char* argv[])
{
int myid, numprocs, namelen;
char processor_name[MPI_MAX_PROCESSOR_NAME];
MPI_Init(&argc, &argv); // starts MPI
MPI_Comm_rank(MPI_COMM_WORLD, &myid); // get current process id
MPI_Comm_size(MPI_COMM_WORLD, &numprocs); // get number of processes
MPI_Get_processor_name(processor_name, &namelen);
if (myid == 0) printf("number of processes: %d\n...", numprocs);
printf("%s: Hello world from process %d \n", processor_name, myid);
MPI_Finalize();
return 0;
}
关于配置mpi参考https://blog.csdn.net/Candy_GL/article/details/80015209?tdsourcetag=s_pcqq_aiomsg
更多推荐
已为社区贡献1条内容
所有评论(0)