static inline int issue_ops_win(MPID_Win * win_ptr, int *made_progress) { int mpi_errno = MPI_SUCCESS; int start_slot, end_slot, i, idx; MPIDI_RMA_Target_t *target = NULL; (*made_progress) = 0; if (win_ptr->non_empty_slots == 0) goto fn_exit; /* Exit if window-wide sync is not finished */ if (win_ptr->states.access_state == MPIDI_RMA_NONE || win_ptr->states.access_state == MPIDI_RMA_FENCE_ISSUED || win_ptr->states.access_state == MPIDI_RMA_PSCW_ISSUED || win_ptr->states.access_state == MPIDI_RMA_LOCK_ALL_ISSUED) goto fn_exit; /* FIXME: we should optimize the issuing pattern here. */ start_slot = win_ptr->comm_ptr->rank % win_ptr->num_slots; end_slot = start_slot + win_ptr->num_slots; for (i = start_slot; i < end_slot; i++) { if (i < win_ptr->num_slots) idx = i; else idx = i - win_ptr->num_slots; target = win_ptr->slots[idx].target_list; while (target != NULL) { int temp_progress = 0; /* check target state */ mpi_errno = check_target_state(win_ptr, target, &temp_progress); if (mpi_errno != MPI_SUCCESS) MPIU_ERR_POP(mpi_errno); if (temp_progress) (*made_progress) = 1; /* issue operations to this target */ mpi_errno = issue_ops_target(win_ptr, target, &temp_progress); if (mpi_errno != MPI_SUCCESS) MPIU_ERR_POP(mpi_errno); if (temp_progress) (*made_progress) = 1; target = target->next; } } fn_exit: return mpi_errno; fn_fail: goto fn_exit; }
int MPIDI_CH3I_RMA_Make_progress_target(MPIR_Win * win_ptr, int target_rank, int *made_progress) { int temp_progress = 0; int is_able_to_issue = 0; MPIDI_RMA_Target_t *target = NULL; int mpi_errno = MPI_SUCCESS; (*made_progress) = 0; /* NOTE: this function is called from either operation routines (MPI_PUT, MPI_GET...), * or aggressive cleanup functions. It cannot be called from the progress engine. * Here we poke the progress engine if window state is not satisfied (i.e. NBC is not * finished). If it is allowed to be called from progress engine, when RMA progress * is registered / executed before NBC progress, it will cause the progress engine * to re-entrant RMA progress endlessly. */ /* check window state, if it is not ready, poke the progress engine */ if (!WIN_READY(win_ptr)) { mpi_errno = poke_progress_engine(); if (mpi_errno) MPIR_ERR_POP(mpi_errno); goto fn_exit; } /* find target element */ mpi_errno = MPIDI_CH3I_Win_find_target(win_ptr, target_rank, &target); if (mpi_errno != MPI_SUCCESS) MPIR_ERR_POP(mpi_errno); /* check and try to switch target state */ mpi_errno = check_and_switch_target_state(win_ptr, target, &is_able_to_issue, &temp_progress); if (mpi_errno != MPI_SUCCESS) MPIR_ERR_POP(mpi_errno); if (temp_progress) (*made_progress) = 1; if (!is_able_to_issue) { mpi_errno = poke_progress_engine(); if (mpi_errno) MPIR_ERR_POP(mpi_errno); goto fn_exit; } /* issue operations to this target */ mpi_errno = issue_ops_target(win_ptr, target, &temp_progress); if (mpi_errno) MPIR_ERR_POP(mpi_errno); if (temp_progress) (*made_progress) = 1; fn_exit: return mpi_errno; fn_fail: goto fn_exit; }
static inline int issue_ops_win(MPIR_Win * win_ptr, int *made_progress) { int mpi_errno = MPI_SUCCESS; int start_slot, end_slot, i, idx; int is_able_to_issue = 0; int temp_progress = 0; MPIDI_RMA_Target_t *target = NULL; (*made_progress) = 0; /* FIXME: we should optimize the issuing pattern here. */ start_slot = win_ptr->comm_ptr->rank % win_ptr->num_slots; end_slot = start_slot + win_ptr->num_slots; for (i = start_slot; i < end_slot; i++) { if (i < win_ptr->num_slots) idx = i; else idx = i - win_ptr->num_slots; for (target = win_ptr->slots[idx].target_list_head; target != NULL; target = target->next) { /* check and try to switch target state */ mpi_errno = check_and_switch_target_state(win_ptr, target, &is_able_to_issue, &temp_progress); if (mpi_errno != MPI_SUCCESS) MPIR_ERR_POP(mpi_errno); if (temp_progress) (*made_progress) = 1; if (!is_able_to_issue) { continue; } /* issue operations to this target */ mpi_errno = issue_ops_target(win_ptr, target, &temp_progress); if (mpi_errno != MPI_SUCCESS) MPIR_ERR_POP(mpi_errno); if (temp_progress) (*made_progress) = 1; } } fn_exit: return mpi_errno; fn_fail: goto fn_exit; }
int MPIDI_CH3I_RMA_Make_progress_target(MPID_Win * win_ptr, int target_rank, int *made_progress) { int temp_progress = 0; MPIDI_RMA_Target_t *target = NULL; int mpi_errno = MPI_SUCCESS; (*made_progress) = 0; /* check window state */ mpi_errno = check_window_state(win_ptr, &temp_progress); if (mpi_errno != MPI_SUCCESS) MPIU_ERR_POP(mpi_errno); if (temp_progress) (*made_progress) = 1; /* find target element */ mpi_errno = MPIDI_CH3I_Win_find_target(win_ptr, target_rank, &target); if (mpi_errno != MPI_SUCCESS) MPIU_ERR_POP(mpi_errno); /* check target state */ mpi_errno = check_target_state(win_ptr, target, &temp_progress); if (mpi_errno) MPIU_ERR_POP(mpi_errno); if (temp_progress) (*made_progress) = 1; /* issue operations to this target */ mpi_errno = issue_ops_target(win_ptr, target, &temp_progress); if (mpi_errno) MPIU_ERR_POP(mpi_errno); if (temp_progress) (*made_progress) = 1; fn_exit: return mpi_errno; fn_fail: goto fn_exit; }