我正在尝试使用mpi / openmdao的并行化。
我尝试过各种ubuntu计算机以及windows上的ubuntu bash(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)
但是Paralel Group代码在openmdao 2.2中。手册不起作用。 对于每次尝试(不同的计算机),我似乎得到另一个错误,其中大多数似乎是兼容性错误(即我安装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
如果尝试运行,则在同一系统上 mpirun -n 2 python my_par_model.py 基于手动代码,这就是我得到的
有没有人有一个建议可能会失败,或者我可以遵循哪些步骤来实施anconda / openmdao / petsc / mpi4py和成功运行paralel openmdao?
答案 0 :(得分:1)
您可以查看我们的.travis.yml文件中存在的linux安装实现吗? https://github.com/OpenMDAO/OpenMDAO/blob/master/.travis.yml
这适用于在Travis CI上的Trusty Tahr实例上从头开始安装和测试OpenMDAO。我乍一看的一个区别就是我们使用pip将mpi和PETSc安装到conda安装的python中。
答案 1 :(得分:1)
我认为MPI兼容性是主要问题。我不知道它必须是openmpi并且确实conda install命令安装了mpich并且可能导致openmdao出现问题。
我会继续做更多的测试,但对于从全新安装的ubuntu-16.04.4-desktop-amd64.iso开始的工作系统,我按照这些步骤操作;
(花费时间的步骤是openmpi安装和petsc4py pip instalattion。)
1)对于某些依赖项(取自https://gist.github.com/mrosemeier/088115b2e34f319b913a)
sudo apt-get install libibnetdisc-dev
sudo apt-get install libblas-dev libatlas-dev liblapack-dev
2)下载/安装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&amp;休息(主要取自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>