LBIBCell
Main Page
Tutorials
Related Pages
Classes
Files
File List
All
Classes
Functions
Variables
Friends
Pages
MPIProxy.cpp
1
/* Copyright (c) 2013 David Sichau <mail"at"sichau"dot"eu>
2
*
3
* Permission is hereby granted, free of charge, to any person obtaining a copy
4
* of this software and associated documentation files (the "Software"), to deal
5
* in the Software without restriction, including without limitation the rights
6
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
* copies of the Software, and to permit persons to whom the Software is
8
* furnished to do so, subject to the following conditions:
9
*
10
* The above copyright notice and this permission notice shall be included in
11
* all copies or substantial portions of the Software.
12
*
13
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
14
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
15
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
16
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
17
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
18
* THE SOFTWARE.
19
*
20
*/
21
#include <UtilLib/config.hpp>
22
#include <UtilLib/include/MPIProxy.hpp>
23
#include <UtilLib/include/Exception.hpp>
24
#include <vector>
25
26
namespace
UtilLib {
27
int
MPIProxy_::_rank = 0;
28
int
MPIProxy_::_size = 1;
29
30
MPIProxy_::MPIProxy_() {
31
#ifdef ENABLE_MPI
32
mpi::communicator world;
33
_rank = world.rank();
34
_size = world.size();
35
#endif
36
}
37
38
MPIProxy_::~MPIProxy_
() {}
39
40
int
MPIProxy_::getRank
()
const
{
41
return
_rank;
42
}
43
44
int
MPIProxy_::getSize
()
const
{
45
return
_size;
46
}
47
48
void
MPIProxy_::barrier
() {
49
#ifdef ENABLE_MPI
50
mpi::communicator world;
51
world.barrier();
52
#endif
53
}
54
55
void
MPIProxy_::waitAll
() {
56
#ifdef ENABLE_MPI
57
LOG(utilities::logDEBUG4) <<
"wait all called with: "
<<
58
_mpiStatus.size() <<
" mpi statues"
;
59
mpi::wait_all(_mpiStatus.begin(), _mpiStatus.end());
60
61
_mpiStatus.clear();
62
63
#endif
64
}
65
66
#ifdef ENABLE_MPI
67
std::vector<boost::mpi::request> MPIProxy_::_mpiStatus;
68
#endif
69
}
/* end namespace */
UtilLib::MPIProxy_::~MPIProxy_
virtual ~MPIProxy_()
Definition:
MPIProxy.cpp:38
UtilLib::MPIProxy_::getRank
int getRank() const
Definition:
MPIProxy.cpp:40
UtilLib::MPIProxy_::barrier
void barrier()
Definition:
MPIProxy.cpp:48
UtilLib::MPIProxy_::getSize
int getSize() const
Definition:
MPIProxy.cpp:44
UtilLib::MPIProxy_::waitAll
void waitAll()
Definition:
MPIProxy.cpp:55
libs
UtilLib
src
MPIProxy.cpp
Generated on Tue Mar 10 2015 18:14:25 for LBIBCell by
1.8.6