MPICH 学习笔记

来源:互联网 发布:grep linux 编辑:程序博客网 时间:2024/06/14 06:46

1. OpenMP or MPI?
从wiki上看,在集群上MPI比OpenMP更成熟,高效。
MPI: http://en.wikipedia.org/wiki/Message_Passing_Interface
Pros and Cons of MPI & OpenMP:
  http://en.wikipedia.org/wiki/Comparison_of_MPI,_OpenMP,_and_Stream_Processing

2.  MPICH or OpenMPI?
OpenMPI在共享内存的管理上更优,但是比商业的MPi似乎都要差一点。不过MPICH2应该会有很大的进步
MPICH vs OpenMPI: http://www.beowulf.org/archive/2008-April/021188.html

3. Installation of MPICH in Ubuntu
a) 安装之前要有f77, f90, c, c++的编译器 (gfortran, gcc, g++)
b) 不建议使用Synaptic package Manager安装,建议下载源代码手动编译安装
c) 按照readme里面的步骤安装,在步骤4时,因为Ubuntu的文件管理和MPICH不同,最好专门建立一个文件夹
        sudo mkdir /usr/bin/mpich_install_folder (make sure mpich_install_folder !=mpich)
           chown –R user_name mpich_install_folder
 
d) 步骤7,在.bashrc上添加上PATH=/usr/bin/mpich_install_folder/bin:$PATH ; export PATH
现在单机上应该可以使用MPICH了,可以通过mpd &; mpdtrace -l测试
e) 步骤9,10可以参照
http://lwg2001s.javaeye.com/blog/278945
http://cid-4205cd3f0a115bcc.spaces.live.com/Blog/cns!4205CD3F0A115BCC!438.entry
http://hi.baidu.com/sobereva/blog/item/acd600c6d518bc1c9c163d5c.html
在~下面建立.mpd.conf和mpd.hosts,check /etc/hosts and /etc/hostname
如果有127.0.1.1的话,改机器名或者注释掉
f) 在另外几台机器上重复a)到e),安装路径和secretword最好都一样
g) mpdboot –n 2,有问题的话,参看安装手册附录A
installer’s guider: http://www.mcs.anl.gov/research/projects/mpich2/documentation/files/mpich2-1.2.1-installguide.pdf

4. 使用nfs共享简化设置
按照以上办法设置的帐号具有root权限,而且无需输入密码,可能会带来一系列安全问题。Omid Alemi 通过设置nfs共享来解决这一问题。
Omid Alemi: https://wiki.ubuntu.com/MpichCluster
a) 指定一台机器为master,在上面安装nfs (nfs-kernal-server), 在根目录下创建一个mpi专用文件夹 (/mpi)。为了安全起见,共享时最好指定机器或者ip范围。(/mpi ub0(rw,sync,no_root_squash)  ub1...), 重启nfs server (sudo /etc/init.d/nfs-kernel-server restart)
Setting up /etc/exports: http://nfs.sourceforge.net/nfs-howto/ar01s03.html
b) 在/mpi下面安装mpich。生成.mpd.conf和mpd.hosts文件
c) 生成一个桌面用户 (mpiu), 指定该用户的~文件夹为/mpi,为了所有的机器都有相同的uid和gid,最好修改到1020以后,修改/mpi的拥有者为mpiu。
change uid and gid: http://www.cyberciti.biz/faq/howto-change-rename-user-name-id/
d) 安装ssh,切换到mpiu,生成密钥。把mpich的bin目录添加到.bashrc
e) 测试mpich在本机上是否工作
f) 在其他机器上创建mpiu,指定~目录,修改uid和gid,安装ssh
g) mounting /mpi in all nodes: sudo mount ub0:/mpi /mpi
h) 测试mpich在多台电脑的工作情况 (cpi)

5. mpi2test的问题
官方网站提供的测试包mpi2test直接configure不通过,指定编译器后卡在f2cwin

./configure --with-mpi CC=gcc MPICC=mpicc F77=gfortran MPIF77=mpif77 CXX=g++ /
                       MPICXX=mpicxx F90=gfortran MPIF90=mpif90 --disable-spawn /
               --enable-strictmpi

原创粉丝点击