第2讲用MPI编写程序.ppt

第2讲用MPI编写程序.ppt

第2 讲 用MPI编写程序 马丽生 计算机与信息工程学院 mls@chzu.edu.cn 目录 简单MPI程序的组成 常用的MPI函数 简单的MPI程序示例 作业与实验 简单MPI程序的组成 MPI实现的”Hello World!” #include mpi.h #include stdio.h #include math.h int main(int argc, char *argv[]) { int myid,numprocs; int namelen; char processor_name[MPI_MAX_PROCESSOR_NAME]; MPI_Init(argc,argv); MPI_Comm_size(MPI_COMM_WORLD,numprocs); MPI_Comm_rank(MPI_COMM_WORLD,myid); MPI_Get_processor_name(processor_name,namelen); fprintf(stderr,hello world!, Process %d of %d on %s \n,myid,numprocs,processor_name); MPI_Finalize(); return 0; } 简单MPI程序的组成 MPI程

文档评论(0)

1亿VIP精品文档

相关文档