A
lgorithmique
N
umérique
D
istribuée
Public GIT Repository
projects
/
simgrid.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
| inline |
side by side
Use (const) references with range-based for loops.
[simgrid.git]
/
src
/
smpi
/
mpi
/
smpi_request.cpp
diff --git
a/src/smpi/mpi/smpi_request.cpp
b/src/smpi/mpi/smpi_request.cpp
index
a4c0a36
..
4f57f6d
100644
(file)
--- a/
src/smpi/mpi/smpi_request.cpp
+++ b/
src/smpi/mpi/smpi_request.cpp
@@
-221,11
+221,11
@@
MPI_Request Request::rma_recv_init(void *buf, int count, MPI_Datatype datatype,
{
MPI_Request request = nullptr; /* MC needs the comm to be set to nullptr during the call */
if(op==MPI_OP_NULL){
- request = new Request(buf
==MPI_BOTTOM ? nullptr : buf, count, datatype, src, dst, tag
,
-
comm,
RMA | NON_PERSISTENT | RECV | PREPARED);
+ request = new Request(buf
== MPI_BOTTOM ? nullptr : buf, count, datatype, src, dst, tag, comm
,
+ RMA | NON_PERSISTENT | RECV | PREPARED);
}else{
- request = new Request(buf
==MPI_BOTTOM ? nullptr : buf, count, datatype, src, dst, tag
,
-
comm,
RMA | NON_PERSISTENT | RECV | PREPARED | ACCUMULATE);
+ request = new Request(buf
== MPI_BOTTOM ? nullptr : buf, count, datatype, src, dst, tag, comm
,
+ RMA | NON_PERSISTENT | RECV | PREPARED | ACCUMULATE);
request->op_ = op;
}
return request;
@@
-233,16
+233,16
@@
MPI_Request Request::rma_recv_init(void *buf, int count, MPI_Datatype datatype,
MPI_Request Request::irecv_init(void *buf, int count, MPI_Datatype datatype, int src, int tag, MPI_Comm comm)
{
- return new Request(buf
==MPI_BOTTOM ? nullptr : buf, count, datatype, src == MPI_ANY_SOURCE ? MPI_ANY_SOURCE :
-
comm->group()->index(src), smpi_process()->index(), tag,
-
comm, PERSISTENT | RECV | PREPARED);
+ return new Request(buf
== MPI_BOTTOM ? nullptr : buf, count, datatype,
+
src == MPI_ANY_SOURCE ? MPI_ANY_SOURCE :
comm->group()->index(src), smpi_process()->index(), tag,
+ comm, PERSISTENT | RECV | PREPARED);
}
MPI_Request Request::isend(void *buf, int count, MPI_Datatype datatype, int dst, int tag, MPI_Comm comm)
{
MPI_Request request = nullptr; /* MC needs the comm to be set to nullptr during the call */
- request
= new Request(buf==
MPI_BOTTOM ? nullptr : buf, count, datatype, smpi_process()->index(),
-
comm->group()->index(dst), tag, comm, NON_PERSISTENT | ISEND | SEND);
+ request
= new Request(buf ==
MPI_BOTTOM ? nullptr : buf, count, datatype, smpi_process()->index(),
+ comm->group()->index(dst), tag, comm, NON_PERSISTENT | ISEND | SEND);
request->start();
return request;
}
@@
-250,8
+250,8
@@
MPI_Request Request::isend(void *buf, int count, MPI_Datatype datatype, int dst,
MPI_Request Request::issend(void *buf, int count, MPI_Datatype datatype, int dst, int tag, MPI_Comm comm)
{
MPI_Request request = nullptr; /* MC needs the comm to be set to nullptr during the call */
- request
= new Request(buf==
MPI_BOTTOM ? nullptr : buf, count, datatype, smpi_process()->index(),
- comm->group()->index(dst), tag,comm, NON_PERSISTENT | ISEND | SSEND | SEND);
+ request
= new Request(buf ==
MPI_BOTTOM ? nullptr : buf, count, datatype, smpi_process()->index(),
+ comm->group()->index(dst), tag,
comm, NON_PERSISTENT | ISEND | SSEND | SEND);
request->start();
return request;
}
@@
-260,9
+260,9
@@
MPI_Request Request::issend(void *buf, int count, MPI_Datatype datatype, int dst
MPI_Request Request::irecv(void *buf, int count, MPI_Datatype datatype, int src, int tag, MPI_Comm comm)
{
MPI_Request request = nullptr; /* MC needs the comm to be set to nullptr during the call */
- request
= new Request(buf==MPI_BOTTOM ? nullptr : buf, count, datatype, src == MPI_ANY_SOURCE ? MPI_ANY_SOURCE :
-
comm->group()->index(src), smpi_process()->index(), tag, comm
,
-
NON_PERSISTENT | RECV);
+ request
= new Request(buf == MPI_BOTTOM ? nullptr : buf, count, datatype,
+
src == MPI_ANY_SOURCE ? MPI_ANY_SOURCE : comm->group()->index(src), smpi_process()->index()
,
+
tag, comm,
NON_PERSISTENT | RECV);
request->start();
return request;
}
@@
-278,8
+278,8
@@
void Request::recv(void *buf, int count, MPI_Datatype datatype, int src, int tag
void Request::send(void *buf, int count, MPI_Datatype datatype, int dst, int tag, MPI_Comm comm)
{
MPI_Request request = nullptr; /* MC needs the comm to be set to nullptr during the call */
- request
= new Request(buf==
MPI_BOTTOM ? nullptr : buf, count, datatype, smpi_process()->index(),
-
comm->group()->index(dst), tag, comm, NON_PERSISTENT | SEND);
+ request
= new Request(buf ==
MPI_BOTTOM ? nullptr : buf, count, datatype, smpi_process()->index(),
+ comm->group()->index(dst), tag, comm, NON_PERSISTENT | SEND);
request->start();
wait(&request, MPI_STATUS_IGNORE);
@@
-289,8
+289,8
@@
void Request::send(void *buf, int count, MPI_Datatype datatype, int dst, int tag
void Request::ssend(void *buf, int count, MPI_Datatype datatype, int dst, int tag, MPI_Comm comm)
{
MPI_Request request = nullptr; /* MC needs the comm to be set to nullptr during the call */
- request
= new Request(buf==
MPI_BOTTOM ? nullptr : buf, count, datatype, smpi_process()->index(),
-
comm->group()->index(dst), tag, comm, NON_PERSISTENT | SSEND | SEND);
+ request
= new Request(buf ==
MPI_BOTTOM ? nullptr : buf, count, datatype, smpi_process()->index(),
+ comm->group()->index(dst), tag, comm, NON_PERSISTENT | SSEND | SEND);
request->start();
wait(&request,MPI_STATUS_IGNORE);
@@
-719,7
+719,7
@@
void Request::finish_wait(MPI_Request* request, MPI_Status * status)
if (TRACE_smpi_view_internals() && ((req->flags_ & RECV) != 0)){
int rank = smpi_process()->index();
int src_traced = (req->src_ == MPI_ANY_SOURCE ? req->real_src_ : req->src_);
- TRACE_smpi_recv(
rank,
src_traced, rank,req->tag_);
+ TRACE_smpi_recv(src_traced, rank,req->tag_);
}
if(req->detached_sender_ != nullptr){
//integrate pseudo-timing for buffering of small messages, do not bother to execute the simcall if 0
@@
-862,7
+862,7
@@
int Request::waitall(int count, MPI_Request requests[], MPI_Status status[])
if (not accumulates.empty()) {
std::sort(accumulates.begin(), accumulates.end(), sort_accumulates);
- for (auto req : accumulates) {
+ for (auto
&
req : accumulates) {
finish_wait(&req, status);
}
}
@@
-897,28
+897,27
@@
MPI_Request Request::f2c(int id) {
char key[KEY_SIZE];
if(id==MPI_FORTRAN_REQUEST_NULL)
return static_cast<MPI_Request>(MPI_REQUEST_NULL);
- return static_cast<MPI_Request>(
xbt_dict_get(F2C::f2c_lookup(),
get_key_id(key, id)));
+ return static_cast<MPI_Request>(
F2C::f2c_lookup()->at(
get_key_id(key, id)));
}
-int Request::add_f() {
- if(F2C::f2c_lookup()==nullptr){
- F2C::set_f2c_lookup(xbt_dict_new_homogeneous(nullptr));
+int Request::add_f()
+{
+ if (F2C::f2c_lookup() == nullptr) {
+ F2C::set_f2c_lookup(new std::unordered_map<std::string, F2C*>);
}
char key[KEY_SIZE];
-
xbt_dict_set(F2C::f2c_lookup(), get_key_id(key, F2C::f2c_id()), this, nullptr)
;
+
(*(F2C::f2c_lookup()))[get_key_id(key, F2C::f2c_id())] = this
;
F2C::f2c_id_increment();
return F2C::f2c_id()-1;
}
-void Request::free_f(int id) {
+void Request::free_f(int id)
+{
if (id != MPI_FORTRAN_REQUEST_NULL) {
char key[KEY_SIZE];
-
xbt_dict_remove(F2C::f2c_lookup(),
get_key_id(key, id));
+
F2C::f2c_lookup()->erase(
get_key_id(key, id));
}
}
}
}
-
-
-