- if (win == MPI_WIN_NULL) {
- retval = MPI_ERR_WIN;
- } else if (target_rank == MPI_PROC_NULL) {
- *request = MPI_REQUEST_NULL;
- retval = MPI_SUCCESS;
- } else if (target_rank <0){
- retval = MPI_ERR_RANK;
- } else if (win->dynamic()==0 && target_disp <0){
- //in case of dynamic window, target_disp can be mistakenly seen as negative, as it is an address
- retval = MPI_ERR_ARG;
- } else if ((origin_count < 0 || target_count < 0) ||
- (origin_addr==nullptr && origin_count > 0)){
- retval = MPI_ERR_COUNT;
- } else if (((origin_datatype == MPI_DATATYPE_NULL) || (target_datatype == MPI_DATATYPE_NULL)) ||
- ((not origin_datatype->is_valid()) || (not target_datatype->is_valid()))) {
- retval = MPI_ERR_TYPE;
- } else if(request == nullptr){
- retval = MPI_ERR_REQUEST;
- } else {
- int my_proc_id = simgrid::s4u::Actor::self()->getPid();
- MPI_Group group;
- win->get_group(&group);
- int dst_traced = group->actor(target_rank)->getPid();
- TRACE_smpi_comm_in(my_proc_id, __FUNCTION__, new simgrid::instr::Pt2PtTIData("Rput", target_rank,
- origin_datatype->is_replayable() ? origin_count : origin_count * origin_datatype->size(),
- encode_datatype(origin_datatype)));
- TRACE_smpi_send(my_proc_id, my_proc_id, dst_traced, SMPI_RMA_TAG, origin_count*origin_datatype->size());
-
- retval = win->put( origin_addr, origin_count, origin_datatype, target_rank, target_disp, target_count,
- target_datatype, request);