-> yum list mpich*,查看MPI可安装的版本。
Loaded plugins: fastestmirror, langpacks
Skipping unreadable repository '/etc/yum.repos.d/epel.repo'
Loading mirror speeds from cached hostfile
* base: mirrors.163.com
* extras: mirrors.163.com
* nux-dextop: mirror.li.nux.ro
* updates: mirrors.163.com
Installed Packages
mpich-3.0.x86_64 3.0.4-10.el7 @base
mpich-3.2.x86_64 3.2-2.el7 @base
Available Packages
mpich-3.0.i686 3.0.4-10.el7 base
mpich-3.0-autoload.x86_64 3.0.4-10.el7 base
mpich-3.0-devel.i686 3.0.4-10.el7 base
mpich-3.0-devel.x86_64 3.0.4-10.el7 base
mpich-3.0-doc.noarch 3.0.4-10.el7 base
mpich-3.2.i686 3.2-2.el7 base
mpich-3.2-autoload.x86_64 3.2-2.el7 base
mpich-3.2-devel.i686 3.2-2.el7 base
mpich-3.2-devel.x86_64 3.2-2.el7 base
mpich-3.2-doc.noarch 3.2-2.el7
基于我的系统考虑,我选择 mpich-3.2.x86_64
-> sudo yum install -y mpich-3.2.x86_64
寻找mpi命令:
-> sudo find / -name "mpicc"
发现位于:/usr/local/bin/mpicc
在.bashrc添加:
export PATH=$PATH:/usr/local/bin/mpicc
->source .bashrc
测试文件:
#include<mpi.h>
#include<stdio.h>
#include<math.h>
intmain(intargc,char** argv)
{
int myid,numproces;
int namelen;
char processor_name[MPI_MAX_PROCESSOR_NAME];
MPI_Comm_rank(MPI_COMM_WORLD,&myid);
MPI_Comm_size(MPI_COMM_WORLD,&numproces);
MPI_Get_processor_name(processor_name,&namelen);
fprintf(stdout,"hello world! Process %d of %d on %s\n", myid,numproces,processor_name);
MPI_Finalize();return0;
}
附录:源于mpif90中的bug:
Cannot find "mpi.mod"
参考: https://www.jianshu.com/p/57b1460c8afd
网友评论