Commit 07de139f authored by James Dinan's avatar James Dinan
Browse files

Remove unnecessary myrank field in MPID_Win

Myrank was caching win_ptr->comm_ptr->rank, so we now use that directly
rather than caching it in the MPID_Win object.

Reviewer: balaji
parent bd899327
......@@ -79,7 +79,7 @@ int MPIDI_CH3_SHM_Win_free(MPID_Win **win_ptr)
/* Free shared process mutex memory region */
if ((*win_ptr)->shm_mutex) {
if ((*win_ptr)->myrank == 0) {
if ((*win_ptr)->comm_ptr->rank == 0) {
MPIDI_CH3I_SHM_MUTEX_DESTROY(*win_ptr);
}
......
......@@ -257,8 +257,6 @@ struct MPIDI_Win_target_state {
};
#define MPIDI_DEV_WIN_DECL \
int myrank; /* Rank of this process in comm (used to \
detect operations on self) */ \
volatile int my_counter; /* completion counter for operations \
targeting this window */ \
void **base_addrs; /* array of base addresses of the windows of \
......
......@@ -52,7 +52,7 @@ int MPIDI_Get_accumulate(const void *origin_addr, int origin_count,
goto fn_exit;
}
rank = win_ptr->myrank;
rank = win_ptr->comm_ptr->rank;
origin_predefined = TRUE; /* quiet uninitialized warnings (b/c goto) */
if (op != MPI_NO_OP) {
......@@ -286,7 +286,7 @@ int MPIDI_Compare_and_swap(const void *origin_addr, const void *compare_addr,
MPIU_ERR_CHKANDJUMP(win_ptr->epoch_state == MPIDI_EPOCH_NONE,
mpi_errno, MPI_ERR_RMA_SYNC, "**rmasync");
rank = win_ptr->myrank;
rank = win_ptr->comm_ptr->rank;
/* The datatype must be predefined, and one of: C integer, Fortran integer,
* Logical, Multi-language types, or Byte. This is checked above the ADI,
......@@ -393,7 +393,7 @@ int MPIDI_Fetch_and_op(const void *origin_addr, void *result_addr,
MPIU_ERR_CHKANDJUMP(win_ptr->epoch_state == MPIDI_EPOCH_NONE,
mpi_errno, MPI_ERR_RMA_SYNC, "**rmasync");
rank = win_ptr->myrank;
rank = win_ptr->comm_ptr->rank;
/* The datatype and op must be predefined. This is checked above the ADI,
* so there's no need to check it again here. */
......
......@@ -207,7 +207,7 @@ int MPIDI_Put(const void *origin_addr, int origin_count, MPI_Datatype
goto fn_exit;
}
rank = win_ptr->myrank;
rank = win_ptr->comm_ptr->rank;
/* If the put is a local operation, do it here */
if (target_rank == rank || win_ptr->create_flavor == MPI_WIN_FLAVOR_SHARED)
......@@ -318,7 +318,7 @@ int MPIDI_Get(void *origin_addr, int origin_count, MPI_Datatype
goto fn_exit;
}
rank = win_ptr->myrank;
rank = win_ptr->comm_ptr->rank;
/* If the get is a local operation, do it here */
if (target_rank == rank || win_ptr->create_flavor == MPI_WIN_FLAVOR_SHARED)
......@@ -428,7 +428,7 @@ int MPIDI_Accumulate(const void *origin_addr, int origin_count, MPI_Datatype
goto fn_exit;
}
rank = win_ptr->myrank;
rank = win_ptr->comm_ptr->rank;
MPIDI_CH3I_DATATYPE_IS_PREDEFINED(origin_datatype, origin_predefined);
MPIDI_CH3I_DATATYPE_IS_PREDEFINED(target_datatype, target_predefined);
......
......@@ -181,7 +181,7 @@ int MPIDI_Rput(const void *origin_addr, int origin_count,
/* If the operation is already complete, return a completed request.
* Otherwise, generate a grequest. */
/* FIXME: We still may need to flush or sync for shared memory windows */
if (target_rank == MPI_PROC_NULL || target_rank == win_ptr->myrank ||
if (target_rank == MPI_PROC_NULL || target_rank == win_ptr->comm_ptr->rank ||
win_ptr->create_flavor == MPI_WIN_FLAVOR_SHARED || data_sz == 0)
{
mpi_errno = MPIR_Grequest_start_impl(MPIDI_CH3I_Rma_req_query,
......@@ -262,7 +262,7 @@ int MPIDI_Rget(void *origin_addr, int origin_count,
/* If the operation is already complete, return a completed request.
* Otherwise, generate a grequest. */
/* FIXME: We still may need to flush or sync for shared memory windows */
if (target_rank == MPI_PROC_NULL || target_rank == win_ptr->myrank ||
if (target_rank == MPI_PROC_NULL || target_rank == win_ptr->comm_ptr->rank ||
win_ptr->create_flavor == MPI_WIN_FLAVOR_SHARED || data_sz == 0)
{
mpi_errno = MPIR_Grequest_start_impl(MPIDI_CH3I_Rma_req_query,
......@@ -342,7 +342,7 @@ int MPIDI_Raccumulate(const void *origin_addr, int origin_count,
/* If the operation is already complete, return a completed request.
* Otherwise, generate a grequest. */
/* FIXME: We still may need to flush or sync for shared memory windows */
if (target_rank == MPI_PROC_NULL || target_rank == win_ptr->myrank ||
if (target_rank == MPI_PROC_NULL || target_rank == win_ptr->comm_ptr->rank ||
win_ptr->create_flavor == MPI_WIN_FLAVOR_SHARED || data_sz == 0)
{
mpi_errno = MPIR_Grequest_start_impl(MPIDI_CH3I_Rma_req_query,
......@@ -428,7 +428,7 @@ int MPIDI_Rget_accumulate(const void *origin_addr, int origin_count,
/* If the operation is already complete, return a completed request.
* Otherwise, generate a grequest. */
/* FIXME: We still may need to flush or sync for shared memory windows */
if (target_rank == MPI_PROC_NULL || target_rank == win_ptr->myrank ||
if (target_rank == MPI_PROC_NULL || target_rank == win_ptr->comm_ptr->rank ||
win_ptr->create_flavor == MPI_WIN_FLAVOR_SHARED ||
(data_sz == 0 && trg_data_sz == 0))
{
......
......@@ -1370,7 +1370,7 @@ int MPIDI_Win_post(MPID_Group *post_grp_ptr, int assert, MPID_Win *win_ptr)
win_grp_ptr, ranks_in_win_grp);
if (mpi_errno) MPIU_ERR_POP(mpi_errno);
rank = win_ptr->myrank;
rank = win_ptr->comm_ptr->rank;
MPIU_CHKLMEM_MALLOC(req, MPI_Request *, post_grp_size * sizeof(MPI_Request), mpi_errno, "req");
MPIU_CHKLMEM_MALLOC(status, MPI_Status *, post_grp_size*sizeof(MPI_Status), mpi_errno, "status");
......@@ -1562,7 +1562,7 @@ int MPIDI_Win_complete(MPID_Win *win_ptr)
win_grp_ptr, ranks_in_win_grp);
if (mpi_errno) MPIU_ERR_POP(mpi_errno);
rank = win_ptr->myrank;
rank = win_ptr->comm_ptr->rank;
/* If MPI_MODE_NOCHECK was not specified, we need to check if
Win_post was called on the target processes. Wait for a 0-byte sync
......@@ -1920,7 +1920,7 @@ int MPIDI_Win_lock(int lock_type, int dest, int assert, MPID_Win *win_ptr)
target_state->remote_lock_mode = lock_type;
target_state->remote_lock_assert = assert;
if (dest == win_ptr->myrank) {
if (dest == win_ptr->comm_ptr->rank) {
/* The target is this process itself. We must block until the lock
* is acquired. Once it is acquired, local puts, gets, accumulates
* will be done directly without queueing. */
......@@ -1989,7 +1989,7 @@ int MPIDI_Win_unlock(int dest, MPID_Win *win_ptr)
OPA_read_write_barrier();
}
if (dest == win_ptr->myrank) {
if (dest == win_ptr->comm_ptr->rank) {
/* local lock. release the lock on the window, grant the next one
* in the queue, and return. */
MPIU_Assert(MPIDI_CH3I_RMA_Ops_isempty(&win_ptr->targets[dest].rma_ops_list));
......@@ -2410,7 +2410,7 @@ int MPIDI_Win_lock_all(int assert, MPID_Win *win_ptr)
for (i = 0; i < MPIR_Comm_size(win_ptr->comm_ptr); i++) {
/* Local process is already locked */
if (i == win_ptr->myrank) continue;
if (i == win_ptr->comm_ptr->rank) continue;
mpi_errno = MPIDI_CH3I_Send_lock_msg(i, MPI_LOCK_SHARED, win_ptr);
if (mpi_errno) { MPIU_ERR_POP(mpi_errno); }
......@@ -2418,7 +2418,7 @@ int MPIDI_Win_lock_all(int assert, MPID_Win *win_ptr)
for (i = 0; i < MPIR_Comm_size(win_ptr->comm_ptr); i++) {
/* Local process is already locked */
if (i == win_ptr->myrank) continue;
if (i == win_ptr->comm_ptr->rank) continue;
mpi_errno = MPIDI_CH3I_Wait_for_lock_granted(win_ptr, i);
if (mpi_errno) { MPIU_ERR_POP(mpi_errno); }
......@@ -2772,8 +2772,8 @@ static int MPIDI_CH3I_Acquire_local_lock(MPID_Win *win_ptr, int lock_type) {
MPIU_INSTR_DURATION_END(winlock_getlocallock);
}
win_ptr->targets[win_ptr->myrank].remote_lock_state = MPIDI_CH3_WIN_LOCK_GRANTED;
win_ptr->targets[win_ptr->myrank].remote_lock_mode = lock_type;
win_ptr->targets[win_ptr->comm_ptr->rank].remote_lock_state = MPIDI_CH3_WIN_LOCK_GRANTED;
win_ptr->targets[win_ptr->comm_ptr->rank].remote_lock_mode = lock_type;
fn_exit:
MPIDI_RMA_FUNC_EXIT(MPID_STATE_MPIDI_ACQUIRE_LOCAL_LOCK);
......
......@@ -266,7 +266,6 @@ static int win_init(MPI_Aint size, int disp_unit, int create_flavor, int model,
(*win_ptr)->start_group_ptr = NULL;
(*win_ptr)->start_assert = 0;
(*win_ptr)->comm_ptr = win_comm_ptr;
(*win_ptr)->myrank = comm_ptr->rank;
(*win_ptr)->my_counter = 0;
/* (*win_ptr)->base_addrs[] is set by caller; */
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment