MS-MPI+boost 编译
来源:互联网 发布:mysql解压版配置 编辑:程序博客网 时间:2024/05/29 04:11
First, the MPI should work, Before using Boost MPI, the computer should have a working MPI implementation. Boost MPI should work with any MPI implementation. The following codes can be used to test if there is a working MPI in the current computer:
#include "stdafx.h"#include <mpi.h>#include <iostream>int main(int argc, char** argv){ MPI_Init(&argc, &argv); int rank; MPI_Comm_rank(MPI_COMM_WORLD, &rank); if (rank == 0) { int value = 17; int result = MPI_Send(&value, 1, MPI_INT, 1, 0, MPI_COMM_WORLD); if (result == MPI_SUCCESS) std::cout << "Rank 0 OK!" << std::endl; } else if (rank == 1) { int value; int result = MPI_Recv(&value, 1, MPI_INT, 0, 0, MPI_COMM_WORLD, MPI_STATUS_IGNORE); if (result == MPI_SUCCESS && value == 17) std::cout << "Rank 1 OK!" << std::endl; } MPI_Finalize(); return 0;}
Under MS-MPI with VS2012. Go to the project folder and run: mpiexe -np -2 (+name of .exe). The output should be:
Rank 0 OK!
Rank 1 OK!
If we saw this, indicating there is a working MPI implementation and we can go to the next. Otherwise, we need to install a MPI implementation, taking MS-MPI as an example.
首先mpi: (详细步骤见:http://blogs.technet.com/b/windowshpc/archive/2015/02/02/how-to-compile-and-run-a-simple-ms-mpi-program.aspx)
1: 下载,安装MS-MPI SDK
2: 新建一个 Visual C++ Win32 Console Application project.
3: set include directories: for 64 bits: include: ”
for 32 bits: include”
4: set link directories: add “msmpi.lib” to the additional dependencies;
for 64 bits: add
==================So far, MPI should work==============================
Next, build boost_1_60:
1: Download boost_1_60_0,Unzip it to (http://www.boost.org/users/history/version_1_60_0.html)
2: Modify the setting of build boost engine:
boost_1_60_0\tools\build\src\tools\mpi.jam249-251 linelocal microsoft_mpi_sdk_path = "C:\\Program Files (x86)\\Microsoft SDKs\\MPI" ;local microsoft_mpi_path = "C:\\Program Files\\Microsoft MPI" ;if [ GLOB $(microsoft_mpi_sdk_path)\\Include : mpi.h ]260-262 lineoptions = <include>$(microsoft_mpi_sdk_path)/Include <address-model>64:<library-path>$(microsoft_mpi_sdk_path)/Lib/x64 <library-path>$(microsoft_mpi_sdk_path)/Lib/x86268 line.mpirun = "\"$(microsoft_mpi_path)\\Bin\\mpiexec.exe"\" ;
3: Start the developer command prompt of Visual Studio with administrator privileges.
go to boost folder and run:
bootstrap.bat
4: A new file of poject-config.jam is generated, modify it by adding
“using mpi ;”
in line 4.
5: run:
b2.exe toolset=msvc-11.0 address-model=64
After step 5, there are two new folders are generated: one is stage and the other one is bin.v2.
6: add boost into additional include directories(c/c++->general).
for example: the folder is:
c:\program files\boost_1_60_0\boost_1_60_0;
Then, go to “linker”-all options-additional library directories: add
c:\program files\boost_1_60_0\boost_1_60_0\stage\lib:
, then it is done. and test the following codes:
#include "stdafx.h"#include <boost/mpi/environment.hpp>#include <boost/mpi/communicator.hpp>#include <iostream>namespace mpi = boost::mpi;int main(){ mpi::environment env; mpi::communicator world; std::cout << "I am process " << world.rank() << " of " << world.size() << "." << std::endl; return 0;}
run above code using 20 cpus and the output is:
- MS-MPI+boost 编译
- 编译boost mpi
- boost mpi编译
- boost mpi编译2
- linux编译boost mpi 出错
- minGW编译boost mpi注意事项
- Boost MPI 介绍
- Application of Boost MPI
- Boost MPI scatter
- Boost mpi gatherv example
- mpi及boost mpi测试例子
- windows MS-MPI 的使用
- mpi编译Boost生成so文件出错:failed gcc.link.dll解决方法
- boost mpi 简单例子测试
- Windows 下配置Boost MPI
- Boost MPI send and recv
- MPI编译环境配置
- MPI--MPI+VS2010 配置及编译
- iOS 开发 -- Swift (七) 函数
- 如何将python程序封装成exe可执行文件
- java对图片进行缩放并保存
- jqgrid--获取所有选中的行并删除之
- CoreFoundation于Foundation对象转换
- MS-MPI+boost 编译
- SearchView---搜索
- Codeforces Round #247 (Div. 2)(A)模拟
- struts2 Result 类型说明
- Treap和Splay学习小结
- 网站性能检测工具 -xhprof
- 杀手级应用,靠产品还是运营?
- List
- Android最强的广告轮播