Ubuntu22.04安装并行计算mpi方法

在官网下载所需要的安装版本

MPI官网

开始安装

解压

sudo tar -xvf mpich-4.1.tar.gz
sudo mv mpich-4.1 mpich4

更新软件源

sudo apt-get update 

安装C、C++、gfortran

sudo apt-get install gcc
sudo apt-get install g++
sudo apt-get install gfortran

解锁文件夹

sudo chown -R zteng mpich4

开始编译

sudo ./configure --disable-fortran --with-device=ch4:ofi --prefix=/安装路径/mpich4/mpich-install 2>&1 | tee c.txt    
sudo apt install autoconf
#autoconf工具帮助我们自动地生成符合自由软件惯例的Makefile
autoconf
#clocal.m4:17: warning: this file was generated for autoconf 2.69.
#You have another version of autoconf.  It may work, but is not guaranteed to.
#If you have problems, you may need to regenerate the build system entirely.
#To do so, use the procedure documented by the package, typically 'autoreconf'.
#configure.ac:617: warning: The macro `AC_PROG_CC_C99' is obsolete.
#configure.ac:617: You should run autoupdate.
#./lib/autoconf/c.m4:1659: AC_PROG_CC_C99 is expanded from...
#configure.ac:617: the top level
sudo apt install make
#安装make是因为后面需要用到make命令编译自己的程序
#正在读取软件包列表... 完成
sudo make -j 30  #此处make我调用30核数,快的很了  
#/bin/sh ./config.status --recheck
...
sudo make install

设置环境变量

sudo vim /etc/profile

export MPI_ROOT=/home/zteng/mpich4/mpich-install #填写自己的路径
export PATH=$MPI_ROOT/bin:$PATH
export MANPATH=$MPI_ROOT/man:$MANPATH

sudo source /etc/profile
sudo: source:找不到命令

sudo -s   #不知道为啥找不到命令,于是我进入root用户
root@zteng-Tower:/home/zteng/mpich4# source /etc/profile  #可用
root@zteng-Tower:/home/zteng/mpich4# which mpicc  #查看位置
root@zteng-Tower:/home/zteng/mpich4# mpichversion #查看版本
root@zteng-Tower:/home/zteng/mpich4# mpirun -n 10 ./examples/cpi  #跑个例子,可以

说明

有时候没有权限就直接进root上跑吧

sudo -s
  • 1
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值