Error in building boost MPI in msvc 2010

2019-03-02 13:03发布

I have installed openmpi in C:\Program Files\OpenMPI_v1.5.4-win32\ and want to compile boost to produce graph-parallel library. But got the following error:

The system cannot find the path specified.
The system cannot find the path specified.
The system cannot find the path specified.
The system cannot find the path specified.
MPI auto-detection failed: unknown wrapper compiler C:/Program Files/OpenMPI_v1.
5.4-win32/bin/mpic++.exe
Please report this error to the Boost mailing list: http://www.boost.org
You will need to manually configure MPI support.
MPI launcher: mpirun -np

when I ran in a Visual Studio 2010 command prompt:

b2 --toolset=msvc-10.0 --build-type=complete architecture=x86 address-model=32 stage --debug-configuration

I added the MPI config in boost_1_48_0\tools\build\v2\user-config.jam as below:

using mpi : "C:/Program Files/OpenMPI_v1.5.4-win32/bin/mpic++.exe" ;

I believe this similar question has been asked before but got no answer:

How to build boost::mpi library with Open MPI on Windows with Visual Studio 2010

2条回答
仙女界的扛把子
2楼-- · 2019-03-02 13:30

I encountered the same problem and solved it with Microsoft MPI. I use boost 1.61.0 and Microsoft MPI v7.1 (available at https://www.microsoft.com/en-us/download/details.aspx?id=52981). Download and install the SDK and MsMpi Setup.

I made the same changes as William proposed to the mpi.jam file which is located in tools/build/src/tools.

I added the

using mpi ;

command to the user-config.jam, which should be located in your user directory. Otherwise go to tools/build/src and move the user-config.jam file located there into your user directory. Adding

using mpi : C:\\Program Files\\Microsoft MPI\\Bin\\mpiexec.exe ;

leads to multiple errors. First of all, whitespaces are not allowed in the .jam files and second, if i locate the file in a path without whitespaces, like

using mpi : C:\\MicrosoftMPI\\Bin\\mpiexec.exe ;

leads to the error report that the mpi.jam file is already in use by another process. Adding qotation marks to the path does not help either. But it worked with the using mpi; statement, without any additions.

Make sure the MPI SDK Include, Lib and the MPI Bin directory are listed in your path environment variable.

The next step is to build boost.MPI. Open up a command prompt in the boost root directory and invoke bjam with your desired parameters and --with-mpi. Be careful to specify the variant=debug or variant=release flag, since you will get a nameclash error otherwise. (See here for details http://lists.boost.org/boost-build/2009/12/22854.php).

That's what solved it for me.

查看更多
冷血范
3楼-- · 2019-03-02 13:45

If you don't mind, you could use the MS MPI v6, downdload from here https://www.microsoft.com/en-us/download/details.aspx?id=47259

Then you need to make some adjustment to the mpi.jam file. For older version of boost, the mpi.jam is in folder tools/build/v2/tools/, and for new version of boost, it is in tools/build/src/tools/.

Around line 248, you need to make the following adjustment. Due to MS separate the API with the HPC.

local win_ms_mpi_sdk = "C:\\Program Files (x86)\\Microsoft SDKs\\MPI" ;
local win_ms_mpi = "C:\\Program Files\\Microsoft MPI" ;

#local cluster_pack_path_native = "C:\\Program Files\\Microsoft Compute Cluster Pack" ;
#local cluster_pack_path = [ path.make $(cluster_pack_path_native) ] ;
if [ GLOB $(win_ms_mpi_sdk)\\Include : mpi.h ]
{
  if $(.debug-configuration)
  {
    ECHO "Found Microsoft Compute Cluster Pack: $(cluster_pack_path_native)" ;
  }

  # Pick up either the 32-bit or 64-bit library, depending on which address
  # model the user has selected. Default to 32-bit.
  options = <include>$(win_ms_mpi_sdk)/Include 
            <address-model>64:<library-path>$(win_ms_mpi_sdk)/Lib/x64
            <library-path>$(win_ms_mpi_sdk)/Lib/x86
            <find-static-library>msmpi
            <toolset>msvc:<define>_SECURE_SCL=0
          ;

  # Setup the "mpirun" equivalent (mpiexec)
  .mpirun = "\"$(win_ms_mpi)\\Bin\\mpiexec.exe"\" ;
  .mpirun_flags = -n ;
}
查看更多
登录 后发表回答