在使用MPI框架中,需要多機進行通信進行并行計算;現在配置多個主機進行運行mpi程式,并進行通信;涉及到ssh無密碼和nfs檔案系統配置;
參考檔案:
- https://mpitutorial.com/tutorials/running-an-mpi-cluster-within-a-lan/ 配置如何多機運行
- https://www.cnblogs.com/xuyaowen/p/git-ssh-keys.html 配置ssh 無密碼登錄
- https://www.cnblogs.com/xuyaowen/p/NFS_install.html 配置nfs 環境
多機配置步驟:
- 配置 mpi 運行環境;使用 mpich; yum install mpich-3.2; yum install mpich-3.2-devel
- 配置 mpi 運行環境;添加環境變數 $PATH
- 設定用戶;建議使用 root 用戶;
- 布置 nfs 檔案系統,并匯出指定目錄;/root/codespace/nfs
- 配置 hosts 檔案,添加 client(加入的主機),master(當前的主機)主機地址;確保ssh client 可以順利登陸;
- 配置當前master主機別名到client /etc/hosts 檔案中;
- 把可執行檔案拷貝到nfs匯出目錄:/root/codespace/nfs之中;
- 在master節點nfs共享檔案夾中運行程式:mpirun -n 10 -hosts client,master ./mpi_hello_world;
- 測驗成功;
運行狀態:可見已經在兩個節點上運行;
mpirun -n 10 -hosts client,master ./mpi_hello_world Hello world from processor jn-1, rank 8 out of 10 processors Hello world from processor jn-1, rank 6 out of 10 processors Hello world from processor jn-1, rank 4 out of 10 processors Hello world from processor jn-1, rank 0 out of 10 processors Hello world from processor jn-1, rank 2 out of 10 processors Hello world from processor jn-4, rank 5 out of 10 processors Hello world from processor jn-4, rank 7 out of 10 processors Hello world from processor jn-4, rank 1 out of 10 processors Hello world from processor jn-4, rank 3 out of 10 processors Hello world from processor jn-4, rank 9 out of 10 processors
節點host樣本:主機要測驗主從節點網路互相連通,此配置基于以太網配置;
$ cat /etc/hosts (master) 127.0.0.1 localhost #127.0.1.1 1944 #MPI CLUSTER SETUP 172.50.88.22 master 172.50.88.56 slave1 172.50.88.34 slave2
$ cat /etc/hosts (client) 127.0.0.1 localhost #127.0.1.1 1947 (在超算中,也經常使用資料進行編號節點) #MPI CLUSTER SETUP 172.50.88.22 master 172.50.88.54 slave3
保持更新,轉載請注明出處;
轉載請註明出處,本文鏈接:https://www.uj5u.com/caozuo/64956.html
標籤:Linux
下一篇:一個騷命令防止你的檔案被誤洗掉!
