初探 mpich2 + vc6.0包 + Win7 + 64位单机平台 命令行运行

最近突然对mpi感兴趣了,可啃了几天久攻不下,也郁郁了几天。。今天总算有所突破,,也算是入了mpi大门,嘿嘿。。

 

要说明的一点是:虽然是64的平台,但也就需要64的c编译器,条件有点苛刻。而我只想用用32位的cl.exe,没想32位的mpich2也是可行的,这就省心不少,嘿嘿。

 

首先下载一个最新的mpich2:

http://www.mcs.anl.gov/research/projects/mpich2/downloads/tarballs/1.2.1p1/mpich2-1.2.1p1-win-ia32.msi暂时就选这个稳定版本吧。

 

接着是安装,用命令行安装(推荐),且看下面的邮件对白,嘿嘿:

Hi, Very thanks for your response.
I reinstalled the MPICH2 by the steps that you say to me.
After the installation I try to run a non-MPI program (mpiexec -n 2
hostname) and I have the same error:
I have the output:
Please specify an authentication passphrase for smpd:
I write the authentication passphrase and the system response to me:
Aborting: unable to connect to User-PC
Very thanks.
I will thanks any help.
Yessica Brinkmann

2010/5/25  <jayesh at mcs.anl.gov>:
> Hi,
>  I would recommend uninstalling MPICH2 and installing it again from the administrator command prompt by following the steps below.
>
> # Download the latest version of MPICH2 (http://www.mcs.anl.gov/research/projects/mpich2/downloads/index.php?s=downloads).
> # Open an administrator command prompt (Right-click on the command prompt icon and select "Run as administrator")
> # From the admin command prompt use the msiexec utility to uninstall MPICH2 (eg: Type "msiexec /x mpich2-1.2.1p1-win-ia32.msi" to uninstall MPICH2 using the mpich2-1.2.1p1-win-ia32.msi installer)
> # The above command will bring up the Installer GUI to uninstall MPICH2. Follow the steps to uninstall MPICH2.
> # From the admin command prompt use the msiexec utility to install MPICH2 (eg: Type "msiexec /i mpich2-1.2.1p1-win-ia32.msi" to install MPICH2 using the mpich2-1.2.1p1-win-ia32.msi installer)
> # The above command will bring up the Installer GUI to install MPICH2. Follow the installer steps to install MPICH2.
> # After the installation try to run a non-MPI program (mpiexec -n 2 hostname) . If the job launcher, mpiexec, requests for a username/password please provide the same (When specifying the username/password make sure that you specify the domain name if the user is a domain user).
>
>  Let us know the results.
>
> Regards,
> Jayesh

看看红色的部分,就知道:

首先打开附件,找到命令提示符图标,点右键,选择以管理员身份运行(注意一定要在管理员权限下才行,这也是我这几天郁闷的心结!!).

接着输入命令msiexec去卸载或安装mpich2包。

比如你刚才下载的 mpich2-1.2.1p1-win-ia32.msi   文件放在e盘根目录下,则

msiexec  /i  e:/mpich2-1.2.1p1-win-ia32.msi  这样就可以完成管理员权限下的mpich2安装,执行安装过程中的,只需默认(路径也不要改,这样省心不少)下一步下一步,,直到完成。。

 

接着写一个程序啦,,这个是网友提供的,我也没变动:

 

#define  MPICH_SKIP_MPICXX
#include <mpi.h>
#include <stdlib.h>
#include <stdio.h>
#include <conio.h>
#include <math.h>
#include <iomanip.h>
#include <fstream.h>
#include "string.h"
#pragma comment (lib, "mpi.lib")


int main(int argc, char *argv[])
{
  int  numprocs, rank, 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, &rank);
  MPI_Get_processor_name(processor_name, &namelen);
  printf("Process %d on %s out of %d/n", rank, processor_name, numprocs);

  MPI_Finalize();

return 0;

}

保存为cl.c文件。。

 

接着是编译环境了:

想了想用vs,vc  都是可以,,这里搞点新的,,抓包vc6.0(用里面的bin include lib 等等),得到的目录项如下:

 

下一步是编译这个.c文件。。

 

写一个批处理,比较便捷:

 

@echo off
set include=C:/Program Files (x86)/MPICH2/include;D:/vcPack/include;D:/vcPack/MFC/Include
set lib=C:/Program Files (x86)/MPICH2/lib;D:/vcPack/lib;D:/vcPack/MFC/lib
set path=C:/Program Files (x86)/MPICH2/bin;D:/vcPack/bin;%path%


echo ---------------=======By GoldenSpider 2010-7-25=======-------------------
echo on

cl   /c   cl.c

link /LIBPATH:"C:/Program Files (x86)/MPICH2/lib" cl.obj  mpi.lib

del *.obj

pause

mpiexec -n 4 cl.exe

 

保存为make.bat就可以了,注意不要用双击的方式运行,这样只是在用户权限下执行的,一定要在管理员权限下执行才可以的。。所在目录如下:

 

 

 

所以还是用上面的办法得到管理员权限下的命令提示符,再切换到make.bat所在的目录下运行这个make.bat文件。如下:

 

 

 

 

 

 

  • 0
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 2
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值