个人工具
登录
查看“UbuntuHelp:MpichCluster”的源代码 - Ubuntu中文
UbuntuHelp
讨论
查看源代码
历史
搜索
导航
首页
最近更改
随机页面
页面分类
帮助
编辑
编辑指南
沙盒
新闻动态
字词处理
工具
链入页面
相关更改
特殊页面
页面信息
查看“UbuntuHelp:MpichCluster”的源代码
来自Ubuntu中文
←
UbuntuHelp:MpichCluster
跳转至:
导航
,
搜索
因为以下原因,你没有权限编辑本页:
您所请求的操作仅限于该用户组的用户使用:
用户
您可以查看与复制此页面的源代码。
{{From|https://help.ubuntu.com/community/MpichCluster}} {{Languages|UbuntuHelp:MpichCluster}} == Setting Up an MPICH2 Cluster in Ubuntu == Creator: '''[[UbuntuHelp:OmidAlemi| Omid Alemi]]''' omid.alemi@gmail.com This guide describes how to building a simple MPICH cluster in ubuntu. Before , you need an basic knowledge about mpich & clustering. Here we have 4 nodes running ubuntu 7.04 with these host names: ub0,ub1,ub2,ub3; === 1. Defining hostnames in etc/hosts/ === Edit /etc/hosts like these: <pre><nowiki> 127.0.0.1 localhost 192.168.133.100 ub0 192.168.133.101 ub1 192.168.133.102 ub2 192.168.133.103 ub3 </nowiki></pre> Note that the file shouldn't be like this: <pre><nowiki> 127.0.0.1 localhost 127.0.1.1 ub0 192.168.133.100 ub0 192.168.133.101 ub1 192.168.133.102 ub2 192.168.133.103 ub3 </nowiki></pre> === 2. Installing NFS === To Install NFS just run this in terminal: <pre><nowiki> omid@ub0:~$ sudo apt-get install nfs-kernel-server </nowiki></pre> === 3. Sharing Master Folder === Make a folder in all nodes, we'll store our data and programs in this folder. <pre><nowiki> omid@ub0:~$ sudo mkdir /mirror </nowiki></pre> And then we share it over nodes on the master node. <pre><nowiki> omid@ub0:~$ sudo echo /mirror *(rw,sync) >> /etc/exports </nowiki></pre> Note than we store out data and programs only in master node and other nodes will access them with NFS. === 4. Mounting /master in nodes === <pre><nowiki> omid@ub1:~$sudo mount ub0:/mirror /mirror omid@ub2:~$sudo mount ub0:/mirror /mirror omid@ub3:~$sudo mount ub0:/mirror /mirror </nowiki></pre> it's better to change fstab in order to mount it on every boot. === 5. Defining a user for running MPI programs === We define a user with same name and same userid in all nodes with a home directory in /mirror. Here we name it "mpiu"! Also we change the owner of /mirror to mpiu: <pre><nowiki> omid@ub0:~$ sudo chown mpiu /mirror </nowiki></pre> === 6. Installing SSH Server === Run this command in all nodes in order to install OpenSSH Server <pre><nowiki> omid@ub0:~$ sudo apt-get install opensshserver </nowiki></pre> === 7. Setting up SSH with no pass phrase for communication between nodes === First we login with our new user: <pre><nowiki> omid@ub0:~$ su - mpiu </nowiki></pre> Then we generate DSA key for mpiu: <pre><nowiki> mpiu@ub0:~$ ssh-keygen -t dsa </nowiki></pre> Leave passphrase empty. Next we add this key to authorized keys: <pre><nowiki> mpiu@ub0:~$ cd .ssh mpiu@ub0:~/.ssh$ cat id_pub.dsa >> authorized_keys </nowiki></pre> As the home directory of mpiu in all nodes is the same (/mirror/mpiu) , there is no need to run these commands on all nodes. To test SSH run: <pre><nowiki> mpiu@ub0:~$ ssh ub1 hostname </nowiki></pre> It should return remote hostname without asking for passphrase. === 8. Installing GCC === Install build-essential package: <pre><nowiki> mpiu@ub0:~$ sudo apt-get install build-essential </nowiki></pre> === 9.Installing Other Compilers === Other prefered compilers should be installed before installing MPICH. In this step we install other compilers such as Inter Fortran, SGI compiler , ... . === 10. Installing MPICH2 === Download MPICH2 source code from http://www-unix.mcs.anl.gov/mpi/mpich . Extract .tar.bz2 file in /mirror. Also make a folder for MPICH installation. <pre><nowiki> mpiu@ub3:/mirror$ mkidr mpich2 mpiu@ub3:/mirror$ tar xvf mpich2-1.0.5p3.tar.gz mpiu@ub3:/mirror$ cd mpich2-1.0.5p3 mpiu@ub3:/mirror/mpich2-1.0.5p3$ ./configure --prefix=/mirror/mpich2 mpiu@ub3:/mirror/mpich2-1.0.5p3$ make mpiu@ub3:/mirror/mpich2-1.0.5p3$ sudo make install </nowiki></pre> For more information about compilation see README file in source package. After successfully compiling and installing mpich, add these lines to "/mirror/mpiu/.bashrc/" <pre><nowiki> export PATH=/mirror/mpich2/bin:$PATH export PATH LD_LIBRARY_PATH="/mirror/mpich2/lib:$LD_LIBRARY_PATH" export LD_LIBRARY_PATH </nowiki></pre> Next we run this command in order to define MPICH installation path to SSH. <pre><nowiki> mpiu@ub0:~$ sudo echo /mirror/mpich2/bin >> /etc/environment </nowiki></pre> For testing our installation run: <pre><nowiki> mpiu@ub0:~$ which mpd mpiu@ub0:~$ which mpiexec mpiu@ub0:~$ which mpirun </nowiki></pre> === 11. setting up MPD === Create mpd.hosts in mpiu's home directory with nodes names: <pre><nowiki> ub3 ub2 ub1 ub0 </nowiki></pre> and run : <pre><nowiki> mpiu@ub0:~$ echo secretword=something >> ~/.mpd.conf mpiu@ub0:~$ chmod 600 .mpd.conf </nowiki></pre> To test MPD run above commands. The output should be the current hostname. <pre><nowiki> mpiu@ub0:~$ mpd & mpiu@ub0:~$ mpdtrace mpiu@ub0:~$ mpdallexit </nowiki></pre> After all run mpd daemon: <pre><nowiki> mpiu@ub0:~$ mpdboot -np 4 mpiu@ub0:~$ mpdtrace </nowiki></pre> The output should be name of all nodes. There are some examples in "mpich2-1.0.5/examples", we'll run one : <pre><nowiki> mpiu@ub0:~$ mpiexec -n 4 cpi </nowiki></pre> That's it! ------ For more information visit: http://www-unix.mcs.anl.gov/mpi/mpich/ [[category:UbuntuHelp]]
该页面使用的模板:
模板:From
(
查看源代码
)
模板:Languages
(
查看源代码
)(受保护)
模板:Languages/Lang
(
查看源代码
)(受保护)
返回至
UbuntuHelp:MpichCluster
。