MPI: MPICH2 Installation and programming in LAN with Windows

帅比萌擦擦* 提交于 2019-12-21 12:41:56

问题


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

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();
}

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

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.

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

UPDATE:

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

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?


回答1:


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>

Check sections 5.4 and 9 from the MPICH user's guide.

Update:

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).




回答2:


After much hard work I was able to contact the support team and teh answer which I got is:

Unfortunately the MPICH team no longer supports their Windows version

However, there is still some hope left as MS-MPI could still be used:

http://wiki.mpich.org/mpich/index.php/Frequently_Asked_Questions#Q:_Why_can.27t_I_build_MPICH_on_Windows_anymore.3F

Unfortunately, due to the lack of developer resources and interest, the last version of MPICH which was supported on Windows was MPICH2 1.4.1p. There is minimal support left for this version, but you can find it on the downloads page: http://www.mpich.org/downloads/ Alternatively, Microsoft maintains a derivative of MPICH which should provide the features you need. You also find a link to that on the downloads page above. That version is much more likely to work on your system and will continue to be updated in the future. We recommend all Windows users migrate to using MS-MPI.



来源:https://stackoverflow.com/questions/19332339/mpi-mpich2-installation-and-programming-in-lan-with-windows

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!