- if(status != MPI_STATUS_IGNORE) {
- status->MPI_SOURCE = req->src;
- status->MPI_TAG = req->tag;
- status->MPI_ERROR = MPI_SUCCESS;
- // FIXME: really this should just contain the count of receive-type blocks,
- // right?
- status->count = req->size;
+ print_request("Finishing", req);
+ MPI_Datatype datatype = req->old_type;
+
+ if(datatype->has_subtype == 1){
+ // This part handles the problem of non-contignous memory
+ // the unserialization at the reception
+ s_smpi_subtype_t *subtype = datatype->substruct;
+ if(req->flags & RECV) {
+ subtype->unserialize(req->buf, req->old_buf, req->real_size/smpi_datatype_size(datatype) , datatype->substruct);
+ }
+ if(req->detached == 0) free(req->buf);
+ }
+ smpi_datatype_unuse(datatype);
+ }
+
+ if(req->detached_sender!=NULL){
+ smpi_mpi_request_free(&(req->detached_sender));