|
@@ -3,19 +3,19 @@
|
|
|
|
|
|
namespace pvfmm {
|
|
namespace pvfmm {
|
|
|
|
|
|
-Comm::Comm() {
|
|
|
|
|
|
+inline Comm::Comm() {
|
|
#ifdef PVFMM_HAVE_MPI
|
|
#ifdef PVFMM_HAVE_MPI
|
|
Init(MPI_COMM_SELF);
|
|
Init(MPI_COMM_SELF);
|
|
#endif
|
|
#endif
|
|
}
|
|
}
|
|
|
|
|
|
-Comm::Comm(const Comm& c) {
|
|
|
|
|
|
+inline Comm::Comm(const Comm& c) {
|
|
#ifdef PVFMM_HAVE_MPI
|
|
#ifdef PVFMM_HAVE_MPI
|
|
Init(c.mpi_comm_);
|
|
Init(c.mpi_comm_);
|
|
#endif
|
|
#endif
|
|
}
|
|
}
|
|
|
|
|
|
-Comm Comm::Self() {
|
|
|
|
|
|
+inline Comm Comm::Self() {
|
|
#ifdef PVFMM_HAVE_MPI
|
|
#ifdef PVFMM_HAVE_MPI
|
|
Comm comm_self(MPI_COMM_SELF);
|
|
Comm comm_self(MPI_COMM_SELF);
|
|
return comm_self;
|
|
return comm_self;
|
|
@@ -25,7 +25,7 @@ Comm Comm::Self() {
|
|
#endif
|
|
#endif
|
|
}
|
|
}
|
|
|
|
|
|
-Comm Comm::World() {
|
|
|
|
|
|
+inline Comm Comm::World() {
|
|
#ifdef PVFMM_HAVE_MPI
|
|
#ifdef PVFMM_HAVE_MPI
|
|
Comm comm_world(MPI_COMM_WORLD);
|
|
Comm comm_world(MPI_COMM_WORLD);
|
|
return comm_world;
|
|
return comm_world;
|
|
@@ -35,13 +35,13 @@ Comm Comm::World() {
|
|
#endif
|
|
#endif
|
|
}
|
|
}
|
|
|
|
|
|
-Comm& Comm::operator=(const Comm& c) {
|
|
|
|
|
|
+inline Comm& Comm::operator=(const Comm& c) {
|
|
#ifdef PVFMM_HAVE_MPI
|
|
#ifdef PVFMM_HAVE_MPI
|
|
Init(c.mpi_comm_);
|
|
Init(c.mpi_comm_);
|
|
#endif
|
|
#endif
|
|
}
|
|
}
|
|
|
|
|
|
-Comm::~Comm() {
|
|
|
|
|
|
+inline Comm::~Comm() {
|
|
#ifdef PVFMM_HAVE_MPI
|
|
#ifdef PVFMM_HAVE_MPI
|
|
while (!req.empty()) {
|
|
while (!req.empty()) {
|
|
delete (Vector<MPI_Request>*)req.top();
|
|
delete (Vector<MPI_Request>*)req.top();
|
|
@@ -51,7 +51,7 @@ Comm::~Comm() {
|
|
#endif
|
|
#endif
|
|
}
|
|
}
|
|
|
|
|
|
-Comm Comm::Split(Integer clr) const {
|
|
|
|
|
|
+inline Comm Comm::Split(Integer clr) const {
|
|
#ifdef PVFMM_HAVE_MPI
|
|
#ifdef PVFMM_HAVE_MPI
|
|
MPI_Comm new_comm;
|
|
MPI_Comm new_comm;
|
|
MPI_Comm_split(mpi_comm_, clr, mpi_rank_, &new_comm);
|
|
MPI_Comm_split(mpi_comm_, clr, mpi_rank_, &new_comm);
|
|
@@ -64,7 +64,7 @@ Comm Comm::Split(Integer clr) const {
|
|
#endif
|
|
#endif
|
|
}
|
|
}
|
|
|
|
|
|
-Integer Comm::Rank() const {
|
|
|
|
|
|
+inline Integer Comm::Rank() const {
|
|
#ifdef PVFMM_HAVE_MPI
|
|
#ifdef PVFMM_HAVE_MPI
|
|
return mpi_rank_;
|
|
return mpi_rank_;
|
|
#else
|
|
#else
|
|
@@ -72,7 +72,7 @@ Integer Comm::Rank() const {
|
|
#endif
|
|
#endif
|
|
}
|
|
}
|
|
|
|
|
|
-Integer Comm::Size() const {
|
|
|
|
|
|
+inline Integer Comm::Size() const {
|
|
#ifdef PVFMM_HAVE_MPI
|
|
#ifdef PVFMM_HAVE_MPI
|
|
return mpi_size_;
|
|
return mpi_size_;
|
|
#else
|
|
#else
|
|
@@ -80,7 +80,7 @@ Integer Comm::Size() const {
|
|
#endif
|
|
#endif
|
|
}
|
|
}
|
|
|
|
|
|
-void Comm::Barrier() const {
|
|
|
|
|
|
+inline void Comm::Barrier() const {
|
|
#ifdef PVFMM_HAVE_MPI
|
|
#ifdef PVFMM_HAVE_MPI
|
|
MPI_Barrier(mpi_comm_);
|
|
MPI_Barrier(mpi_comm_);
|
|
#endif
|
|
#endif
|
|
@@ -130,7 +130,7 @@ template <class RType> void* Comm::Irecv(Iterator<RType> rbuf, Long rcount, Inte
|
|
#endif
|
|
#endif
|
|
}
|
|
}
|
|
|
|
|
|
-void Comm::Wait(void* req_ptr) const {
|
|
|
|
|
|
+inline void Comm::Wait(void* req_ptr) const {
|
|
#ifdef PVFMM_HAVE_MPI
|
|
#ifdef PVFMM_HAVE_MPI
|
|
if (req_ptr == NULL) return;
|
|
if (req_ptr == NULL) return;
|
|
Vector<MPI_Request>& request = *(Vector<MPI_Request>*)req_ptr;
|
|
Vector<MPI_Request>& request = *(Vector<MPI_Request>*)req_ptr;
|
|
@@ -903,14 +903,14 @@ template <class Type> void Comm::ScatterReverse(Vector<Type>& data_, const Vecto
|
|
}
|
|
}
|
|
|
|
|
|
#ifdef PVFMM_HAVE_MPI
|
|
#ifdef PVFMM_HAVE_MPI
|
|
-Vector<MPI_Request>* Comm::NewReq() const {
|
|
|
|
|
|
+inline Vector<MPI_Request>* Comm::NewReq() const {
|
|
if (req.empty()) req.push(new Vector<MPI_Request>);
|
|
if (req.empty()) req.push(new Vector<MPI_Request>);
|
|
Vector<MPI_Request>& request = *(Vector<MPI_Request>*)req.top();
|
|
Vector<MPI_Request>& request = *(Vector<MPI_Request>*)req.top();
|
|
req.pop();
|
|
req.pop();
|
|
return &request;
|
|
return &request;
|
|
}
|
|
}
|
|
|
|
|
|
-void Comm::DelReq(Vector<MPI_Request>* req_ptr) const {
|
|
|
|
|
|
+inline void Comm::DelReq(Vector<MPI_Request>* req_ptr) const {
|
|
if (req_ptr) req.push(req_ptr);
|
|
if (req_ptr) req.push(req_ptr);
|
|
}
|
|
}
|
|
|
|
|