我正在尝试安装 pyMPI ,以便将其与WARP程序包一起使用,以进行一些我可以在常规桌面上运行的低分辨率模拟。 WARP 的documentation表示我使用 pyMPI 的特定变体:
Warp传统上与pyMPI一起使用,但也适用于mpi4py。 (使用python3进行warp只适用于mpi4py。)pyMPI可以从NERSC的git获得。 (sourceforge版本不适用于Warp。)
git clone http://portal.nersc.gov/project/warp/git/pyMPI.git
要构建,请运行以下命令,根据需要修改安装路径。
./configure --prefix=/place/to/install make install
但是,当我运行第一个命令时,配置失败,输出如下:
checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking for ranlib... ranlib
checking host overrides... no
checking fatal error on cancel of isend (--with-bad-cancel)... no
checking Assume stdin is interactive (--with-isatty)...
checking Append a newline to prompt (--with-prompt-nl)...
checking for mpcc... no
checking for mpxlc... no
checking for mpiicc... no
checking for mpicc... mpicc
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... yes
checking for suffix of executables...
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether mpicc accepts -g... yes
checking for mpicc option to accept ANSI C... none needed
checking for style of include used by make... GNU
checking dependency style of mpicc... none
checking for an ANSI C-conforming const... yes
checking for mpicc is really C++... checking how to run the C preprocessor... mpicc -E
checking for egrep... grep -E
no
checking for sed... /usr/bin/sed
checking for grep... /usr/bin/grep
checking for mpiCC... no
checking for mpi++... no
checking for mpicC... no
checking for g++... g++
checking whether we are using the GNU C++ compiler... yes
checking whether g++ accepts -g... yes
checking dependency style of g++... none
checking for mpicc... /home/krishnadev/.mpich-install/bin/mpicc
checking for g++... /usr/lib64/ccache/g++
checking if /home/krishnadev/.mpich-install/bin/mpicc -E -w is a valid CPP... yes
checking how to run the C preprocessor... /home/krishnadev/.mpich-install/bin/mpicc -E -w
checking for --with-python... no
checking executable /usr/bin/python3.5m-x86_64-config... yes
checking for Python... /usr/bin/python3.5m-x86_64-config
checking for MPIRun.exe... no
checking for mpirun... /home/krishnadev/.mpich-install/bin/mpirun
checking for poe... no
checking Python version 2.2 or higher... Usage: /usr/bin/python3.5m-x86_64-config --prefix|--exec-prefix|--includes|--libs|--cflags|--ldflags|--extension-suffix|--help|--abiflags|--configdir
no
checking distutils?... Usage: /usr/bin/python3.5m-x86_64-config --prefix|--exec-prefix|--includes|--libs|--cflags|--ldflags|--extension-suffix|--help|--abiflags|--configdir
checking distutils works... no
Usage: /usr/bin/python3.5m-x86_64-config --prefix|--exec-prefix|--includes|--libs|--cflags|--ldflags|--extension-suffix|--help|--abiflags|--configdir
configure: error: Your python distribution is incomplete. Perhaps there is no XXX/lib/python2.x/config
我打算在Python 2.7中使用WARP,这是默认设置。
[krishnadev@localhost ~] $ python --version
Python 2.7.13
但似乎配置脚本似乎检测到Python 3:
checking for Python... /usr/bin/python3.5m-x86_64-config
错误输出的最后一行也是
configure: error: Your python distribution is incomplete. Perhaps there is no XXX/lib/python2.x/config
但存在以下文件夹:
[krishnadev@localhost ~] $ ls /usr/lib64/python2.7/config/
config config.c.in libpython2.7.so makesetup Setup Setup.local
config.c install-sh Makefile python.o Setup.config
,而
[krishnadev@localhost ~] $ ls /usr/lib64/python3.*/config/
ls: cannot access '/usr/lib64/python3.*/config/': No such file or directory
[krishnadev@localhost ~] $ ls /usr/lib/python*/config/
ls: cannot access '/usr/lib/python*/config/': No such file or directory
我正在运行Fedora 25 Scientific(64位),我还没有在其他系统上测试过。谁能帮助我如何建立pyMPI?
我强迫它使用Python 2.7和
./configure --with-python=/usr/bin/python2.7
现在配置完成了,但有一些警告:
checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking for ranlib... ranlib
checking host overrides... no
checking fatal error on cancel of isend (--with-bad-cancel)... no
checking Assume stdin is interactive (--with-isatty)...
checking Append a newline to prompt (--with-prompt-nl)...
checking for mpcc... no
checking for mpxlc... no
checking for mpiicc... no
checking for mpicc... mpicc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... yes
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether mpicc accepts -g... yes
checking for mpicc option to accept ISO C89... none needed
checking for style of include used by make... GNU
checking dependency style of mpicc... none
checking for an ANSI C-conforming const... yes
checking for mpicc is really C++... checking how to run the C preprocessor... mpicc -E
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
no
checking for sed... /usr/bin/sed
checking for grep... (cached) /usr/bin/grep
checking for mpiCC... no
checking for mpi++... no
checking for mpicC... no
checking for g++... g++
configure: WARNING: using cross tools not prefixed with host triplet
checking whether we are using the GNU C++ compiler... yes
checking whether g++ accepts -g... yes
checking dependency style of g++... none
checking for mpicc... /home/krishnadev/.mpich-install/bin/mpicc
checking for g++... /usr/lib64/ccache/g++
checking if /home/krishnadev/.mpich-install/bin/mpicc -E -w is a valid CPP... yes
checking how to run the C preprocessor... /home/krishnadev/.mpich-install/bin/mpicc -E -w
checking for --with-python... yes
checking executable /usr/bin/python2.7... yes
checking for Python... /usr/bin/python2.7
checking for MPIRun.exe... no
checking for mpirun... /home/krishnadev/.mpich-install/bin/mpirun
checking for poe... no
checking Python version 2.2 or higher... yes
checking distutils?... yes
checking distutils works... yes
checking numpy?... yes
checking Numarray?...
checking Python version string... 2.7
checking Prefix exists...... no
configure: WARNING: Prefix /home/krishnadev/.pyMPI-install does not exist
checking for python include location... /usr/include/python2.7
checking that include directory exists... yes
checking for python library location... /usr/lib/python2.7/site-packages
checking that lib directory is accessable... yes
checking Python library... /usr/lib64/python2.7
checking site.py... /usr/lib64/python2.7/site.py
checking site-packages... /usr/lib64/python2.7/site-packages
checking for python lib/config location... /usr/lib64/python2.7/config
checking that lib/config directory is accessable... yes
checking libpython2.7 is there... yes
checking configuration Makefile is there... yes
checking module configuration table is there... yes
checking original Python there... yes
checking for numy include location... /usr/lib64/python2.7/site-packages/numpy/core/include
checking that include directory exists... yes
checking for --with-includes... -I/home/krishnadev/.mpich-install/include/
checking for compiler based include directory... no
checking MPI_COMPILE_FLAGS... no
checking MPI_LD_FLAGS... no
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking mpi.h usability... yes
checking mpi.h presence... yes
checking for mpi.h... yes
checking Python.h usability... yes
checking Python.h presence... yes
checking for Python.h... yes
checking Python CC... gcc -pthread
checking Python CFLAGS... -fno-strict-aliasing -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -DNDEBUG -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv
checking Python INCLUDEPY... /usr/include/python2.7
checking Python OPT... -DNDEBUG -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv
checking Python LDFLAGS... -Wl,-z,relro -specs=/usr/lib/rpm/redhat/redhat-hardened-ld
checking Python LINKFORSHARED... -Xlinker -export-dynamic
checking Python LDSHARED... gcc -pthread -shared -Wl,-z,relro -specs=/usr/lib/rpm/redhat/redhat-hardened-ld
checking Python BLDSHARED... gcc -pthread -shared -Wl,-z,relro -specs=/usr/lib/rpm/redhat/redhat-hardened-ld
checking Python LOCALMODLIBS...
checking Python BASEMODLIBS...
checking Python LIBS... -lpthread -ldl -lutil
checking Python LDLAST...
checking Python library options... -L/usr/lib64/python2.7/config -lpython2.7 -Wl,-z,relro -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -Xlinker -export-dynamic -lpthread -ldl -lutil
checking for --with-debug... no
checking python.exp file... no
checking sysconf(_SC_NPROCESSORS_CONF)... yes
checking for ANSI C header files... (cached) yes
checking local processor count for testing... 8
checking for --with-libs... -L /usr/lib64/python2.7/ -L/home/krishnadev/.mpich-install/lib/
checking for pow in -lm... no
checking for PyOS_StdioReadline... no
checking for setlinebuf... no
checking sys/param.h usability... yes
checking sys/param.h presence... yes
checking for sys/param.h... yes
checking Python links as is... no
checking for -pthread... no
checking for gcc libraries... Found /usr/lib/gcc/x86_64-redhat-linux/6.3.1/libgcc.a
checking _eprintf bug workaround... no
configure: WARNING: Python doesn't seem to link. Look at config.log. You may need to add --with-libs or --with-includes or just hack the Makefile
checking for MPI capability... no
checking if adding -lmpi helps... no
configure: WARNING: MPI must need some more libraries... Look at config.log. You may need to add --with-libs info
checking for Py_ReadOnlyBytecodeFlag... no
checking for MPI_Initialized()... no
checking for MPI_Finalized()... no
checking for MPI File operations (ROMIO)... no
checking for AIX dynamic load... no
checking pm_util.h usability... no
checking pm_util.h presence... no
checking for pm_util.h... no
checking for mpc_flush... no
checking for mpc_isatty... no
checking for Electric Fence enabled?... no
configure: creating ./config.status
config.status: creating Makefile
config.status: WARNING: 'Makefile.in' seems to ignore the --datarootdir setting
config.status: creating unittest/run-all-tests
config.status: creating softload_setup.py
config.status: creating pyMPI_Config.h
config.status: executing depfiles commands
/|_|_|_\ )
~^^^~~~~~~~~^^^~~^^~~~~~^ \
<vvvvvvvvvvvvvvvvvvvvvvvvvv> |
\ Putting the pie in MPI / |
\__\)\_________________/ |
\ ) / \__ _ _ _/
) / \_|_|_|/
但是,我仍然无法成功构建和安装 - 最后我收到以下错误:
/usr/bin/ld: libpyMPI.a(pyMPI_main.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC
libpyMPI.a: error adding symbols: Bad value
collect2: error: ld returned 1 exit status
Makefile:506: recipe for target 'pyMPI' failed
make: *** [pyMPI] Error 1
问题应该是什么以及如何解决?
另外,我应该如何使用 mpi4py 而不是 pyMPI ?文档说它是可能的:
Warp传统上与pyMPI一起使用,但也适用于mpi4py。
我通常会使用以下命令进行模拟:
mpirun -np 4 pyMPI warp_script.py
我使用 pip 安装 mpi4py ,但有人可以指导我使用它来代替 pyMPI 吗?
答案 0 :(得分:0)
通过在配置时传递以下参数来解决问题:
./configure --with-python=/usr/bin/python2.7 CFLAGS="-fPIC"
这特别强制使用Python 2.7,并且在构建时传递CFLAGS也消除了错误。