Ubuntu下安装配置MPICH2.1.4
2012-05-25 15:25
155 查看
本篇介绍MPICH2在Linux系统上的基本安装配置过程,假设一共有两台机器,分别命名为node1和node2。
1. 安装准备
(1)设置主机名
先在/etc/hosts中删除原来的hostname,然后 vi /etc/hostname改成你想要的,注意必须顶行写。然后使用hostname命令来重新得到hostname, logout一下再login就会改掉。
(2)修改hosts文件
Ifconfig 得到本机的ip
node1的ip(192.168.1.1) node1 server
#个人认为这里的server加不加都可以就只是一个名字
node2的ip(192.168.1.2) node2
(3)配置自动ssh登录
配置自动ssh登录,即授权让node1和node2可以无密码的ssh登录对方以及自己,在node1和node2上运行ssh-keygen命令来产生公匙和私匙,分别把公匙内容增添到本机和对方机的~/.ssh/authorized_keys。
具体做法:
$ ssh-keygen -t rsa,之后一路回车,这一步将产生~/.ssh目录,以及两个文件d_rsa(私钥)和 id_rsa.pub(公钥)
$ cd ~/.ssh
$ cat id_rsa.pub 》 authorized_keys 把node1的公匙存到本地authorized_keys
$ scp node1:~/.ssh/id_rsa.pub node2:~/.ssh/1.pub 把node1的公匙复制到node2
$ ssh node2登录到node2
$ ssh-keygen -t rsa在node2上产生一对公匙和私匙
$ cd ~/.ssh
$ cat id_rsa.pub 》 authorized_keys 把node2的公匙保存到本地authorized_keys
$ scp node2:~/.ssh/id_rsa.pub node1:~/.ssh/2.pub 把node2的公匙复制到node1
$ cat 1.pub 》 authorized_keys 把node1的公匙加入到node2的authorized_keys
$ ssh node1 登录到node1
$ cd ~/.ssh
$ cat 2.pub 》 authorized_keys 把node2的公匙加入到node1的authorized_keys
这里要保证authorized_keys的文件权限为600或者644:chmod 600 authorized_keys
这样在两台电脑之间分别ssh登录过一次以后就能无密码登录了。
注:另一种简便方法
A) 在node1上执行 ssh-keygen -t rsa,将产生~/.ssh目录,以及两个文件d_rsa(私钥)和 id_rsa.pub(公钥)
B) 在node1上执行cat id_rsa.pub 》 authorized_keys,把node1的公匙存到本地authorized_keys
C) 执行scp -R node1:~/.ssh/ node2:~/ 把node1的。ssh目录复制到node2 的home目录下
D) 在node1执行ssh node2,然后在从node2执行ssh node1,输入几个“yes”就完成了。
2. 安装MPICH2
从官网http://www.mcs.anl.gov/research/projects/mpich2/index.php下载mpich2的最新版本mpich2-1.4.1p1.
(1)创建目录并解压缩
首先创建一个目录,将mpich安装到这个文件夹下
mkdir mpich2
在获得mpich2-1.4.1之后
A) 将gzip压缩的文件解压:mpich2-1.4.1p1.tar
gzip –d mpich2-1.4.1p1.tar.gz
B) 将tar归档的文件解开
tar xvf mpich2-1.4.1p1.tar
C) 进入mpich2-1.4.1p1的目录
cd mpich2-1.4.1p1
(2)配置、编译
A) 运行shell程序configure对mpich进行一些配置,使用smpd作为pm
./configure --prefix=/home/walter/mpich2 --with-pm=smpd --disable-f77 --disable-fc
B) 编译和安装
make
make install
注:在配置之前,要设置好系统时间,否则就会出现如下错误:
pm的配置非常重要,安装时默认使用hydra 作为pm,而windows使用 smpd作为pm。因为对hydra不了解,如果配置时不指定pm,就会出现单机可以正确执行,而多机直接无法通信的问题。如:
Fatal error in MPI_Send: Other MPI error, error stack:
MPI_Send(173)……: MPI_Send(buf=0x2aa59cd5b8, count=70920, MPI_INTEGER, dest=0, tag=2, comm=0x84000001) failed
MPIDI_CH3i_Progress_wait(214)……: an error occurred while handling an event returned by MPIDU_Sock_Wait()
MPIDI_CH3I_Progress_handle_sock_event(420):
MPIDU_Socki_handle_read(633)……: connection failure (set=0,sock=11,errno=104:Connection reset by peer)[cli_14]: aborting job:
Fatal error in MPI_Send: Other MPI error, error stack:
(3)设置环境变量
将安装后MPICH2的bin目录“mpich2”添加到系统路径中
Sudo vi /ect/environment 在PATH后面加上/home/yourname/mpich2/bin
然后echo $PATH,看看有没有添加成功。再下一步which smpd,看看有没有找到相应的路径。
3. 启动与测试
(1)启动smpd
smpd –s
要求passphrase的值在所有节点上相等,因为在windows上也是用这个服务,所以可以实现,windows和linux的互联。
(2)实验过程及结果
我们利用MPICH2的示例程序进行测试,示例为计算圆周率,可以输入精度。
A) 启动smpd:
smpd -s
B) 新建文件machinefile,内容为
node1
node2
C) cd mpich2-1.4.1p1
D) 执行
单节点执行
mpiexec –n 10 ./examples/cpi(n表示进程数)
多节点执行
mpiexec -n 10 -machinefile machinefile ./examples/icpi
上一页 [1] [2]
1. 安装准备
(1)设置主机名
先在/etc/hosts中删除原来的hostname,然后 vi /etc/hostname改成你想要的,注意必须顶行写。然后使用hostname命令来重新得到hostname, logout一下再login就会改掉。
(2)修改hosts文件
Ifconfig 得到本机的ip
node1的ip(192.168.1.1) node1 server
#个人认为这里的server加不加都可以就只是一个名字
node2的ip(192.168.1.2) node2
(3)配置自动ssh登录
配置自动ssh登录,即授权让node1和node2可以无密码的ssh登录对方以及自己,在node1和node2上运行ssh-keygen命令来产生公匙和私匙,分别把公匙内容增添到本机和对方机的~/.ssh/authorized_keys。
具体做法:
$ ssh-keygen -t rsa,之后一路回车,这一步将产生~/.ssh目录,以及两个文件d_rsa(私钥)和 id_rsa.pub(公钥)
$ cd ~/.ssh
$ cat id_rsa.pub 》 authorized_keys 把node1的公匙存到本地authorized_keys
$ scp node1:~/.ssh/id_rsa.pub node2:~/.ssh/1.pub 把node1的公匙复制到node2
$ ssh node2登录到node2
$ ssh-keygen -t rsa在node2上产生一对公匙和私匙
$ cd ~/.ssh
$ cat id_rsa.pub 》 authorized_keys 把node2的公匙保存到本地authorized_keys
$ scp node2:~/.ssh/id_rsa.pub node1:~/.ssh/2.pub 把node2的公匙复制到node1
$ cat 1.pub 》 authorized_keys 把node1的公匙加入到node2的authorized_keys
$ ssh node1 登录到node1
$ cd ~/.ssh
$ cat 2.pub 》 authorized_keys 把node2的公匙加入到node1的authorized_keys
这里要保证authorized_keys的文件权限为600或者644:chmod 600 authorized_keys
这样在两台电脑之间分别ssh登录过一次以后就能无密码登录了。
注:另一种简便方法
A) 在node1上执行 ssh-keygen -t rsa,将产生~/.ssh目录,以及两个文件d_rsa(私钥)和 id_rsa.pub(公钥)
B) 在node1上执行cat id_rsa.pub 》 authorized_keys,把node1的公匙存到本地authorized_keys
C) 执行scp -R node1:~/.ssh/ node2:~/ 把node1的。ssh目录复制到node2 的home目录下
D) 在node1执行ssh node2,然后在从node2执行ssh node1,输入几个“yes”就完成了。
2. 安装MPICH2
从官网http://www.mcs.anl.gov/research/projects/mpich2/index.php下载mpich2的最新版本mpich2-1.4.1p1.
(1)创建目录并解压缩
首先创建一个目录,将mpich安装到这个文件夹下
mkdir mpich2
在获得mpich2-1.4.1之后
A) 将gzip压缩的文件解压:mpich2-1.4.1p1.tar
gzip –d mpich2-1.4.1p1.tar.gz
B) 将tar归档的文件解开
tar xvf mpich2-1.4.1p1.tar
C) 进入mpich2-1.4.1p1的目录
cd mpich2-1.4.1p1
(2)配置、编译
A) 运行shell程序configure对mpich进行一些配置,使用smpd作为pm
./configure --prefix=/home/walter/mpich2 --with-pm=smpd --disable-f77 --disable-fc
B) 编译和安装
make
make install
注:在配置之前,要设置好系统时间,否则就会出现如下错误:
pm的配置非常重要,安装时默认使用hydra 作为pm,而windows使用 smpd作为pm。因为对hydra不了解,如果配置时不指定pm,就会出现单机可以正确执行,而多机直接无法通信的问题。如:
Fatal error in MPI_Send: Other MPI error, error stack:
MPI_Send(173)……: MPI_Send(buf=0x2aa59cd5b8, count=70920, MPI_INTEGER, dest=0, tag=2, comm=0x84000001) failed
MPIDI_CH3i_Progress_wait(214)……: an error occurred while handling an event returned by MPIDU_Sock_Wait()
MPIDI_CH3I_Progress_handle_sock_event(420):
MPIDU_Socki_handle_read(633)……: connection failure (set=0,sock=11,errno=104:Connection reset by peer)[cli_14]: aborting job:
Fatal error in MPI_Send: Other MPI error, error stack:
(3)设置环境变量
将安装后MPICH2的bin目录“mpich2”添加到系统路径中
Sudo vi /ect/environment 在PATH后面加上/home/yourname/mpich2/bin
然后echo $PATH,看看有没有添加成功。再下一步which smpd,看看有没有找到相应的路径。
3. 启动与测试
(1)启动smpd
smpd –s
要求passphrase的值在所有节点上相等,因为在windows上也是用这个服务,所以可以实现,windows和linux的互联。
(2)实验过程及结果
我们利用MPICH2的示例程序进行测试,示例为计算圆周率,可以输入精度。
A) 启动smpd:
smpd -s
B) 新建文件machinefile,内容为
node1
node2
C) cd mpich2-1.4.1p1
D) 执行
单节点执行
mpiexec –n 10 ./examples/cpi(n表示进程数)
多节点执行
mpiexec -n 10 -machinefile machinefile ./examples/icpi
上一页 [1] [2]
相关文章推荐
- Linux(Ubuntu14.04LTS) 安装配置MPICH-3.1.2
- ubuntu下MPICH的安装配置
- ubuntu16.04安装配置mpich2
- ubuntu16.04一步一步安装配置mpich
- 安装配置MPICH(ubuntu9.10)
- ubuntu下安装配置SSH,Putty
- ubuntu中ANT的安装和配置
- Ubuntu16.04lts 安装Theano配置GPU
- ubuntu tiny210 android 开发环境的配置与安装
- Ubuntu 下 Gtk与Qt编译环境安装与配置
- Ubuntu中Nginx的安装与配置
- Ubuntu安装配置Mysql
- Ubuntu14.04安装配置Mysql(傻瓜版)
- Ubuntu基础配置之Sublime Text安装
- Ubuntu 11.04 下安装配置 JDK 7
- Ubuntu Server 10.10安装配置Nginx+php-fpm+mysql
- hadoop在ubuntu下的安装配置
- ubuntu 下怎么配置安装opensips
- ubuntu14.04安装配置jdk1.8.0_45
- Ubuntu 11.04 下安装配置 JDK 7