MPICH2安裝使用簡記

來源:互聯網
上載者:User
文章目錄
  • 安裝
安裝

1 到MPICH官方網站下載原始碼包,解壓縮

#tar -zxvf mpich2-1.0.8.tar.gz

2 進入mpich2解壓目錄

#cd mpich2-1.0.8

3 設定安裝目錄

#./configure --prefix=/usr/loca/mpich

4 編譯

#make

5 安裝

#make install

6 修改PATH環境變數

   PATH="$PATH:/usr/local/mpich/bin" 

7  測試環境變數設定

#which mpd

#which mpicc

#which mpiexec

#which mpirun

所有以上的命令都應該指向安裝目錄的bin子目錄。此外,如果沒有用NFS來共用安裝目錄,則需要將bin子目錄拷貝到其他每台機器上。

8 修改/etc/mpd.conf檔案,內容為secretword=myword

#vi /etc/mpd.conf

設定檔案讀取許可權為只有自己能讀寫

#chmod 600 /etc/mpd.conf

非root使用者在家目錄建立內容相同的.mpd.conf

9 建立主機名稱集合檔案/root/mpd.hosts

#vi mpd.hosts

檔案內容如下:

station1

station3

station6

station8

 

使用

MPICH2採用mpd服務來對進程進行管理,使用mpiexec運行mpi程式。

 

MPD

啟動單機上的mpd服務

# mpd &

查看mpd服務

# mpdtrace  查看主機名稱

#mpdtrace –l  查看主機名稱和連接埠號碼

關閉mpd進程管理

#mpdallexit

 

啟動叢集上的mpd服務

# mpdboot –n process-num –f  mpd.hosts

啟動 process-num個進程,mpd.hosts是前面建立的檔案。

mpich2預設是使用ssh來登陸叢集裡的其他機器,也可以使用rsh來登陸叢集裡的其他機器來啟動mpd服務

只要使用-rsh選項就可以指定用ssh或rsh

#mpdboot -rsh=rsh –n process-num –f  hostfile

或#mpdboot -rsh=ssh –n process-num –f  hostfile

關閉mpd服務

#mpdallexit

 

mpiexec

使用MPIEXEC來執行mpi任務

 

#mpiexec –np 3  ./cpi

或mpiexec –machinefile filename –np 4 ./cpi

 

在PBS任務管理系統中使用MPICH

只要將

sort -u $PBS_NODEFILE > mpd.hosts
mpdboot -f mpd.hosts -n $NNODES --rsh=/usr/bin/rsh
mpiexec -machinefile $PBS_NODEFILE -np $NNODES $RUNJOB -i $WORK_AREA/$PREFILE/$PREFILE.in -dim 2 -n 100000 -d 10000 > $PREFILE.log
mpdallexit
寫入pbs的script中就可以了
實際上包含了一個完整使用叢集的過程,只不過是提交給了任務管理系統PBS而已。

 

MPD in the PBS environment

PBS specifies the machines allocated to a particular job in the file $PBS NODEFILE.
But the format used by PBS is different from that of MPD. Specifically, PBS
lists each node on a single line; if a node (n0) has two processors, it is listed
twice. MPD on the other hand uses an identifier (ncpus) to describe how
many processors a node has. So, if n0 has two processors, it is listed as n0:2.
One way to convert the node file to the MPD format is as follows:
sort $PBS NODEFILE | uniq -C | awk ’{ printf(”%s:%s”, $2, $1); }’ >
mpd.nodes
Once the PBS node file is converted, MPD can be normally started
within the PBS job script using mpdboot and torn down using mpdallexit.

mpdboot -f mpd.hosts -n [NUM NODES REQUESTED]
mpiexec -n [NUM PROCESSES] ./my test program
mpdallexit

一些問題

1. 我們的叢集上有兩套網路,一個是百兆的一個是千兆的,mpich2是採用什麼那個一來進行資訊交換的?

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.