为了让 OpenMDAO 使用 Conda、OpenMPI、mpi4py、PETSc 和 petsc4py 成功并行运行,我已将OS X 的此过程调整为 Ubuntu:
先决条件
Ubuntu
sudo apt-get install libibnetdisc-dev
sudo apt-get install libblas-dev libatlas-dev liblapack-dev
安装 OpenMPI
下载 OpenMPI:https ://www.open-mpi.org/software/ompi/v1.10/
提取和配置
cd ~/Downloads/openmpi-1.10.1
mkdir build
cd build
# I prefer to keep /usr/local clean, so I put it in /opt/openmpi
./configure --prefix=/opt/openmpi --with-devel-headers --enable-binaries
make
sudo make install
将以下内容添加到您的 bash 配置文件中
操作系统
export DYLD_LIBRARY_PATH=${DYLD_LIBRARY_PATH}:/opt/openmpi/lib
export PATH=${PATH}:/opt/openmpi/bin
Ubuntu
export LD_LIBRARY_PATH=LD_LIBRARY_PATH=/opt/openmpi/lib:$LD_LIBRARY_PATH
export PATH=/opt/openmpi/bin:$PATH
激活您的 conda 环境
source activate myenv
安装 mpi4py
git clone https://github.com/mpi4py/mpi4py.git ./mpi4py.git
cd mpi4py.git
python setup.py build --mpicc=/opt/openmpi/bin/mpicc
python setup.py install
安装 PETSc
git clone https://bitbucket.org/petsc/petsc.git ./petsc.git
cd petsc.git
python setup.py build
python setup.py install
安装 petsc4py
git clone https://bitbucket.org/petsc/petsc4py.git ./petsc4py.git
cd petsc4py.git
python setup.py build
python setup.py install