手机版
你好,游客 登录 注册 搜索
背景:
阅读新闻

Windows 7系统下搭建MPI(并行计算)环境

[日期:2012-10-01] 来源:Linux社区  作者:hs794502825 [字体:大 中 小]

3.本以为到此就已经安装好了,然后就赶紧写了个Hello World的程序。

  1. #include <mpi.h>   
  2. #include <stdlib.h>   
  3. #include <stdio.h>   
  4. #include <conio.h>   
  5.    
  6. #pragma comment (lib, "mpi.lib")     
  7.    
  8. int main(int argc, char* argv[])   
  9. {   
  10.     int myid,numprocs;   
  11.     int namelen;   
  12.     char processor_name[MPI_MAX_PROCESSOR_NAME];   
  13.        
  14.     MPI_Init(&argc, &argv);   
  15.    
  16.     //用MPI_Comm_rank 获得进程的rank,该rank值为0到p-1间的整数,相当于进程的ID   
  17.     MPI_Comm_rank(MPI_COMM_WORLD, &myid);   
  18.     //用MPI_Comm_size 获得进程个数  int MPI_Comm_size(MPI_Comm comm, int *size);   
  19.     MPI_Comm_size(MPI_COMM_WORLD, &numprocs);   
  20.    
  21.     MPI_Get_processor_name(processor_name, &namelen);   
  22.        
  23.     printf("Hello World! by MoreWindows\nProcess %d of %d on %s\n", myid, numprocs, processor_name);   
  24.        
  25.     MPI_Finalize();   
  26.        
  27.     if (myid == 1)   
  28.     {   
  29.         printf("\nPress a key and exit.\n");   
  30.         getch();   
  31.     }   
  32.     return 0;   
  33. }   

编译运行之后各种如下错误:

c:\program files\mpich2\include\mpicxx.h(1536) : error C2555: 'MPI::Intercomm::Clone' : overriding virtual function differs from 'MPI::Comm::Clone' only by return type or calling convention

c:\program files\mpich2\include\mpicxx.h(1107) : see declaration of 'Comm'

郁闷,这么个小东西都装不好,还谈什么写程序啊!

linux
相关资讯       MPI 
本文评论   查看全部评论 (0)
表情: 表情 姓名: 字数

       

评论声明
  • 尊重网上道德,遵守中华人民共和国的各项有关法律法规
  • 承担一切因您的行为而直接或间接导致的民事或刑事法律责任
  • 本站管理人员有权保留或删除其管辖留言中的任意内容
  • 本站有权在网站内转载或引用您的评论
  • 参与本评论即表明您已经阅读并接受上述条款