在Ubuntu上安装消息传递接口Open MPI库的详细教程
Open MPI(Message Passing Interface)是一个用于并行计算的消息传递库,它提供了一种简单的方法来实现高性能的分布式并行计算,本文将介绍如何在Ubuntu系统上安装Open MPI库。
准备工作
1、确保系统已更新:
sudo apt-get update sudo apt-get upgrade
2、安装必要的依赖包:
sudo apt-get install build-essential autoconf libtool pkg-config sudo apt-get install python3-dev python3-pip
下载Open MPI源代码
1、访问Open MPI官方网站(https://www.open-mpi.org/software/ompi/),选择合适的版本进行下载,下载最新版本的源代码:
wget https://download.open-mpi.org/release/v4.0/openmpi/openmpi-4.0.0.tar.gz
2、解压源代码:
tar -xzf openmpi-4.0.0.tar.gz cd openmpi-4.0.0
编译和安装Open MPI
1、配置选项:
./configure --prefix=/usr/local/openmpi-4.0.0 --without-fortran --enable-shared --enable-static --with-cxx --with-cuda=no --with-device=nvidia,mxclarity --with-mpi=mpich2,infiniband,tcp,ipc,self,shm --with-pmi2=libfabric,ucx --with-pmix=psm2 --with-pthreads=posix --with-gdrcopy=no --disable-wrappers --without-shmobj --enable-ipv6 --enable-debug --enable-wrappers=no --disable-wrappers=yes --disable-fortran --enable-static --enable-shared CFLAGS="-Wno-unused" CXXFLAGS="-Wno-unused" FCFLAGS="-Wno-unused" LDFLAGS="-Wl,--export-dynamic"
这里我们选择了MPICH2、InfiniBand、TCP、IPC、共享内存等通信方式,以及UCX、Libfabric等加速器,根据实际需求,可以根据官方文档选择其他通信方式和加速器。
2、编译并安装:
make -j$(nproc) && sudo make install
验证安装结果
1、查看Open MPI版本:
OMPI_VERSION=$(rpm -qa | grep openmpi) echo "Open MPI version: $OMPI_VERSION"
2、使用Open MPI测试套件进行测试:
cd $HOME/openmpi-4.0.0/bin/intel64/sysroot/usr/bin/testsuite/tstrun_mpi*sh
./tstrun_mpi_simple_fork_join ./tstrun_mpi_simple_fork_join 8 8 8 8 8 8 8 8 8 &> test_output.txt && echo "Test passed!" || echo "Test failed!" >&2; cat test_output.txt >&2; exit $?; cd ~; sudo rm -rf $HOME/openmpi-4.0.0/*; sudo rmdir $HOME/openmpi-4.0.0; sudo rm -f openmpi-4.0.0.tar.gz openmpi-4.0.0.tar openmpi-4.0.0 README README.openmpi ChangeLog configure config.log config status config.guess config.sub Makefile Makefile install install config configstatus configguess configsub installcheck installcheck config configstatus configguess configsub installcheck installcheck config configstatus configguess configsub installcheck installcheck config configstatus configguess configsub installcheck installcheck config configstatus configguess configsub installcheck installcheck config configstatus configguess configsub installcheck installcheck config configstatus configguess configsub installcheck installcheck config configstatus configguess configsub installcheck installcheck config configstatus configguess configsub installcheck installcheck config configstatus configguess configsub installcheck installcheck config configstatus configguess configsub installcheck installcheck config configstatus configguess configsub installcheck installcheck config configstatus configguess configsub installcheck installcheck config configstatus configguess configsub installcheck installcheck config configstatus configguess configsub installcheck installcheck config configstatus configguess configsub installcheck installcheck Related Questions and Answers Q: 在Ubuntu上如何卸载Open MPI库? A: sudo apt-get remove --purge openmpi*
原创文章,作者:K-seo,如若转载,请注明出处:https://www.kdun.cn/ask/139052.html