一、下载Mpich并解压
到官方网站下载Mpich,并解压到自己的文件目录下
二、安装过程及遇到的问题
正确安装步骤,可以直接看Mpich解压文件下的README文件,有详细安装步骤及某些问题解决方式。
1、Configure MPICH specifying the installation directory
for csh and tcsh:
./configure --prefix=/home/<USERNAME>/mpich-install |& tee c.txt
for bash and sh:
./configure --prefix=/home/<USERNAME>/mpich-install 2>&1 | tee c.txt
遇到的问题:
(1)configure: error: no acceptable C compiler found in $PATH...
原因:没有安装GCC编译器
解决方法:如何在Ubuntu 18.04上安装GCC编译器_Linux教程_Linux公社-Linux系统门户网站
(2)No Fortran 77 compiler found. ...
原因:缺少such as后面的那两个包中的一个
解决方法:
sudo apt-get install gfortran
2、Build MPICH
for csh and tcsh:
make |& tee m.txt
for bash and sh:
make 2>&1 | tee m.txt
安装时未遇到问题
官方给出的可能遇到的问题的解决方法:
If there were problems, do a "make clean" and then run make again with V=1.
make V=1 |& tee m.txt (for csh and tcsh)
OR
make V=1 2>&1 | tee m.txt (for bash and sh)
Then go to step (2) below, for reporting the issue to the MPICH developers and other users.
3、Install the MPICH commands
for csh and tcsh:
make install |& tee mi.txt
for bash and sh:
make install 2>&1 | tee mi.txt
未遇到问题
4、Add the bin subdirectory of the installation directory to your
path in your startup script
配置环境变量查看和修改PATH环境变量(Linux通用) - 唐僧公子 - 博客园
PATH=/home/<USERNAME>/mpich-install/bin:$PATH ; export PATH
配置完成后,可以使用以下两个命令检查配置是否成功
which mpicc
which mpiexec
配置成功会显示,mpicc和mpiexec的路径
5、MPICH uses a process manager for starting MPI applications.
使用以下两种方式运行Mpich自带的例子
To run the CPI example with 'n' processes on your local machine, you can use:
mpiexec -n <number> ./examples/cpi
Test that you can run an 'n' process CPI job on multiple nodes:
mpiexec -f machinefile -n <number> ./examples/cpi
The 'machinefile' is of the form:
host1
host2:2
host3:4 # Random comments
host4:1
'host1', 'host2', 'host3' and 'host4' are the hostnames of the machines you want to run the job on.
The ':2', ':4', ':1' segments depict the number of processes you want to run on each node.
If nothing is specified, ':1' is assumed.
安装成功