MPICH2在Solaris上的移植

MPI的并行工具库的基础工具。
我进行移植工作使用的平台是Unix体验中心的X4100系统,运行Solaris 10 Update 3 for x86/x64。具体步骤如下。
1.从
http://www-unix.mcs.anl.gov/mpi/mpich2/index.htm#download上下载最新的MPICH2,整理本文时MPICH2的最新版本是1.0.6,我移植使用的版本是1.0.5p4。下载网页All(source)一行中的源代码。
2.解压
gunzip -c mpich2*.tar.gz | tar xf -
3.建立安装目录
用户可以自定义安装目录,默认的安装目录是/usr/local/因为X4100系统只能在$HOME目录下有写的权限,所以我使用如下命令建立安装目录:
mkdir -p ~/mpich2-1.0.5p4/install
4.修改源代码跟目录下的configure文件
sed 's/xcode=pic32/fPIC/g' ./configure > ./configure_new
mv configure_new configure
注意,这是非常关键的一步,否则将会在make阶段出现不支持pic32代码的错误。在这里我使用solaris的gcc编译器进行编译,所以使用fPIC替代pic32。如果用solaris的cc编译器进行编译可将fPIC改为KPIC。
5.进行配置
./configure --enable-sharedlibs=solaris-cc --prefix=/home/e/g/seafrog/
mpich2-1.0.5p4/install/
注:虽然使用了,solaris-cc的共享库,但这里使用的是gcc编译器。如欲使用cc编译器,则在./configure后加上CC=cc选项。但是由于cc与gcc的差异,make阶段会出现编译错误,解决这个问题需要进行后续的工作。还有--prefix选项指定安装路径时一定要使用绝对路径。
6.编译并安装
这就是我们熟悉的make和make install,make时不必加任何参数。
7.设置运行环境
设置bin环境变量:
export PATH=/home/e/g/seafrog/mpich2-1.0.5p4/install/bin/:$PATH
设置mpd的配置文件,例如:
echo "MPD_SECRETWORD=seafrog" > ~/.mpd.conf
chmod 600 ~/.mpd.conf
如果您是根用户,则需建立/etc/mpd.conf作为mpd的配置文件。要保证配置文件的权限为600。
8.测试运行
至此,MPICH2可投入运行了,可以运行以下的命令测试一下:
mpd &                        #启动mpich2的daemon
mpiexec -n 6 whoami        #使6个whoami并行运行
mpdallexit                        #关闭mpich2的daemon
ToDos:
用Solaris的cc编译还有些问题,需要解决;需要用更多的案例测试。
参考:
MPICH2 Installer’s Guide

 

work platform:  SunOS  5.11 snv_50 i86pc i386 i86pc
Instruction set:   amd64  64b
mpich2 version: mpich2-1.0.6
Steps:
1.unpack:  
                  tar xfz mpich2.tar.gz                            ( if your "tar" command suport 'z')
                  gunzip -c mpich2-1.0.6.tar.gz | tar xf -   ( if your "tar" command don't support 'z')
2.change configure:
                 sed 's/xcode=pic32/KPIC/g' ./configure > ./configure_new
                 cp configure configure_old
                 move configure_new configure
                 chmod u+x configure
3.configure:
                mkdir /export/xqch/mpich2-1.0.6-installed
               ./configure --enable-sharedlibs=solaris-cc CC=cc -prefix=/export/xqch/mpich2-1.0.6-installed | tee configure.log
4.make:
              ./make
5.make install
              make install
6.create .mpd.conf
              cd ~
             touch .mpd.conf
             echo "secretword=xqch" > ~/.mpd.conf
            chmod 600 .mpd.conf
7. set PATH:
            export PATH=/export/xqch/mpich2-1.0.6-installed/binPATH   (for bash,sh)
            setenv PATH /home/xqch/mpich2-1.0.6-installed/binPATH     (for csh,tcsh)
8.test: ( run  commands following pls )
          which mpd
         which mpicc
         which mpiexec
         which mpirun
         mpd &
         mpiexec -n 1 /bin/hostname
         mpdallexit
         mpd &
         mpiexec -l -n     
         mpdallexit    
Final, thaks seafrog! I should  fix it weeks later without the guide from  his  <<MPICH2在Solaris上的移植>>!

原文地址:https://www.cnblogs.com/me115/p/1950809.html