Linux(Ubuntu14.04LTS) 安装配置MPICH-3.1.2

MPICH-3.1.2稳定版无法使用apt-get install 命令直接安装,需要从官网下载源码进行编译安装,本文参照MPICH官网提供的mpich-3.1.2-installguide在Ubuntu14.04LTS下安装MPICH-3.1.2。

源码下载:http://www.mpich.org/downloads/
安装指导文档:http://www.mpich.org/static/downloads/3.1.2/mpich-3.1.2-installguide.pdf

1.安装build-essential软件包

MPICH-3.1.2需要用户自己编译、运行,其中需要用到C/C++编译器,makefile文件编译等,需要安装build-essential软件包,Ubuntu安装命令:sudo apt-get install build-essential

2.MPICH3.1.2安装过程

  • 源码下载:从官网下载mpich源码mpich-3.1.2.tar.gz,默认保存在Downloads文件夹下
  • 解压源码:tar xfz mpich-3.1.2.tar.gz
  • 创建安装目录(可执行文件和库文件安装处):sudo mkdir /usr/local/mpich
  • 创建生成目录(安装过程临时文件,如Makefile):sudo mkdir /tmp/mpich
  • Configure:prefix指定安装目录,--disable禁用某些编译选项,此处禁用fortran77和fortran90,否则将configure出错sudo /home/you/Downloads/mpich-3.1.2/configure -prefix=/usr/local/mpich --disable-fortran --disable-fc 2>&1 | tee c.txt
  • Linux(Ubuntu14.04LTS) 安装配置MPICH-3.1.2_第1张图片
  • 编译Makefile:sudo make 2>&1 | tee m.txt
  • 安装MPICH:sudo make install 2>&1 | tee mi.txt
安装完成后检查安装目录下的bin文件夹是否存在mpicc、mpicxx、mpiexec等文件
Linux(Ubuntu14.04LTS) 安装配置MPICH-3.1.2_第2张图片

3.配置环境变量

  • 修改PATH:

    在profile(或.bashrc)中添加MPICH的bin目录,以便可以在终端中直接执行mpich的可执行文件,在profile文件的末尾添加:
    export PATH=/usr/local/mpich/bin:$PATH

  • 更新PATH:sudo source /etc/profile

4.测试

  • 测试样例程序:使用mpiexec命令测试examples目录下cpi程序,测试结果说明MPICH已安装配置成功

Linux(Ubuntu14.04LTS) 安装配置MPICH-3.1.2_第3张图片

  • 删除源码文件和生成目录:


你可能感兴趣的:(分布式计算)