Message Passing Interface有人用过没
我有几个问题。
1.从这儿下的源码,不知道怎么使用和编译http://www.open-mpi.org/
2.使用boost库中的MPI
// boostMPI_test.cpp : 定义控制台应用程序的入口点。
//
#include "stdafx.h"
#include <boost/interprocess/shared_memory_object.hpp>
#include <boost/interprocess/mapped_region.hpp>
#include <iostream>
using namespace boost::interprocess;
int _tmain(int argc, _TCHAR* argv[])
{
try
{
shared_memory_object sharedmem1(create_only,
"Hello",
read_write);
sharedmem1.truncate(256);
mapped_region mmap(sharedmem1 , read_write , 256);
char * str = static_cast<char*>(mmap.get_address());
assert(str);
strcpy_s( str , -1 , "Hello world!\n");
system("pause");
}
catch (interprocess_exception & e)
{
std::cout<<e.what()<<std::endl;
shared_memory_object::remove("Hello");
}
return 0;
}