- xbt_fifo_item_t item;
- MPI_Request req;
-
- print_request("Irecv", request);
- xbt_fifo_foreach(data->pending_sent, item, req, MPI_Request) {
- if(req->comm == request->comm
- && (request->src == MPI_ANY_SOURCE || req->src == request->src)
- && (request->tag == MPI_ANY_TAG || req->tag == request->tag)){
- print_request("Match found", req);
- xbt_fifo_remove_item(data->pending_sent, item);
- /* Materialize the *_ANY_* fields from the irecv request */
- req->match = request;
- request->src = req->src;
- request->tag = req->tag;
- request->rdv = req->rdv;
- request->match = req;
- return;
- }
+
+ return data->timer;
+}
+
+void smpi_process_simulated_start(void) {
+ smpi_process_data_t data = smpi_process_data();
+
+ data->simulated = SIMIX_get_clock();
+}
+
+double smpi_process_simulated_elapsed(void) {
+ smpi_process_data_t data = smpi_process_data();
+
+ return SIMIX_get_clock() - data->simulated;
+}
+
+MPI_Comm smpi_process_comm_self(void) {
+ smpi_process_data_t data = smpi_process_data();
+
+ return data->comm_self;
+}
+
+void print_request(const char *message, MPI_Request request) {
+ XBT_DEBUG("%s request %p [buf = %p, size = %zu, src = %d, dst = %d, tag = %d, flags = %x]",
+ message, request, request->buf, request->size,
+ request->src, request->dst, request->tag, request->flags);
+}
+
+static void SMPI_comm_copy_buffer_callback(smx_action_t comm, void* buff, size_t buff_size)
+{
+ XBT_DEBUG("Copy the data over");
+ memcpy(comm->comm.dst_buff, buff, buff_size);
+ if (comm->comm.detached) { // if this is a detached send, the source buffer was duplicated by SMPI sender to make the original buffer available to the application ASAP
+ xbt_free(buff);
+ //It seems that the request is used after the call there this should
+ //be free somewhereelse but where???
+ //xbt_free(comm->comm.src_data);// inside SMPI the request is keep
+ //inside the user data and should be free
+ comm->comm.src_buff = NULL;