并行组设置 & mpi4py/OpenMDAO 2.2.X

Parallel Group setup & mpi4py/OpenMDAO 2.2.X

我正在尝试使用 mpi/openmdao 的并行化。

我在各种 ubuntu 电脑上试过 ubuntu bash windows(windows 10 功能)

依赖项独立运行良好(即 import petsc4py 和 import mpi4py 运行良好,我可以 运行 对这些类似于链接的测试:https://openmdao.readthedocs.io/en/1.7.3/getting-started/mpi_linux.html & http://mpi4py.scipy.org/docs/usrman/install.html)

但是openmdao 2.2中的Paralel Group代码。手册不起作用。 对于每次尝试(不同的计算机),我似乎都会遇到另一个错误,其中大多数似乎是兼容性错误(即我安装 petsc4py 会破坏 numpy 或 mpi4py 安装,导致现有 openmdao 核心出现问题。)

在某些计算机上,我安装了自己的 openmpi 和 petsc,但据我所知,conda install 命令已经安装了它们。

最终我在新启动的亚马逊实例上尝试了这些步骤 但有类似的问题。

sudo apt-get install build-essential 
wget http://repo.continuum.io/archive/Anaconda3-5.2.0-Linux-x86_64.sh    
bash Anacond*
sudo apt-get install libibnetdisc-dev
sudo apt-get install libblas-dev libatlas-dev liblapack-dev
conda install mpi4py
conda install -c conda-forge petsc4py 

如果我在其中一台计算机上检查“'conda list'”,则缩写输出为;

mpi                       1.0                       mpich    conda-forge                                                                                      
mpi4py                    3.0.0              py36_mpich_1    conda-forge                                                                                      
mpich                     3.2.1                         1    conda-forge                                                                                      
mpich2                    1.4.1p1                       0    anaconda                                                                                         
mpmath                    1.0.0            py36hfeacd6b_2                                                                                                     
msgpack-python            0.5.1            py36h6bb024c_0                                                                                                     
multipledispatch          0.4.9            py36h41da3fb_0                                                                                                     
mumps                     5.0.2           blas_openblas_208  [blas_openblas]  
conda-forge                                                                     
numpy                     1.14.3          py36_blas_openblas_200  [blas_openblas]  conda-forge                                                                
numpydoc                  0.7.0            py36h18f165f_0                                                                                                                                                                          
openblas                  0.2.20                        8    conda-forge                                                                                      
openmdao                  2.2.1                     <pip>                                                                                                     
openpyxl                  2.4.10                   py36_0                                                                                                     
openssl                   1.0.2o                        0    conda-forge                                                                                      
petsc                     3.9.1           blas_openblas_0  [blas_openblas]  
conda-forge                                                                       
petsc4py                  3.9.1                    py36_0    conda-forge                                                                                      
pexpect                   4.3.1                    py36_0                                                                                                     
pickleshare               0.7.4            py36h63277f8_0                                                                                                     
pillow                    5.0.0            py36h3deb7b8_0                                                                                                     
pip                       10.0.1                    <pip

如果尝试在同一系统上 运行 mpi运行 -n 2 python my_par_model.py 基于手动代码,这就是我得到的

有没有人建议它可能会失败的地方,或者我可以遵循哪些步骤来 ubuntu 实施 anconda/openmdao/petsc/mpi4py 并成功 运行 paralel openmdao?

您可以看看我们的 .travis.yml 文件中存在的 linux 的安装实现吗? https://github.com/OpenMDAO/OpenMDAO/blob/master/.travis.yml

这适用于在 Travis CI 上的 Trusty Tahr 实例上从头开始安装和测试 OpenMDAO。我第一眼看到的一个区别是我们使用 pip 将 mpi 和 PETSc 安装到 conda-installed python.

我认为 MPI 兼容性是主要问题。我不知道它必须是 openmpi,实际上 conda install 命令会安装 mpich 并可能导致 openmdao 出现问题。

我将继续进行更多测试,但对于从全新安装 ubuntu-16.04.4-desktop-amd64.iso 开始的工作系统,我遵循了这些步骤;

(需要时间的步骤是openmpi安装和petsc4py pip安装。)

1 ) 对于某些依赖项(取自 https://gist.github.com/mrosemeier/088115b2e34f319b913a

sudo apt-get install libibnetdisc-dev
sudo apt-get install libblas-dev libatlas-dev liblapack-dev

2) Download/Install OpenMPI(主要取自 http://lsi.ugr.es/jmantas/pdp/ayuda/datos/instalaciones/Install_OpenMPI_en.pdf

wget https://download.open-mpi.org/release/open-mpi/v3.1/openmpi-3.1.0.tar.gz 
tar -xzf openmpi-3.1.0.tar.gz 
cd openmpi-*
./configure --prefix="/home/$USER/.openmpi"
make
sudo make install
echo export PATH="$PATH:/home/$USER/.openmpi/bin" >> /home/$USER/.bashrc
echo export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/home/$USER/.openmpi/lib/" >> /home/$USER/.bashrc

3) MINICONDA & Rest(大部分取自 https://github.com/OpenMDAO/OpenMDAO/blob/master/.travis.yml

wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh
sh Minicond* # agree to add to the path etc.
conda install --yes python=3.6
conda install --yes numpy==1.14 scipy=0.19.1 nose sphinx mock swig pip;
pip install --upgrade pip;
pip install mpi4py
pip install petsc4py==3.9.1
#petsc4py Gives an error failed building wheel for petsc but then installs petsc itself, afterwards, petsc4py is also installed

sudo apt install git  # in the cases git does not exist

# not sure why we need this part but i followed 
pip install redbaron;
pip install git+https://github.com/OpenMDAO/testflo.git;
pip install coverage;
pip install git+https://github.com/swryan/coveralls-python@work;
# pyoptsparse and openmdao
git clone https://github.com/mdolab/pyoptsparse.git;
cd pyoptsparse;
python setup.py install;
cd ..;
conda install --yes matplotlib;

git clone http://github.com/OpenMDAO/OpenMDAO
cd OpenMDAO
pip install .

# optional  
conda install spyder 

4) 检查版本

mpirun --version : Open MPI 3.1.0
python --version : 3.6.5
pip --version   :  
pip 10.0.1 from /home/user/miniconda3/lib/python3.6/site-packages/pip (python 3.6)



conda list : (note that there is no mpich or similar in the conda list) 

openmdao                  2.2.1                     <pip>
mpi4py                    3.0.0                     <pip>
petsc                     3.9.2                     <pip>
petsc4py                  3.9.1                     <pip>