Error in building boost MPI in msvc 2010

北城余情 提交于 2019-12-02 06:47:33

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 ;
}

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.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!