---
title: OpenMPI编译安装
description: "1. 使用PuTTY工具，以root用户登录服务器。"
url: https://www.hikunpeng.com/document/detail/zh/kunpenghpcs/hpcindapp/instg-osc/openmpi_007.html
sourcePath: /source/zh/kunpenghpcs/hpcindapp/instg-osc/openmpi_007.html
indexId: dfe36434aba0e1b74ff668c6d5430e50480aa6a83eab0f0adab1d54917ab155859
---
# OpenMPI编译安装

#### 操作步骤

1. 使用PuTTY工具，以root用户登录服务器。
2. 执行以下命令使用yum安装依赖包。

```
yum install numactl-devel-* systemd-devel-*
```


3. 执行以下命令加载编译器。

```
export PATH=
/path/to/GNU
/bin:$PATH
export LD_LIBRARY_PATH=
/path/to/GNU
/lib64:$LD_LIBRARY_PATH
```


4. 执行以下命令解压OpenMPI安装包。

```
cd
/path/to/OpenMPI
tar -xvf  openmpi-4.0.1.tar.gz
```


5. 执行以下命令进行配置。

```
cd openmpi-4.0.1
./configure --prefix=
/path/to/OPENMPI
--
enable-pretty-print-stacktrace --enable-orterun-prefix-by-default --with-knem=/opt/knem-1.1.3.90mlnx1/ --with-hcoll=/opt/mellanox/hcoll/ --with-cma  --with-ucx  --enable-mpi1-compatibility CC=gcc CXX=g++ FC=gfortran
```


  --with-ucx：使用系统自带的库“/usr/lib64/ucx”； --with-knem、--with-hcoll需要安装Mellanox驱动，安装步骤请参考《HPC解决方案 基础环境搭建指导书(https://www.hikunpeng.com/document/detail/zh/kunpenghpcs/instg-osc/kunpenghpcs_instg_0001.html)》中“Infiniband网卡驱动安装”章节。

6. 执行以下命令进行安装编译。

```
make -j 16
make install
```
