并行计算—集群系统(3)

来源:互联网 发布:09年总决赛科比数据 编辑:程序博客网 时间:2024/05/04 08:22

在前天和作天进行集群系统的安装上取得了比较大的进步,在昨天晚上

总算把集群系统的平台搭建好了,在今天晚上又编译了一个hello Word

!程序在两台机器上开始跑了起来,呵呵总算没有浪费这几天的心血。

给自己赞一下^_^

把自己安装MPICH2的过程和遇到的问题总结一下,希望对自己以后有帮

助》

 

1  MPICH2的安装

在这里面可以按照这个网址:

http://blog.sina.com.cn/s/blog_5a16b28c0100ef1s.html所给的步骤

来做。

不过要注意的是安装MPICH2之前的前提是多台计算机要能够ping得通和

ssh通信无需密码,这是搭建这个平台的关键也是很重要的一步,呵呵,

总之一定要安装好这个两步。在安装mpich的过程中我所选择的软件是:

mpich2-1.0.8p1.在安装的时候,是按照readme的要求来做的,所以以后

不管安装哪一个版本的软件都要根据readme的要求来做,同时在安装这

个软件的时候要注意configure参数的设置.

 

在进入mpich2-1.0.8p1目录之前先设置语言export CC=gcc,然后进入

mpich2-1.0.8p1目录下设置configure的参数,如下;

./configure --with-device=ch3:ssm

./configure --enable-thread=multiple

,.configure --prefix=(你自己所确定的软件安装目录)

 

2  就是进行MPICH2软件的测试

在这里可能会遇到以下的一些问题:

(1)

[root@node1 ~]# mpd &
[1] 8568
[root@node1 ~]# node1_36498 (mpd_sockpair 226): connect -2 Name

or service not known
node1_36498 (mpd_sockpair 233): connect error with -2 Name or

service not known
[root@node1 ~]# mpdtrace
node1
[root@node1 ~]# mpdallexit
[1]+  Done                    mpd

对于这个问题主要是没有开启一个mpd保护进程,所以在按照这种测试的

方式的时候应该采取这一种方式:
[root@node1 mpich2-1.0.8p1]# mpd --daemon
[root@node1 mpich2-1.0.8p1]# mpdtrace -l
node1_53319 (202.38.214.200)

node2_45782 (202.38.214.201)
[root@node1 mpich2-1.0.8p1]# mpdallexit

这样就可以把问题解决了。

 

(2)在进行MPICH2测试的时候也出现下面的情况:

[root@node1 examples]# mpiexec -n 2 /usr/local/mpich2-

1.0.8p1/examples/icpi
mpiexec_node1 (mpiexec 392): no msg recvd from mpd when

expecting ack of request

 

no msg recvd from mpd when expecting ack of request,对于这个问

题的解决方法是:

 

1~ 在安装MPICH2的时候没有在configure的参数没有设置好,应当加入

--with-device=ch3:ssm应为

 

in the file installation manual of mpich2-1.1.....

ch3:nemesis  This method is our new, high performance method.

It has been made the default communication channel starting the

1.1 release of MPICH2. It uses shared-memory to send messages

between processes
on the same node and the network for processes between

nodes.Currently sockets and Myrinet-MX are supported networks.

It supports MPI THREAD MULTIPLE and other levels of thread

safety.

 

2~ 就是在解压缩的文件目录下/mpich2-1.0.8p1/src/pm/mpd目录下的文

件mpiexec.py

对于该文件的处理我参考了一下的几个网址:

http://blog.csdn.net/zhxue123/archive/2009/08/22/4473089.aspx

上面的这个事修改:mpiexec.py文件中的

'MPIEXEC_RECV_TIMEOUT'        :  20

值20修改为50

http://blog.sina.com.cn/s/blog_53bd5ade0100d8kn.html

在环境便变量中增加:

export MV2_MPD_RECVTIMEOUT_MULTIPLIER=0.07

 

3~ 在这里面有一个比较重要的一点,也是自己在安装中最容易忽略的一

点,正因为这一点我在测试MPICH2的软件的时候花费了我好大的时间和

精力。所以在设置/etc/hosts文件中要把:

127.0.0.1 localhost.localdomain localhost

加上在文件中。

这样就解决了上面的问题。

 

4~ 在编译软件的过程中可能会出现这种情况

faild to handshke with mpd on node1;recol output={}

 

这时候所采取的方式如下所示:

 

mpd.conf(or .mpd.conf) this file is used to make the

communications among cluster nodes more seccure.To ensure that

comouters within the same cluster can communicate with each

other,each machine must hace the same secret word.If the secrt

word does not math .you will receive a handle_mpd_output error

(e.g.faild to handshke with mpd on <node name>;recol output={})

所以只要把多个机器上的/etc/mpd.conf 的secretword设置为相同就OK

了。

 

3 在进行并行程序的时候,要使得程序运行的话需要把两个文件都放置

在相同的目录下,并且文件相同,通过MPICC把文件进行编译,最后通过

mpdboot -n 2 -f /root/mpd.hosts

mpdtrace -l

mpiecec -n 2 /usr/local/mpich2-1.0.8.p1/examples/icpi

就可以了,具体过称如下:

[root@node1 examples]# mpdboot -n 2 -f /root/mpd.hosts
[root@node1 examples]# mpdtrace -l
node1_51018 (202.38.214.200)
node2_35310 (202.38.214.201)
[root@node1 examples]# mpiexec -n 2 ./icpi
Enter the number of intervals: (0 quits) 100000000
pi is approximately 3.1415926535900001, Error is

0.0000000000002069
wall clock time = 1.852182
Enter the number of intervals: (0 quits) exit
No number entered; quitting
[root@node1 examples]# vi /root/mpd.hosts
[root@node1 examples]# cat /root/mpd.hosts
node1
#node2
[root@node1 examples]# mpdallexit
[root@node1 examples]# mpdboot -n 1 -f /root/mpd.hosts
[root@node1 examples]# mpdtrace -l
node1_59844 (202.38.214.200)
[root@node1 examples]# mpiexec -n 1 ./icpi
Enter the number of intervals: (0 quits) 100000000
pi is approximately 3.1415926535902345, Error is

0.0000000000004414
wall clock time = 3.824297
Enter the number of intervals: (0 quits) exit
No number entered; quitting
[root@node1 examples]# mpdallexit
[root@node1 examples]#

 

这样就可以看到采用一台机器和采用两台机器所得到的计算效果是不同

的。

 

呵呵总算是吧并行计算的平台搭建了起来,虽然在这搭建的过程中走过

了很多的弯路,不过最总还是得到了自己想要的,通过这差不过大半个

月的时间的学习,得到了一点就是在你做事情感到最困难最不容易前进

的时候,一定不要放弃,一定要坚持下去,不断地去探索和寻找解决的

方法,总有一个方式或方法会被你找到。

原创粉丝点击