问题
I am very frustrated after a whole week of trying everything imaginable and unimaginable, it seems that their SDK ( https://www.microsoft.com/en-us/download/details.aspx?id=57467 ) is missing something:
C:\Anaconda3\PCbuild\amd64 /LIBPATH:build\temp.win-amd64-3.7 "/LIBPATH:C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\LIB\amd64" "/LIBPATH:C:\Program Files (x86)\Windows Kits\10\lib\10.0.17763
.0\ucrt\x64" "/LIBPATH:C:\Program Files (x86)\Windows Kits\10\lib\10.0.17763.0\um\x64" "/LIBPATH:C:\Program Files (x86)\Microsoft SDKs\MPI\Lib\x64" msmpi.lib /EXPORT:PyInit_MPI build\temp.win-amd64-3.
7\Release\src/MPI.obj /OUT:build\lib.win-amd64-3.7\mpi4py\MPI.cp37-win_amd64.pyd /IMPLIB:build\temp.win-amd64-3.7\Release\src\MPI.cp37-win_amd64.lib
MPI.obj : warning LNK4197: export 'PyInit_MPI' specified multiple times; using first specification
Creating library build\temp.win-amd64-3.7\Release\src\MPI.cp37-win_amd64.lib and object build\temp.win-amd64-3.7\Release\src\MPI.cp37-win_amd64.exp
MPI.obj : error LNK2001: unresolved external symbol MPI_Ireduce_scatter
MPI.obj : error LNK2001: unresolved external symbol MPI_Iallgatherv
MPI.obj : error LNK2001: unresolved external symbol MPI_Iexscan
MPI.obj : error LNK2001: unresolved external symbol MPI_Iscan
MPI.obj : error LNK2001: unresolved external symbol MPI_Ialltoallw
MPI.obj : error LNK2001: unresolved external symbol MPI_Ireduce_scatter_block
MPI.obj : error LNK2001: unresolved external symbol MPI_Ialltoall
MPI.obj : error LNK2001: unresolved external symbol MPI_Ialltoallv
MPI.obj : error LNK2001: unresolved external symbol MPI_Reduce_scatter_block
build\lib.win-amd64-3.7\mpi4py\MPI.cp37-win_amd64.pyd : fatal error LNK1120: 9 unresolved externals
error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\BIN\\x86_amd64\\link.exe' failed with exit status 1120
If it's really impossible to make it work, then tell me which distribution of MPI should I use instead of Microfost MPI, since https://www.mpich.org/downloads/ does not provide any alternatives for Windows.
P.S.: mpi4py 2.0.0 is incompatible with python 3.7 (at least Anaconda tells me so), so I 'll rather choose another distribution of MPICH (if there is one) than downgrade my python.
回答1:
I've got it working with 3.7.0...
I downloaded MSMPI from https://www.microsoft.com/en-us/download/details.aspx?id=57467 I ran both files, then added it to the PATH (C:\Program Files (x86)\Microsoft SDKs\MPI)
I then just used python -m pip install mpi4py
To run a MPI program, I then us mpiexec -n [number of cores] python .\filename
I'm running on a AMD A-10 9600P in Windows 10.
I do have Visual Studio installed, so it's possible that it's hooking into some libs you don't have...
回答2:
I got it to work finally:
- Make sure that you download and install both msmpisdk.msi and msmpisetup.exe from the Microsoft MPI for v10.
- Add both C:\Program Files (x86)\Microsoft SDKs\MPI and C:\Program Files\Microsoft MPI\Bin to system PATH.
- (Optional) Restart the cmd window and reinstall mpi4py
来源:https://stackoverflow.com/questions/54386910/microsoft-mpi-and-mpi4py-3-0-0-python-3-7-1-is-it-currently-possible-at-all