博客园  :: 首页  :: 联系 :: 订阅 订阅  :: 管理

〖转〗Linux RedHat 9.0 安装配置、搭建并行环境MPI

Posted on 2006-07-20 05:13  ╁蓝驿┲→  阅读(1867)  评论(0编辑  收藏  举报

一、RedHat9.0 Linux 安装配置要点
1. 硬盘分区
􀂄 Swap 分区:容量一般取为机器内存的2 倍较合适
􀂄 根分区(即/分区):挂接点为“/”,容量取2-5G 为宜
2. 安装组件包
􀂄 “工程与科学”中的LAM 包一定要选上
􀂄 “开发工具”包要选择
􀂄 网络方面要选择FTP 服务器、Telnet 服务器等
3. 安全级别(相当于防火墙,也可以安装后再设置,菜单“系统设置”-“安全级别”)
􀂄 要允许使用SSH、FTP、Telnet 等服务
4. 关于libaio-devel 包的手工安装
􀂄 插入第二张光盘,其中包含文件RedHat/RPMS/libaio-devel-0.3.93-4.i386.rpm(如
果没有光盘,也可以将此文件复制到硬盘上,以便下一步安装)
􀂄 安装包文件,即输入命令
rpm –ivh /mnt/cdrom/libaio-devel-0.3.93-4.i386.rpm
5. 常用linux 命令
􀂄 添加用户wyx 并设置口令为wyxabc(需要root 权限)
adduser wyx
passwd wyxabc
􀂄 文件复制(cp)、删除(rm)、移动或改名(mv)
􀂄 目录创建(mkdir)、删除(rm)、改名(mv)
􀂄 以当前用户身份登录到主机home103 及退出
ssh home103
exit
􀂄 重启系统
reboot
6. 为集群内的所有计算机建立主机名(hostname)列表。方法是:在Xwindows 下的菜单“系
统设置”-“网络”中为所有主机逐一添加主机名项
二、LAM-MPI 的使用
1. 【必需】书写HOSTS 配置文件,文件名可以任意取(以下假定文件名为hfile)。文件
内容示例如下:
home101
home102
home105
home107
2. 【可选】测试HOSTS 文件是否可用
recon –v hfile (hfile指hosts)
3. 【必需】以HOSTS 配置启动LAM 环境
lamboot –v hfile
4. 【可选】如果MPI 应用程序尚未编译,则使用mpicc、mpiCC、mpif77 等命令对源文
件进行编译,例如:
C语言 :mpicc –o first first.c
Fortran语言:mpif77 –o first –I/usr/include first.for (指定mpif.h的路径)
凡用到math.h的程序,编译时应加上“-lm”(意思是:link math.h),如:
              Mpicc –o jacobi –lm jacobi.c
5. 【必需】将目标MPI 应用程序分发到参与并行计算的多个计算机节点上(即HOSTS 文
件中指定的那些机器),例如:
scp first wyx@home102:~/prog/.
scp first wyx@home105:~/prog/.
scp first wyx@home107:~/prog/.
6. 【必需】运行MPI 程序
mpirun –np 4 first
7. 【必需】退出LAM 环境
lamhalt
备注
为避免用户在运行MPI 程序访问其他主机时频繁询问帐号密码的问题,可以进行如下“放
权”配置。一旦配置完成后,以后访问其他主机时将不再询问帐号,从而可以直接使用其资
源。
1. 在每一个节点上,以普通身份登录重复执行下列过程
[wyx@home101 wyx]$ ssh-keygen -t dsa
Generating public/private dsa key pair.
Enter file in which to save the key (/home/wyx/.ssh/id_dsa): 直接回车
Enter passphrase (empty for no passphrase): 可以输入,但最好直接回车免得麻烦
Enter same passphrase again: 直接回车
Your identification has been saved in /home/wyx/.ssh/id_dsa. 私钥
Your public key has been saved in /home/wyx/.ssh/id_dsa.pub. 公钥
The key fingerprint is:
ab:d6:d3:47:31:20:6e:f8:7d:e5:6b:cb:72:34:9c:42 chy@hpc5
2. 每个机器上的id_dsa.pub 内容都是一行,把各台机器上的id_dsa.pub 全部合并到一个
文件中(各占一行),另存为 authorized_keys 文件,该文件位于$HOME/.ssh 目录下,
并将该文件分布到所有的节点上。
三、mpi主要资源
MPI函数手册页
  http://www.mpi-forum.org/docs/mpi-11-html/node182.html#Node182
MPI程序设计练习循序渐进
  http://www-unix.mcs.anl.gov/mpi/tutorial/mpiexmpl/contents.html

主要的MPI主页及MPI标准
http://www.mpi-forum.org MPIF主页
http://www.mcs.anl.gov/mpi MPI主页
http://www.netlib.org/mpi/index.html netlib上的MPI站点

MPI的实现
http://www-unix.mcs.anl.gov/mpi/mpich/ ANL/MSU实现的MPICH主页
http://www.mcs.anl.gov/mpi/mpich MPICH实现
ftp://ftp.mcs.anl.gov/pub/mpi MPICH实现
http://www.erc.msstate.edu/misc/mpi/ 其它的MPI实现
http://www.lsc.nd.edu/MPI2 MPI实现列表
http://www.erc.msstate.edu/mpi MSU的MPI项目
http://www.mpi.nd.edu/lam/ LAM的MPI
http://www.lam-mpi.org/

关于MPI的文档、讨论与例子
http://www-unix.mcs.anl.gov/mpi/tutorial/ MPI相关材料
http://www.erc.msstate.edu/mpi/mpi-faq.html 常见问题
http://www-unix.mcs.anl.gov/mpi/mpich/faq.html 常见问题解答
http://www.mpi-forum.org/docs 勘误
http://www.erc.msstate.edu/misc/mpi/resources.html 关于MPI的新闻组
ftp://ftp.mpi-forum.org/pub/docs/ MPI文挡
http://www.mcs.anl.gov/mpi/usingmpi MPI教程
http://www.mcs.anl.gov/mpi/usingmpi2 MPI教程
ftp://ftp.mcs.anl.gov/pub/mpi/using/examples MPI例子程序
ftp://ftp.mcs.anl.gov/pub/mpi/using2/examples MPI例子程序
http://www-unix.mcs.anl.gov/mpi/tutorial/mpiexmpl/contents.html MPI例子程序

One-step Tutorial: MPI: It's easy to get started
http://www.lam-mpi.org/tutorials/one-step/ezstart.php

http://www-unix.mcs.anl.gov/mpi/tutorial/mpiexmpl/src/hellow/C/main.html

http://www.huihoo.org/npact/mpiindex.htm
四、Running on a LINUX Workstation Cluster
To run FLUENT on a network of LINUX workstations, type the usual startup command
without a version (i.e., fluent), and then use the Select Solver panel (Figure 30.2.1) to
specify the parallel architecture and version information.
File 􀀀!Run...
1. Under Versions, specify the 3D or 2D single- or double-precision version by turning
the 3D and Double Precision options on or off, and turn on the Parallel option.
2. Under Options, select the Socket message-passing library in the Communicator dropdown
list.
When you start ! the parallel network version, you must select Socket or Network
MPI (MPICH) in the Communicator drop-down list, unless the vendor MPI library
(described earlier in this section) supports clustering. If you keep the Default option,
one of the MPI parallel versions will start instead, and you will be unable to spawn
additional compute nodes.
3. Set the number of initial compute node processes to spawn on the host machine in
the Processes field. You can start with 1 or 0 nodes and spawn the rest later on, as
described in Section fluent help 30.3.1.
4. (optional) Specify the name of a fiele containing a list of machines, one per line, in
the Hosts File eld. If the number of Processes is set to 0, FLUENT will spawn a
compute node on each machine listed in the file.
5. Click the Run button to start the parallel network version.
If you prefer to start the parallel network version from the command line, you can type
fluent version -t1 -pnet
(to use the socket communicator) or
fluent version -t1 -pnmpi
(to use the network MPI communicator) to start the solver with 1 compute node on the
host workstation. You can then spawn additional processes on remote workstations using the Network Confguration panel, as described in Section 30.3.1.
You can type
fluent version -t0 -pnet [-cnf=hostsfile]
(to use the socket communicator) or
fluent version -t0 -pnmpi [-cnf=hostsfile]
(to use the network MPI communicator) to start a host process that controls compute
nodes situated on remote machines. If the optional -cnf=hostsfile is specified, a compute node will be spawned on each machine listed in the file hostsfile. (If you enter this optional argument, do not include the square brackets.) Otherwise, you can spawn the processes as described in Section 30.3.1.

gale0003 编辑于 2006-01-13 11:28