return container;
}
-static char *TRACE_smpi_get_key(int src, int dst, char *key, int n);
+static char *TRACE_smpi_get_key(int src, int dst, char *key, int n, int send);
-static char *TRACE_smpi_put_key(int src, int dst, char *key, int n)
+static char *TRACE_smpi_put_key(int src, int dst, char *key, int n, int send)
{
//get the dynar for src#dst
char aux[INSTR_DEFAULT_STR_SIZE];
- snprintf(aux, INSTR_DEFAULT_STR_SIZE, "%d#%d", src, dst);
+ snprintf(aux, INSTR_DEFAULT_STR_SIZE, "%d#%d#%d", src, dst, send);
xbt_dynar_t d = static_cast<xbt_dynar_t>(xbt_dict_get_or_null(keys, aux));
- if(xbt_dynar_is_empty(d) == 0){
- //receive was already pushed, perform a get instead
- TRACE_smpi_get_key(src , dst, key ,n);
- return key;
- }
-
if (d == nullptr) {
d = xbt_dynar_new(sizeof(char *), &xbt_free_ref);
xbt_dict_set(keys, aux, d, nullptr);
return key;
}
-static char *TRACE_smpi_get_key(int src, int dst, char *key, int n)
+static char *TRACE_smpi_get_key(int src, int dst, char *key, int n, int send)
{
char aux[INSTR_DEFAULT_STR_SIZE];
- snprintf(aux, INSTR_DEFAULT_STR_SIZE, "%d#%d", src, dst);
+ snprintf(aux, INSTR_DEFAULT_STR_SIZE, "%d#%d#%d", src, dst, send==1?0:1);
xbt_dynar_t d = static_cast<xbt_dynar_t>(xbt_dict_get_or_null(keys, aux));
- // sometimes the receive may be posted before the send
+ // first posted
if(xbt_dynar_is_empty(d)){
- TRACE_smpi_put_key(src, dst, key, n);
+ TRACE_smpi_put_key(src, dst, key, n, send);
return key;
}
return;
char key[INSTR_DEFAULT_STR_SIZE] = {0};
- TRACE_smpi_put_key(src, dst, key, INSTR_DEFAULT_STR_SIZE);
+ TRACE_smpi_get_key(src, dst, key, INSTR_DEFAULT_STR_SIZE,1);
char str[INSTR_DEFAULT_STR_SIZE];
smpi_container(src, str, INSTR_DEFAULT_STR_SIZE);
container_t container = PJ_container_get (str);
type_t type = PJ_type_get ("MPI_LINK", PJ_type_get_root());
-
+ XBT_DEBUG("Send tracing from %d to %d, with key %s", src, dst, key);
new_pajeStartLinkWithSize (SIMIX_get_clock(), PJ_container_get_root(), type, container, "PTP", key, size);
}
return;
char key[INSTR_DEFAULT_STR_SIZE] = {0};
- TRACE_smpi_get_key(src, dst, key, INSTR_DEFAULT_STR_SIZE);
+ TRACE_smpi_get_key(src, dst, key, INSTR_DEFAULT_STR_SIZE,0);
char str[INSTR_DEFAULT_STR_SIZE];
smpi_container(dst, str, INSTR_DEFAULT_STR_SIZE);
container_t container = PJ_container_get (str);
type_t type = PJ_type_get ("MPI_LINK", PJ_type_get_root());
-
+ XBT_DEBUG("Recv tracing from %d to %d, with key %s", src, dst, key);
new_pajeEndLink (SIMIX_get_clock(), PJ_container_get_root(), type, container, "PTP", key);
}
extra->type = TRACING_WAITALL;
extra->send_size=count_requests;
TRACE_smpi_ptp_in(rank_traced, -1, -1, __FUNCTION__,extra);
-
+ int* recvs_snd= xbt_new0(int,count_requests);
+ int* recvs_rcv= xbt_new0(int,count_requests);
+ unsigned int i=0;
+ for (auto req : *(get_reqq_self())){
+ if (req && req->recv){
+ recvs_snd[i]=req->src;
+ recvs_rcv[i]=req->dst;
+ }else
+ recvs_snd[i]=-100;
+ i++;
+ }
smpi_mpi_waitall(count_requests, &(*get_reqq_self())[0], status);
- for (auto req : *(get_reqq_self())){
- if (req && req->recv)
- TRACE_smpi_recv(rank_traced, req->src, req->dst);
+ for (i=0; i<count_requests;i++){
+ if (recvs_snd[i]!=-100)
+ TRACE_smpi_recv(rank_traced, recvs_snd[i], recvs_rcv[i]);
}
+ xbt_free(recvs_rcv);
+ xbt_free(recvs_snd);
TRACE_smpi_ptp_out(rank_traced, -1, -1, __FUNCTION__);
}
log_timed_action (action, clock);