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
Set status in any case.
[simgrid.git]
/
src
/
smpi
/
smpi_base.c
diff --git
a/src/smpi/smpi_base.c
b/src/smpi/smpi_base.c
index
9e48e3c
..
84e314c
100644
(file)
--- a/
src/smpi/smpi_base.c
+++ b/
src/smpi/smpi_base.c
@@
-234,11
+234,13
@@
static MPI_Request build_request(void *buf, int count,
}
}
-void smpi_empty_status(MPI_Status * status) {
+void smpi_empty_status(MPI_Status * status)
+{
if(status != MPI_STATUS_IGNORE) {
if(status != MPI_STATUS_IGNORE) {
- status->MPI_SOURCE=MPI_ANY_SOURCE;
- status->MPI_TAG=MPI_ANY_TAG;
- status->count=0;
+ status->MPI_SOURCE = MPI_ANY_SOURCE;
+ status->MPI_TAG = MPI_ANY_TAG;
+ status->MPI_ERROR = MPI_SUCCESS;
+ status->count=0;
}
}
}
}
@@
-325,7
+327,8
@@
void smpi_mpi_start(MPI_Request request)
smpi_datatype_use(request->old_type);
request->action = simcall_comm_irecv(mailbox, request->buf, &request->real_size, &match_recv, request);
smpi_datatype_use(request->old_type);
request->action = simcall_comm_irecv(mailbox, request->buf, &request->real_size, &match_recv, request);
- double sleeptime = smpi_or(request->size);
+ //integrate pseudo-timing for buffering of small messages, do not bother to execute the simcall if 0
+ double sleeptime = request->detached ? smpi_or(request->size) : 0.0;
if(sleeptime!=0.0){
simcall_process_sleep(sleeptime);
XBT_DEBUG("receiving size of %zu : sleep %lf ", request->size, smpi_or(request->size));
if(sleeptime!=0.0){
simcall_process_sleep(sleeptime);
XBT_DEBUG("receiving size of %zu : sleep %lf ", request->size, smpi_or(request->size));
@@
-364,15
+367,16
@@
void smpi_mpi_start(MPI_Request request)
//if we are giving back the control to the user without waiting for completion, we have to inject timings
double sleeptime =0.0;
//if we are giving back the control to the user without waiting for completion, we have to inject timings
double sleeptime =0.0;
- if(request->detached
&& !(request->flags & ISEND))
- sleeptime = smpi_os(request->size);
- else
- sleeptime = smpi_ois(request->size);
+ if(request->detached
|| (request->flags & (ISEND|SSEND))){// issend should be treated as isend
+ //isend and send timings may be different
+ sleeptime = (request->flags & ISEND)? smpi_ois(request->size) : smpi_os(request->size);
+ }
if(sleeptime!=0.0){
simcall_process_sleep(sleeptime);
XBT_DEBUG("sending size of %zu : sleep %lf ", request->size, smpi_os(request->size));
}
if(sleeptime!=0.0){
simcall_process_sleep(sleeptime);
XBT_DEBUG("sending size of %zu : sleep %lf ", request->size, smpi_os(request->size));
}
+
request->action =
simcall_comm_isend(mailbox, request->size, -1.0,
request->buf, request->real_size,
request->action =
simcall_comm_isend(mailbox, request->size, -1.0,
request->buf, request->real_size,
@@
-483,8
+487,11
@@
void smpi_mpi_recv(void *buf, int count, MPI_Datatype datatype, int src,
void smpi_mpi_send(void *buf, int count, MPI_Datatype datatype, int dst,
int tag, MPI_Comm comm)
{
void smpi_mpi_send(void *buf, int count, MPI_Datatype datatype, int dst,
int tag, MPI_Comm comm)
{
- MPI_Request request;
- request = smpi_mpi_isend(buf, count, datatype, dst, tag, comm);
+ MPI_Request request =
+ build_request(buf, count, datatype, smpi_comm_rank(comm), dst, tag,
+ comm, NON_PERSISTENT | SEND);
+
+ smpi_mpi_start(request);
smpi_mpi_wait(&request, MPI_STATUS_IGNORE);
}
smpi_mpi_wait(&request, MPI_STATUS_IGNORE);
}
@@
-512,7
+519,7
@@
void smpi_mpi_sendrecv(void *sendbuf, int sendcount, MPI_Datatype sendtype,
smpi_mpi_waitall(2, requests, stats);
if(status != MPI_STATUS_IGNORE) {
// Copy receive status
smpi_mpi_waitall(2, requests, stats);
if(status != MPI_STATUS_IGNORE) {
// Copy receive status
-
memcpy(status, &stats[1], sizeof(MPI_Status))
;
+
*status = stats[1]
;
}
}
}
}
@@
-524,13
+531,14
@@
int smpi_mpi_get_count(MPI_Status * status, MPI_Datatype datatype)
static void finish_wait(MPI_Request * request, MPI_Status * status)
{
MPI_Request req = *request;
static void finish_wait(MPI_Request * request, MPI_Status * status)
{
MPI_Request req = *request;
+ if(status != MPI_STATUS_IGNORE)
+ smpi_empty_status(status);
+
if(!(req->detached && req->flags & SEND)){
if(status != MPI_STATUS_IGNORE) {
status->MPI_SOURCE = req->src == MPI_ANY_SOURCE ? req->real_src : req->src;
status->MPI_TAG = req->tag == MPI_ANY_TAG ? req->real_tag : req->tag;
if(!(req->detached && req->flags & SEND)){
if(status != MPI_STATUS_IGNORE) {
status->MPI_SOURCE = req->src == MPI_ANY_SOURCE ? req->real_src : req->src;
status->MPI_TAG = req->tag == MPI_ANY_TAG ? req->real_tag : req->tag;
- if(req->truncated)
- status->MPI_ERROR = MPI_ERR_TRUNCATE;
- else status->MPI_ERROR = MPI_SUCCESS ;
+ status->MPI_ERROR = req->truncated ? MPI_ERR_TRUNCATE : MPI_SUCCESS;
// this handles the case were size in receive differs from size in send
// FIXME: really this should just contain the count of receive-type blocks,
// right?
// this handles the case were size in receive differs from size in send
// FIXME: really this should just contain the count of receive-type blocks,
// right?
@@
-637,7
+645,7
@@
int smpi_mpi_testall(int count, MPI_Request requests[],
smpi_empty_status(pstat);
}
if(status != MPI_STATUSES_IGNORE) {
smpi_empty_status(pstat);
}
if(status != MPI_STATUSES_IGNORE) {
-
memcpy(&status[i], pstat, sizeof(*pstat))
;
+
status[i] = *pstat
;
}
}
return flag;
}
}
return flag;
@@
-781,10
+789,10
@@
int smpi_mpi_waitall(int count, MPI_Request requests[],
if(index == MPI_UNDEFINED) {
break;
}
if(index == MPI_UNDEFINED) {
break;
}
- if(status != MPI_STATUSES_IGNORE) {
-
memcpy(&status[index], pstat, sizeof(*pstat))
;
- if
(status[index].MPI_ERROR==MPI_ERR_TRUNCATE)retvalue=MPI_ERR_IN_STATUS;
-
+ if
(status != MPI_STATUSES_IGNORE) {
+
status[index] = *pstat
;
+ if
(status[index].MPI_ERROR == MPI_ERR_TRUNCATE)
+ retvalue = MPI_ERR_IN_STATUS;
}
}
}
}
}
}
@@
-807,7
+815,7
@@
int smpi_mpi_waitsome(int incount, MPI_Request requests[], int *indices,
indices[count] = index;
count++;
if(status != MPI_STATUSES_IGNORE) {
indices[count] = index;
count++;
if(status != MPI_STATUSES_IGNORE) {
-
memcpy(&status[index], pstat, sizeof(*pstat))
;
+
status[index] = *pstat
;
}
}else{
return MPI_UNDEFINED;
}
}else{
return MPI_UNDEFINED;
@@
-831,7
+839,7
@@
int smpi_mpi_testsome(int incount, MPI_Request requests[], int *indices,
indices[count] = i;
count++;
if(status != MPI_STATUSES_IGNORE) {
indices[count] = i;
count++;
if(status != MPI_STATUSES_IGNORE) {
-
memcpy(&status[i], pstat, sizeof(*pstat))
;
+
status[i] = *pstat
;
}
}
}else{
}
}
}else{