项目场景:

MPICH环境搭建和配置
以下是我个人的搭建过程中遇到的一些问题,仅作参考


问题1 :

不知道如何下载,或是下载哪一个版本。 mpich下载,官网下载地址:

https://www.mpich.org/downloads/

下载的指导如下
在这里插入图片描述

  1. 在http点击右键,其他窗口打开,下载链接就打开了,此时安装包就开始下载了,压缩包的格式为tar.gz

  2. 将下下载压缩包放到合适的目录,然后按照下面的指令解压

tar -xzvf mpich-3.4.2.tar.gz
  1. 创建安装目录,我一般会在自己的目录下创建安装目录,创建目录结果如图所示。
mkdir mpich-install

在这里插入图片描述

  1. 进入刚才的解压文件夹,并执行配置命令,执行结束之后你会发现有一个坑
cd mpich-3.4.2

配置命令如下:

./configure --prefix=/home/Desktop/mpich-install(等于号后面添加的是你要安装的目录)

问题2:

问题描述如下:
checking how to hardcode library paths into programs... immediate
configure: RUNNING PREREQ FOR CH4 DEVICE
checking rdma/fabric.h usability... no
checking rdma/fabric.h presence... no
checking for rdma/fabric.h... no
checking for fi_getinfo in -lfabric... no
checking ucp/api/ucp.h usability... no
checking ucp/api/ucp.h presence... no
checking for ucp/api/ucp.h... no
checking for ucp_config_read in -lucp... no
configure: error: no ch4 netmod selected

  The default ch4 device could not detect a preferred network
  library. Supported options are ofi (libfabric) and ucx:

    --with-device=ch4:ofi (添加这个一段提示 )or --with-device=ch4:ucx

  Configure will use an embedded copy of libfabric or ucx if one is
  not found in the user environment. An installation can be specified
  by adding

    --with-libfabric=<path/to/install> or --with-ucx=<path/to/install>

  to the configuration.

  The previous MPICH default device (ch3) is also available and
  supported with option:

    --with-device=ch3
  1. 解决方法很简单,在配置命令后面添加提示的 --with-device=ch4:ofi即可:
./configure --prefix=/home/Desktop/mpich-install(等于号后面添加的是你要安装的目录) --with-device=ch4:ofi

经过漫长的配置,可能还是遇到第二个坑


问题3:

加上后再次报错
No Fortran compiler found. 
If you don't need to build any Fortran programs, 
you can disable Fortran support using --disable-fortran. 
If you do want to build Fortran programs, you need to install a Fortran compiler such as gfortran or ifort before you can proceed.
  1. 这是因为没有安装Fortran compiler 根据提示加上 --disable-fortran 即可
./configure --prefix=/home/Desktop/mpich-install(等于号后面添加的是你要安装的目录) --with-device=ch4:ofi  --disable-fortran

配置成功的提示如下:

configure: creating ./config.status
config.status: creating Makefile
config.status: creating include/Makefile
config.status: creating src/Makefile
config.status: creating dtpoolsconf.h
config.status: executing depfiles commands
config.status: executing libtool commands
***
*** device: ch4
*** netmods: ofi
*** shm: auto
***
Configuration completed.
  1. 接下来就是要执行编译和安装
make
make install
  1. 添加环境变量
vim  ~/.bashrc

在bashrc最后面添加一下代码

export MPI_ROOT=/home/Desktop/mpich-install(等于号后面添加的是你要安装的目录)
export PATH=$MPI_ROOT/bin:$PATH
export MANPATH=$MPI_ROOT/man:$MANPATH
  1. 加载环境变量
source ~/.bashrc
  1. 测试
执行 mpichversion

结果

MPICH Version:          3.4.2
MPICH Release date:     Tue Nov 12 21:23:16 CST 2019
MPICH Device:           ch3:nemesis
MPICH configure:        --enable-cxx --with-romio --enable-shared --with-comm=shared --disable-devdebug --prefix=/cm/shared/apps/mpich/ge/gcc/64/3.3.2
MPICH CC:       gcc -std=gnu99 -m64   -O2
MPICH CXX:      g++ -I/cm/shared/apps/gcc/current/include/c++/4.8.5/backward/backward_old -m64  -O2
MPICH F77:      gfortran -m64  -O2
MPICH FC:       gfortran -m64  -O2
MPICH Custom Information: 
Logo

为开发者提供学习成长、分享交流、生态实践、资源工具等服务,帮助开发者快速成长。

更多推荐