MPI:Windows中在LAN中进行MPICH2安装和编程 [英] MPI: MPICH2 Installation and programming in LAN with Windows

查看:119
本文介绍了MPI:Windows中在LAN中进行MPICH2安装和编程的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在学习MPI.我遵循的第一个教程是此处

I am learning MPI. The first tutorial I followed is here

我在带有MSVC 2010的Windows 7上成功运行的代码是:

The code that I run successfully on Windows 7 with MSVC 2010 is :

#include "mpi.h"
#include "iostream.h"

int main(int argc,char *argv [])
{
   int numtasks, rank, rc; 
   rc = MPI_Init(&argc,&argv);
   if (rc != MPI_SUCCESS) {
       printf ("Error starting MPI program. Terminating.\n");
       MPI_Abort(MPI_COMM_WORLD, rc);
   } 
   MPI_Comm_size(MPI_COMM_WORLD,&numtasks);
   MPI_Comm_rank(MPI_COMM_WORLD,&rank);
   printf ("Number of tasks= %d My rank= %d\n", numtasks,rank);
   MPI_Finalize();
}

我已经在我的Pentium-4机器上成功运行了此代码(不要惊讶,我仍然有一个Pentium-4).

I am successfully running this code on my Pentium-4 machine (dont be surprised I am still having one Pentium-4).

现在,我想在连接到以太网LAN的多台计算机上运行此代码(或任何其他MPI代码).例如,假设每台计算机的总和为1到1000,然后发送回主节点,则主节点将所有这些数字相加以获得最终的总和.

Now I want to run this code (or any other MPI code) on multiple machines connected in a Ethernet LAN. Say for example each machine sums 1 to 1000, and send back to a master node, the master node then adds all those numbers to get the final sum.

我的问题是如何在网络中启动MPI编程?我应该在每台机器上运行哪些所有工具/软件.

My question is how to start MPI programming in a network? What all tools/softwares should I run in each machine.

如果您能给我指南的指导,我将不胜感激.

I will really appreciate if you can give me a pointer to a tutorial.

MPI Implemnetation: MPICH2 
O.S:each machine is having Windows 7, 32 bit CPU: Intel's Pentium 4 and Dual core 
Network: Ethernet 
IDE:MSVC2010

更新:

Jev的回答消除了我的一些疑虑.我最近的问题是:

I got some of my doubts cleared with Jev's answer. My latest questions are:

我是否在每台计算机上都安装了MPICH2.在cfg文件中每行写完每台计算机的名称之后,我是否需要做其他事情还是只提供以下命令:

Do I install MPICH2 in each machine. After writing names of each machine per line in the cfg file, Do I need do anything else or just give the command:

<path-to-mpich2>/bin/mpiexec.exe -machinefile hosts.cfg -n nPEs <your-executable>

我怎么知道我的应用程序正在每台机器上运行?在运行该应用程序时,我需要在每台计算机上进行一些特殊配置吗?

how would I know that my application is running on every machine? While running the app do I need to do some special configuration etc on each machine?

推荐答案

将连接的计算机添加到主机文件中,然后将该文件传递给mpiexec:

Add the connected machines to a hostfile and pass the file to the mpiexec:

<path-to-mpich2>/bin/mpiexec.exe -machinefile hosts.cfg -n nPEs <your-executable>

MPICH检查第5.4和9节用户指南.

更新:

是的,您需要在每台计算机上安装MPI库.此外,您需要在每台机器上启动进程管理器守护程序并启用自动远程登录(例如,使用ssh).然后使用mpdtrace或一个简单的hello world程序运行测试,该程序会打印出每台计算机的主机名.如果可行,您将获得不同的主机名打印.如果安装顺利进行,则无需进行特殊配置(例如,为库设置正确的路径).

Yes, you need to install the MPI library on each machine. Moreover, you need to start the process manager daemon on each machine and enable automatic remote login (e.g .using ssh). Then run a test using mpdtrace or a simple hello world program that prints out hostname of each machine. If it works and you will get different hostnames printed. If installation runs smoothly, there should be no need for special configuration (e.g. setting correct path to the library).

这篇关于MPI:Windows中在LAN中进行MPICH2安装和编程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆