1.下载
msmpisdk.msi
msmpisetup.exe
下载地址:https://docs.microsoft.com/en-us/message-passing-interface/microsoft-mpi?redirectedfrom=MSDN
2.安装
注意事项:安装时,一定要使用默认的安装目录。原因:因为boost的E:\boost_install\boost_1_74_0\tools\build\src\tools\mpi.jam 文件中的目录是“安装时的默认目录”)
3.boost 编译 mpi
参考boost官方文档:
./boost_1_74_0/doc/html/mpi.html 点击 Configure and Build
在E:\boost_install\boost_1_74_0\ project-config.jam 中添加 using mpi ;
原文:
As explained in the boost installation instructions, running the bootstrap (./bootstrap.sh for unix variants or bootstrap.bat for Windows) from the boost root directory will produce a 'project-config.jam` file. You need to edit that file and add the following line:
using mpi ;
(注意:mpi 后一定时空格+分号,没有空格会失败)
如图:
进入到boost目录,执行
b2 --stagedir="./stage/142" --build-type=complete toolset=msvc-14.2 threading=multi link=static address-model=32
下载Boost源代码与安装VS
博主使用的是版本boost_1_61_0、vs2008或者vs2010
1.解压boost文件,使用编译器的命令行进入解压后的根目录
2.敲入命令.\bootstrap.bat (on Windows)或者./bootstrap.sh (on other operating systems)
3.执行./b2 install --prefix=PREFIX
PREFIX就是你要安装的目录位置,Win32默认在 C:\Boost;Unix默认在 /usr/local on Unix. Linux
4.可选的。可以将PREFIX/bin设置为环境变量方便使用
下面就是开始boost的hello之旅了
http://blog.csdn.net/xinqingwuji/article/details/51737177
博主使用的命令:b2 stage --toolset=msvc-9.0 variant=debug link=shared threading=multi runtime-link=shared
20170420补充
使用动态库链接还是乖乖的,运行时还需要一堆动态库,后来还是从了静态库。。。。
修改为b2 install --toolset=msvc-10.0 variant=debug link=static threading=multi runtime-link=shared
仅供参看,使用都是动态链接
详细解释:
第二步执行后在boost根目录(也是bootstrap.bat的目录)下会生成b2.exe、bjam.exe、project-config.jam、bootstrap.log四个文件。
第三步执行的是默认安装。可以键入b2 --help来查看编译的配置情况。
博主参考的配置参数:
b2 stage/install
重要参数说明:
[install|stage]:
stage:只在stage目录下放置编译的库文件,可以由--stagedir=<STAGEDIR>选项来指定目录。默认是根目录stage目录下。
install:会生成一些boost的头文件目录include文件,直接使用。
toolset:
win32下的版本msvc-6.0 : VC6.0 msvc-7.0: VS2003 msvc-8.0: VS2005 msvc-9.0: VS2008 msvc-10.0: VS2010
--with-<library>:指定编译的库--without-<library>:指定不编译的库。默认是全编译的
--show-libraries:显示需要编译的全部库文件
variant=debug|release 编译的版本debug或者release
link=static|shared 静态或者动态编译库
threading=single|multi 单线程或者多线程。一般当然还是多线程环境多。
runtime-link=static|shared 静态链接或者动态链接C/C++运行库
--build-type=<type>:
complete 编译所有可能的变量,相当于variant=release,threading=multi;link=shared|static;runtime-link=shared
Boost库命名特点:
1.包含boost单词
2.link=static,生成的库lib开头,然后再接boost
3.threading=mult,生成的库加入关键词-mt
4.variant=debug,生成的库加入关键词-gd
5.runtime-link=static,生成的库加入关键词-s
b2的全部参数
Usage:
b2 [options] [properties] [install|stage]
Builds and installs Boost.
Targets and Related Options:
install Install headers and compiled library files to the
======= configured locations (below).
--prefix=<PREFIX> Install architecture independent files here.
Default; C:\Boost on Win32
Default; /usr/local on Unix. Linux, etc.
--exec-prefix=<EPREFIX> Install architecture dependent files here.
Default; <PREFIX>
--libdir=<DIR> Install library files here.
Default; <EPREFIX>/lib
--includedir=<HDRDIR> Install header files here.
Default; <PREFIX>/include
stage Build and install only compiled library files to the
===== stage directory.
--stagedir=<STAGEDIR> Install library files here
Default; ./stage
Other Options:
--build-type=<type> Build the specified pre-defined set of variations of
the libraries. Note, that which variants get built
depends on what each library supports.
-- minimal -- (default) Builds a minimal set of
variants. On Windows, these are static
multithreaded libraries in debug and release
modes, using shared runtime. On Linux, these are
static and shared multithreaded libraries in
release mode.
-- complete -- Build all possible variations.
--build-dir=DIR Build in this location instead of building within
the distribution tree. Recommended!
--show-libraries Display the list of Boost libraries that require
build and installation steps, and then exit.
--layout=<layout> Determine whether to choose library names and header
locations such that multiple versions of Boost or
multiple compilers can be used on the same system.
-- versioned -- Names of boost binaries include
the Boost version number, name and version of
the compiler and encoded build properties. Boost
headers are installed in a subdirectory of
<HDRDIR> whose name contains the Boost version
number.
-- tagged -- Names of boost binaries include the
encoded build properties such as variant and
threading, but do not including compiler name
and version, or Boost version. This option is
useful if you build several variants of Boost,
using the same compiler.
-- system -- Binaries names do not include the
Boost version number or the name and version
number of the compiler. Boost headers are
installed directly into <HDRDIR>. This option is
intended for system integrators building
distribution packages.
The default value is 'versioned' on Windows, and
'system' on Unix.
--buildid=ID Add the specified ID to the name of built libraries.
The default is to not add anything.
--python-buildid=ID Add the specified ID to the name of built libraries
that depend on Python. The default is to not add
anything. This ID is added in addition to --buildid.
--help This message.
--with-<library> Build and install the specified <library>. If this
option is used, only libraries specified using this
option will be built.
--without-<library> Do not build, stage, or install the specified
<library>. By default, all libraries are built.
Properties:
toolset=toolset Indicate the toolset to build with.
variant=debug|release Select the build variant
link=static|shared Whether to build static or shared libraries
threading=single|multi Whether to build single or multithreaded binaries
runtime-link=static|shared
Whether to link to static or shared C and C++
runtime.