特殊:Badtitle/NS100:MPICHCluster:修订间差异
小 新页面: {{From|https://help.ubuntu.com/community/MPICHCluster}} {{Languages|UbuntuHelp:MPICHCluster}} == Setting Up an MPICH2 Cluster in Ubuntu == Creator: '''[[UbuntuHelp:OmidAlemi| Omid Alemi... |
小无编辑摘要 |
||
第2行: | 第2行: | ||
{{Languages|UbuntuHelp:MPICHCluster}} | {{Languages|UbuntuHelp:MPICHCluster}} | ||
== Setting Up an MPICH2 Cluster in Ubuntu == | == Setting Up an MPICH2 Cluster in Ubuntu == | ||
Creator: '''[[UbuntuHelp:OmidAlemi| Omid Alemi]]''' | Creator: '''[[UbuntuHelp:OmidAlemi| Omid Alemi]]''' | ||
This guide describes how to building a simple MPICH cluster in ubuntu. | This guide describes how to building a simple MPICH cluster in ubuntu. | ||
Before , you need an basic knowledge about mpich & clustering. | 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; | Here we have 4 nodes running ubuntu 7.04 with these host names: ub0,ub1,ub2,ub3; | ||
=== 1. Defining hostnames in etc/hosts/ === | === 1. Defining hostnames in etc/hosts/ === | ||
Edit /etc/hosts like these: | Edit /etc/hosts like these: | ||
<pre><nowiki> | <pre><nowiki> | ||
127.0.0.1 localhost | 127.0.0.1 localhost | ||
第28行: | 第16行: | ||
192.168.133.103 ub3 | 192.168.133.103 ub3 | ||
</nowiki></pre> | </nowiki></pre> | ||
Note that the file shouldn't be like this: | Note that the file shouldn't be like this: | ||
<pre><nowiki> | <pre><nowiki> | ||
127.0.0.1 localhost | 127.0.0.1 localhost | ||
第41行: | 第25行: | ||
192.168.133.103 ub3 | 192.168.133.103 ub3 | ||
</nowiki></pre> | </nowiki></pre> | ||
=== 2. Installing NFS === | === 2. Installing NFS === | ||
To Install NFS just run this in terminal: | To Install NFS just run this in terminal: | ||
<pre><nowiki> | <pre><nowiki> | ||
omid@ub0:~$ sudo apt-get install nfs-kernel-server | omid@ub0:~$ sudo apt-get install nfs-kernel-server | ||
</nowiki></pre> | </nowiki></pre> | ||
=== 3. Sharing Master Folder === | === 3. Sharing Master Folder === | ||
Make a folder in all nodes, we'll store our data and programs in this folder. | Make a folder in all nodes, we'll store our data and programs in this folder. | ||
<pre><nowiki> | <pre><nowiki> | ||
omid@ub0:~$ sudo mkdir /mirror | omid@ub0:~$ sudo mkdir /mirror | ||
</nowiki></pre> | </nowiki></pre> | ||
And then we share it over nodes on the master node. | And then we share it over nodes on the master node. | ||
<pre><nowiki> | <pre><nowiki> | ||
omid@ub0:~$ sudo echo /mirror *(rw,sync) >> /etc/exports | omid@ub0:~$ sudo echo /mirror *(rw,sync) >> /etc/exports | ||
</nowiki></pre> | </nowiki></pre> | ||
Note than we store out data and programs only in master node and other nodes will access them with NFS. | 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 === | === 4. Mounting /master in nodes === | ||
<pre><nowiki> | <pre><nowiki> | ||
omid@ub1:~$sudo mount ub0:/mirror /mirror | omid@ub1:~$sudo mount ub0:/mirror /mirror | ||
第79行: | 第46行: | ||
omid@ub3:~$sudo mount ub0:/mirror /mirror | omid@ub3:~$sudo mount ub0:/mirror /mirror | ||
</nowiki></pre> | </nowiki></pre> | ||
it's better to change fstab in order to mount it on every boot. | it's better to change fstab in order to mount it on every boot. | ||
=== 5. Defining a user for running MPI programs === | === 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. | 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: | Here we name it "mpiu"! Also we change the owner of /mirror to mpiu: | ||
<pre><nowiki> | <pre><nowiki> | ||
omid@ub0:~$ sudo chown mpiu /mirror | omid@ub0:~$ sudo chown mpiu /mirror | ||
</nowiki></pre> | </nowiki></pre> | ||
=== 6. Installing SSH Server === | === 6. Installing SSH Server === | ||
Run this command in all nodes in order to install OpenSSH Server | Run this command in all nodes in order to install OpenSSH Server | ||
<pre><nowiki> | <pre><nowiki> | ||
omid@ub0:~$ sudo apt-get install opensshserver | omid@ub0:~$ sudo apt-get install opensshserver | ||
</nowiki></pre> | </nowiki></pre> | ||
=== 7. Setting up SSH with no pass phrase for communication between nodes === | === 7. Setting up SSH with no pass phrase for communication between nodes === | ||
First we login with our new user: | First we login with our new user: | ||
<pre><nowiki> | <pre><nowiki> | ||
omid@ub0:~$ su - mpiu | omid@ub0:~$ su - mpiu | ||
</nowiki></pre> | </nowiki></pre> | ||
Then we generate DSA key for mpiu: | Then we generate DSA key for mpiu: | ||
<pre><nowiki> | <pre><nowiki> | ||
mpiu@ub0:~$ ssh-keygen -t dsa | mpiu@ub0:~$ ssh-keygen -t dsa | ||
</nowiki></pre> | </nowiki></pre> | ||
Leave passphrase empty. | Leave passphrase empty. | ||
Next we add this key to authorized keys: | Next we add this key to authorized keys: | ||
<pre><nowiki> | <pre><nowiki> | ||
mpiu@ub0:~$ cd .ssh | mpiu@ub0:~$ cd .ssh | ||
mpiu@ub0:~/.ssh$ cat id_pub.dsa >> authorized_keys | mpiu@ub0:~/.ssh$ cat id_pub.dsa >> authorized_keys | ||
</nowiki></pre> | </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. | 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: | To test SSH run: | ||
<pre><nowiki> | <pre><nowiki> | ||
mpiu@ub0:~$ ssh ub1 hostname | mpiu@ub0:~$ ssh ub1 hostname | ||
</nowiki></pre> | </nowiki></pre> | ||
It should return remote hostname without asking for passphrase. | It should return remote hostname without asking for passphrase. | ||
=== 8. Installing GCC === | === 8. Installing GCC === | ||
Install build-essential package: | Install build-essential package: | ||
<pre><nowiki> | <pre><nowiki> | ||
mpiu@ub0:~$ sudo apt-get install build-essential | mpiu@ub0:~$ sudo apt-get install build-essential | ||
</nowiki></pre> | </nowiki></pre> | ||
=== 9.Installing Other Compilers === | === 9.Installing Other Compilers === | ||
Other prefered compilers should be installed before installing MPICH. | Other prefered compilers should be installed before installing MPICH. | ||
In this step we install other compilers such as Inter Fortran, SGI compiler , ... . | In this step we install other compilers such as Inter Fortran, SGI compiler , ... . | ||
=== 10. Installing MPICH2 === | === 10. Installing MPICH2 === | ||
Download MPICH2 source code from http://www-unix.mcs.anl.gov/mpi/mpich . | 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. | Extract .tar.bz2 file in /mirror. Also make a folder for MPICH installation. | ||
<pre><nowiki> | <pre><nowiki> | ||
mpiu@ub3:/mirror$ mkidr mpich2 | mpiu@ub3:/mirror$ mkidr mpich2 | ||
第171行: | 第98行: | ||
mpiu@ub3:/mirror/mpich2-1.0.5p3$ sudo make install | mpiu@ub3:/mirror/mpich2-1.0.5p3$ sudo make install | ||
</nowiki></pre> | </nowiki></pre> | ||
For more information about compilation see README file in source package. | For more information about compilation see README file in source package. | ||
After successfully compiling and installing mpich, add these lines to "/mirror/mpiu/.bashrc/" | After successfully compiling and installing mpich, add these lines to "/mirror/mpiu/.bashrc/" | ||
<pre><nowiki> | <pre><nowiki> | ||
export PATH=/mirror/mpich2/bin:$PATH | export PATH=/mirror/mpich2/bin:$PATH | ||
第183行: | 第106行: | ||
export LD_LIBRARY_PATH | export LD_LIBRARY_PATH | ||
</nowiki></pre> | </nowiki></pre> | ||
Next we run this command in order to define MPICH installation path to SSH. | Next we run this command in order to define MPICH installation path to SSH. | ||
<pre><nowiki> | <pre><nowiki> | ||
mpiu@ub0:~$ sudo echo /mirror/mpich2/bin >> /etc/environment | mpiu@ub0:~$ sudo echo /mirror/mpich2/bin >> /etc/environment | ||
</nowiki></pre> | </nowiki></pre> | ||
For testing our installation run: | For testing our installation run: | ||
<pre><nowiki> | <pre><nowiki> | ||
mpiu@ub0:~$ which mpd | mpiu@ub0:~$ which mpd | ||
第199行: | 第116行: | ||
mpiu@ub0:~$ which mpirun | mpiu@ub0:~$ which mpirun | ||
</nowiki></pre> | </nowiki></pre> | ||
=== 11. setting up MPD === | === 11. setting up MPD === | ||
Create mpd.hosts in mpiu's home directory with nodes names: | Create mpd.hosts in mpiu's home directory with nodes names: | ||
<pre><nowiki> | <pre><nowiki> | ||
ub3 | ub3 | ||
第212行: | 第124行: | ||
ub0 | ub0 | ||
</nowiki></pre> | </nowiki></pre> | ||
and run : | and run : | ||
<pre><nowiki> | <pre><nowiki> | ||
mpiu@ub0:~$ echo secretword=something >> ~/.mpd.conf | mpiu@ub0:~$ echo secretword=something >> ~/.mpd.conf | ||
mpiu@ub0:~$ chmod 600 .mpd.conf | mpiu@ub0:~$ chmod 600 .mpd.conf | ||
</nowiki></pre> | </nowiki></pre> | ||
To test MPD run above commands. The output should be the current hostname. | To test MPD run above commands. The output should be the current hostname. | ||
<pre><nowiki> | <pre><nowiki> | ||
mpiu@ub0:~$ mpd & | mpiu@ub0:~$ mpd & | ||
第229行: | 第135行: | ||
mpiu@ub0:~$ mpdallexit | mpiu@ub0:~$ mpdallexit | ||
</nowiki></pre> | </nowiki></pre> | ||
After all run mpd daemon: | After all run mpd daemon: | ||
<pre><nowiki> | <pre><nowiki> | ||
mpiu@ub0:~$ mpdboot -np 4 | mpiu@ub0:~$ mpdboot -np 4 | ||
mpiu@ub0:~$ mpdtrace | mpiu@ub0:~$ mpdtrace | ||
</nowiki></pre> | </nowiki></pre> | ||
The output should be name of all nodes. | The output should be name of all nodes. | ||
There are some examples in "mpich2-1.0.5/examples", we'll run one : | There are some examples in "mpich2-1.0.5/examples", we'll run one : | ||
<pre><nowiki> | <pre><nowiki> | ||
mpiu@ub0:~$ mpiexec -n 4 cpi | mpiu@ub0:~$ mpiexec -n 4 cpi | ||
</nowiki></pre> | </nowiki></pre> | ||
That's it! | That's it! | ||
------ | ------ | ||
For more information visit: | For more information visit: | ||
http://www-unix.mcs.anl.gov/mpi/mpich/ | http://www-unix.mcs.anl.gov/mpi/mpich/ | ||
[[category:UbuntuHelp]] | [[category:UbuntuHelp]] |
2007年11月30日 (五) 20:21的最新版本
文章出处: |
{{#if: | {{{2}}} | https://help.ubuntu.com/community/MPICHCluster }} |
点击翻译: |
English {{#ifexist: {{#if: UbuntuHelp:MPICHCluster | UbuntuHelp:MPICHCluster | {{#if: | :}}MPICHCluster}}/af | • {{#if: UbuntuHelp:MPICHCluster|Afrikaans| [[::MPICHCluster/af|Afrikaans]]}}|}} {{#ifexist: {{#if: UbuntuHelp:MPICHCluster | UbuntuHelp:MPICHCluster | {{#if: | :}}MPICHCluster}}/ar | • {{#if: UbuntuHelp:MPICHCluster|العربية| [[::MPICHCluster/ar|العربية]]}}|}} {{#ifexist: {{#if: UbuntuHelp:MPICHCluster | UbuntuHelp:MPICHCluster | {{#if: | :}}MPICHCluster}}/az | • {{#if: UbuntuHelp:MPICHCluster|azərbaycanca| [[::MPICHCluster/az|azərbaycanca]]}}|}} {{#ifexist: {{#if: UbuntuHelp:MPICHCluster | UbuntuHelp:MPICHCluster | {{#if: | :}}MPICHCluster}}/bcc | • {{#if: UbuntuHelp:MPICHCluster|جهلسری بلوچی| [[::MPICHCluster/bcc|جهلسری بلوچی]]}}|}} {{#ifexist: {{#if: UbuntuHelp:MPICHCluster | UbuntuHelp:MPICHCluster | {{#if: | :}}MPICHCluster}}/bg | • {{#if: UbuntuHelp:MPICHCluster|български| [[::MPICHCluster/bg|български]]}}|}} {{#ifexist: {{#if: UbuntuHelp:MPICHCluster | UbuntuHelp:MPICHCluster | {{#if: | :}}MPICHCluster}}/br | • {{#if: UbuntuHelp:MPICHCluster|brezhoneg| [[::MPICHCluster/br|brezhoneg]]}}|}} {{#ifexist: {{#if: UbuntuHelp:MPICHCluster | UbuntuHelp:MPICHCluster | {{#if: | :}}MPICHCluster}}/ca | • {{#if: UbuntuHelp:MPICHCluster|català| [[::MPICHCluster/ca|català]]}}|}} {{#ifexist: {{#if: UbuntuHelp:MPICHCluster | UbuntuHelp:MPICHCluster | {{#if: | :}}MPICHCluster}}/cs | • {{#if: UbuntuHelp:MPICHCluster|čeština| [[::MPICHCluster/cs|čeština]]}}|}} {{#ifexist: {{#if: UbuntuHelp:MPICHCluster | UbuntuHelp:MPICHCluster | {{#if: | :}}MPICHCluster}}/de | • {{#if: UbuntuHelp:MPICHCluster|Deutsch| [[::MPICHCluster/de|Deutsch]]}}|}} {{#ifexist: {{#if: UbuntuHelp:MPICHCluster | UbuntuHelp:MPICHCluster | {{#if: | :}}MPICHCluster}}/el | • {{#if: UbuntuHelp:MPICHCluster|Ελληνικά| [[::MPICHCluster/el|Ελληνικά]]}}|}} {{#ifexist: {{#if: UbuntuHelp:MPICHCluster | UbuntuHelp:MPICHCluster | {{#if: | :}}MPICHCluster}}/es | • {{#if: UbuntuHelp:MPICHCluster|español| [[::MPICHCluster/es|español]]}}|}} {{#ifexist: {{#if: UbuntuHelp:MPICHCluster | UbuntuHelp:MPICHCluster | {{#if: | :}}MPICHCluster}}/fa | • {{#if: UbuntuHelp:MPICHCluster|فارسی| [[::MPICHCluster/fa|فارسی]]}}|}} {{#ifexist: {{#if: UbuntuHelp:MPICHCluster | UbuntuHelp:MPICHCluster | {{#if: | :}}MPICHCluster}}/fi | • {{#if: UbuntuHelp:MPICHCluster|suomi| [[::MPICHCluster/fi|suomi]]}}|}} {{#ifexist: {{#if: UbuntuHelp:MPICHCluster | UbuntuHelp:MPICHCluster | {{#if: | :}}MPICHCluster}}/fr | • {{#if: UbuntuHelp:MPICHCluster|français| [[::MPICHCluster/fr|français]]}}|}} {{#ifexist: {{#if: UbuntuHelp:MPICHCluster | UbuntuHelp:MPICHCluster | {{#if: | :}}MPICHCluster}}/gu | • {{#if: UbuntuHelp:MPICHCluster|ગુજરાતી| [[::MPICHCluster/gu|ગુજરાતી]]}}|}} {{#ifexist: {{#if: UbuntuHelp:MPICHCluster | UbuntuHelp:MPICHCluster | {{#if: | :}}MPICHCluster}}/he | • {{#if: UbuntuHelp:MPICHCluster|עברית| [[::MPICHCluster/he|עברית]]}}|}} {{#ifexist: {{#if: UbuntuHelp:MPICHCluster | UbuntuHelp:MPICHCluster | {{#if: | :}}MPICHCluster}}/hu | • {{#if: UbuntuHelp:MPICHCluster|magyar| [[::MPICHCluster/hu|magyar]]}}|}} {{#ifexist: {{#if: UbuntuHelp:MPICHCluster | UbuntuHelp:MPICHCluster | {{#if: | :}}MPICHCluster}}/id | • {{#if: UbuntuHelp:MPICHCluster|Bahasa Indonesia| [[::MPICHCluster/id|Bahasa Indonesia]]}}|}} {{#ifexist: {{#if: UbuntuHelp:MPICHCluster | UbuntuHelp:MPICHCluster | {{#if: | :}}MPICHCluster}}/it | • {{#if: UbuntuHelp:MPICHCluster|italiano| [[::MPICHCluster/it|italiano]]}}|}} {{#ifexist: {{#if: UbuntuHelp:MPICHCluster | UbuntuHelp:MPICHCluster | {{#if: | :}}MPICHCluster}}/ja | • {{#if: UbuntuHelp:MPICHCluster|日本語| [[::MPICHCluster/ja|日本語]]}}|}} {{#ifexist: {{#if: UbuntuHelp:MPICHCluster | UbuntuHelp:MPICHCluster | {{#if: | :}}MPICHCluster}}/ko | • {{#if: UbuntuHelp:MPICHCluster|한국어| [[::MPICHCluster/ko|한국어]]}}|}} {{#ifexist: {{#if: UbuntuHelp:MPICHCluster | UbuntuHelp:MPICHCluster | {{#if: | :}}MPICHCluster}}/ksh | • {{#if: UbuntuHelp:MPICHCluster|Ripoarisch| [[::MPICHCluster/ksh|Ripoarisch]]}}|}} {{#ifexist: {{#if: UbuntuHelp:MPICHCluster | UbuntuHelp:MPICHCluster | {{#if: | :}}MPICHCluster}}/mr | • {{#if: UbuntuHelp:MPICHCluster|मराठी| [[::MPICHCluster/mr|मराठी]]}}|}} {{#ifexist: {{#if: UbuntuHelp:MPICHCluster | UbuntuHelp:MPICHCluster | {{#if: | :}}MPICHCluster}}/ms | • {{#if: UbuntuHelp:MPICHCluster|Bahasa Melayu| [[::MPICHCluster/ms|Bahasa Melayu]]}}|}} {{#ifexist: {{#if: UbuntuHelp:MPICHCluster | UbuntuHelp:MPICHCluster | {{#if: | :}}MPICHCluster}}/nl | • {{#if: UbuntuHelp:MPICHCluster|Nederlands| [[::MPICHCluster/nl|Nederlands]]}}|}} {{#ifexist: {{#if: UbuntuHelp:MPICHCluster | UbuntuHelp:MPICHCluster | {{#if: | :}}MPICHCluster}}/no | • {{#if: UbuntuHelp:MPICHCluster|norsk| [[::MPICHCluster/no|norsk]]}}|}} {{#ifexist: {{#if: UbuntuHelp:MPICHCluster | UbuntuHelp:MPICHCluster | {{#if: | :}}MPICHCluster}}/oc | • {{#if: UbuntuHelp:MPICHCluster|occitan| [[::MPICHCluster/oc|occitan]]}}|}} {{#ifexist: {{#if: UbuntuHelp:MPICHCluster | UbuntuHelp:MPICHCluster | {{#if: | :}}MPICHCluster}}/pl | • {{#if: UbuntuHelp:MPICHCluster|polski| [[::MPICHCluster/pl|polski]]}}|}} {{#ifexist: {{#if: UbuntuHelp:MPICHCluster | UbuntuHelp:MPICHCluster | {{#if: | :}}MPICHCluster}}/pt | • {{#if: UbuntuHelp:MPICHCluster|português| [[::MPICHCluster/pt|português]]}}|}} {{#ifexist: {{#if: UbuntuHelp:MPICHCluster | UbuntuHelp:MPICHCluster | {{#if: | :}}MPICHCluster}}/ro | • {{#if: UbuntuHelp:MPICHCluster|română| [[::MPICHCluster/ro|română]]}}|}} {{#ifexist: {{#if: UbuntuHelp:MPICHCluster | UbuntuHelp:MPICHCluster | {{#if: | :}}MPICHCluster}}/ru | • {{#if: UbuntuHelp:MPICHCluster|русский| [[::MPICHCluster/ru|русский]]}}|}} {{#ifexist: {{#if: UbuntuHelp:MPICHCluster | UbuntuHelp:MPICHCluster | {{#if: | :}}MPICHCluster}}/si | • {{#if: UbuntuHelp:MPICHCluster|සිංහල| [[::MPICHCluster/si|සිංහල]]}}|}} {{#ifexist: {{#if: UbuntuHelp:MPICHCluster | UbuntuHelp:MPICHCluster | {{#if: | :}}MPICHCluster}}/sq | • {{#if: UbuntuHelp:MPICHCluster|shqip| [[::MPICHCluster/sq|shqip]]}}|}} {{#ifexist: {{#if: UbuntuHelp:MPICHCluster | UbuntuHelp:MPICHCluster | {{#if: | :}}MPICHCluster}}/sr | • {{#if: UbuntuHelp:MPICHCluster|српски / srpski| [[::MPICHCluster/sr|српски / srpski]]}}|}} {{#ifexist: {{#if: UbuntuHelp:MPICHCluster | UbuntuHelp:MPICHCluster | {{#if: | :}}MPICHCluster}}/sv | • {{#if: UbuntuHelp:MPICHCluster|svenska| [[::MPICHCluster/sv|svenska]]}}|}} {{#ifexist: {{#if: UbuntuHelp:MPICHCluster | UbuntuHelp:MPICHCluster | {{#if: | :}}MPICHCluster}}/th | • {{#if: UbuntuHelp:MPICHCluster|ไทย| [[::MPICHCluster/th|ไทย]]}}|}} {{#ifexist: {{#if: UbuntuHelp:MPICHCluster | UbuntuHelp:MPICHCluster | {{#if: | :}}MPICHCluster}}/tr | • {{#if: UbuntuHelp:MPICHCluster|Türkçe| [[::MPICHCluster/tr|Türkçe]]}}|}} {{#ifexist: {{#if: UbuntuHelp:MPICHCluster | UbuntuHelp:MPICHCluster | {{#if: | :}}MPICHCluster}}/vi | • {{#if: UbuntuHelp:MPICHCluster|Tiếng Việt| [[::MPICHCluster/vi|Tiếng Việt]]}}|}} {{#ifexist: {{#if: UbuntuHelp:MPICHCluster | UbuntuHelp:MPICHCluster | {{#if: | :}}MPICHCluster}}/yue | • {{#if: UbuntuHelp:MPICHCluster|粵語| [[::MPICHCluster/yue|粵語]]}}|}} {{#ifexist: {{#if: UbuntuHelp:MPICHCluster | UbuntuHelp:MPICHCluster | {{#if: | :}}MPICHCluster}}/zh | • {{#if: UbuntuHelp:MPICHCluster|中文| [[::MPICHCluster/zh|中文]]}}|}} {{#ifexist: {{#if: UbuntuHelp:MPICHCluster | UbuntuHelp:MPICHCluster | {{#if: | :}}MPICHCluster}}/zh-hans | • {{#if: UbuntuHelp:MPICHCluster|中文(简体)| [[::MPICHCluster/zh-hans|中文(简体)]]}}|}} {{#ifexist: {{#if: UbuntuHelp:MPICHCluster | UbuntuHelp:MPICHCluster | {{#if: | :}}MPICHCluster}}/zh-hant | • {{#if: UbuntuHelp:MPICHCluster|中文(繁體)| [[::MPICHCluster/zh-hant|中文(繁體)]]}}|}} |
{{#ifeq:UbuntuHelp:MPICHCluster|:MPICHCluster|请不要直接编辑翻译本页,本页将定期与来源同步。}} |
{{#ifexist: :MPICHCluster/zh | | {{#ifexist: MPICHCluster/zh | | {{#ifeq: {{#titleparts:MPICHCluster|1|-1|}} | zh | | }} }} }} {{#ifeq: {{#titleparts:MPICHCluster|1|-1|}} | zh | | }}
Setting Up an MPICH2 Cluster in Ubuntu
Creator: Omid Alemi [email protected] 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:
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
Note that the file shouldn't be like this:
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
2. Installing NFS
To Install NFS just run this in terminal:
omid@ub0:~$ sudo apt-get install nfs-kernel-server
3. Sharing Master Folder
Make a folder in all nodes, we'll store our data and programs in this folder.
omid@ub0:~$ sudo mkdir /mirror
And then we share it over nodes on the master node.
omid@ub0:~$ sudo echo /mirror *(rw,sync) >> /etc/exports
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
omid@ub1:~$sudo mount ub0:/mirror /mirror omid@ub2:~$sudo mount ub0:/mirror /mirror omid@ub3:~$sudo mount ub0:/mirror /mirror
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:
omid@ub0:~$ sudo chown mpiu /mirror
6. Installing SSH Server
Run this command in all nodes in order to install OpenSSH Server
omid@ub0:~$ sudo apt-get install opensshserver
7. Setting up SSH with no pass phrase for communication between nodes
First we login with our new user:
omid@ub0:~$ su - mpiu
Then we generate DSA key for mpiu:
mpiu@ub0:~$ ssh-keygen -t dsa
Leave passphrase empty. Next we add this key to authorized keys:
mpiu@ub0:~$ cd .ssh mpiu@ub0:~/.ssh$ cat id_pub.dsa >> authorized_keys
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:
mpiu@ub0:~$ ssh ub1 hostname
It should return remote hostname without asking for passphrase.
8. Installing GCC
Install build-essential package:
mpiu@ub0:~$ sudo apt-get install build-essential
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.
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
For more information about compilation see README file in source package. After successfully compiling and installing mpich, add these lines to "/mirror/mpiu/.bashrc/"
export PATH=/mirror/mpich2/bin:$PATH export PATH LD_LIBRARY_PATH="/mirror/mpich2/lib:$LD_LIBRARY_PATH" export LD_LIBRARY_PATH
Next we run this command in order to define MPICH installation path to SSH.
mpiu@ub0:~$ sudo echo /mirror/mpich2/bin >> /etc/environment
For testing our installation run:
mpiu@ub0:~$ which mpd mpiu@ub0:~$ which mpiexec mpiu@ub0:~$ which mpirun
11. setting up MPD
Create mpd.hosts in mpiu's home directory with nodes names:
ub3 ub2 ub1 ub0
and run :
mpiu@ub0:~$ echo secretword=something >> ~/.mpd.conf mpiu@ub0:~$ chmod 600 .mpd.conf
To test MPD run above commands. The output should be the current hostname.
mpiu@ub0:~$ mpd & mpiu@ub0:~$ mpdtrace mpiu@ub0:~$ mpdallexit
After all run mpd daemon:
mpiu@ub0:~$ mpdboot -np 4 mpiu@ub0:~$ mpdtrace
The output should be name of all nodes. There are some examples in "mpich2-1.0.5/examples", we'll run one :
mpiu@ub0:~$ mpiexec -n 4 cpi
That's it!
For more information visit: http://www-unix.mcs.anl.gov/mpi/mpich/