|
Boost Users : |
Subject: Re: [Boost-users] mpi non-blocking communication
From: Hicham Mouline (hicham_at_[hidden])
Date: 2010-12-06 05:58:08
> (1) You must initialize MPI with MPI_Init_thread() instead ofÂ
>MPI_Init(). Â The boost::mpi::communicator ctor uses MPI_Init(), so youÂ
>must run the initialization yourself and *then* create theÂ
>communicator object. Â For instance::Â
>Â Â Â MPI_Init_thread(&argc, &argv, MPI_THREAD_SERIALIZED)Â
>Â Â Â // ...Â
>Â Â Â mpi::communicator world;Â
Riccardo,
I have the following code in my main:
int main(int argc, char* argv[])
{
boost::mpi::environment env(argc, argv);
const int mpi_thread_support = MPI::Init_thread(argc, argv, MPI_THREAD_SERIALIZED );
if (mpi_thread_support != MPI_THREAD_SERIALIZED)
{
std::cerr<< "MPI implementation does not support threads" <<std::endl;
return 1;
}
boost::mpi::communicator world;
...
}
This prints an error however:
Calling MPI_Init or MPI_Init_thread twice is erroneous.
How does 1 avoid that the mpi::communicator constructor calling MPI_INIT twice?
Perhaps it's the environment constructor that calls MPI_INIT?
rds,
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net