MS-MPI+boost 编译

本文档介绍了如何在VS2012下配置和测试MS-MPI,以及如何下载并构建Boost_1_60。首先,通过运行mpiexe命令检查MPI是否正常工作。接着,详细说明了设置MPI的包含目录和链接目录的过程。然后,指导如何下载Boost,修改配置文件,并完成编译。最后,将Boost添加到项目的包含目录和链接库中,以确保一切正常。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

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: ” (MSM

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值