Skip to content

Commit d5956db

Browse files
authored
Merge pull request #3340 from ggouaillardet/topic/v2.0.x/ompi_win_peer_invalid
v2.0.x: check for negative ranks in ompi_win_peer_invalid
2 parents 58f3524 + 375ca1b commit d5956db

File tree

4 files changed

+5
-11
lines changed

4 files changed

+5
-11
lines changed

ompi/mpi/c/win_lock.c

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
* All rights reserved.
1313
* Copyright (c) 2014 Los Alamos National Security, LLC. All rights
1414
* reserved.
15-
* Copyright (c) 2015 Research Organization for Information Science
15+
* Copyright (c) 2015-2017 Research Organization for Information Science
1616
* and Technology (RIST). All rights reserved.
1717
* $COPYRIGHT$
1818
*
@@ -61,9 +61,6 @@ int MPI_Win_lock(int lock_type, int rank, int assert, MPI_Win win)
6161
}
6262
}
6363

64-
/* NTH: do not bother keeping track of locking MPI_PROC_NULL. */
65-
if (MPI_PROC_NULL == rank) return MPI_SUCCESS;
66-
6764
rc = win->w_osc_module->osc_lock(lock_type, rank, assert, win);
6865
OMPI_ERRHANDLER_RETURN(rc, win, rc, FUNC_NAME);
6966
}

ompi/mpi/c/win_shared_query.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
* Copyright (c) 2012-2013 Sandia National Laboratories. All rights reserved.
3-
* Copyright (c) 2015 Research Organization for Information Science
3+
* Copyright (c) 2015-2017 Research Organization for Information Science
44
* and Technology (RIST). All rights reserved.
55
* $COPYRIGHT$
66
*
@@ -39,7 +39,7 @@ int MPI_Win_shared_query(MPI_Win win, int rank, MPI_Aint *size, int *disp_unit,
3939

4040
if (ompi_win_invalid(win)) {
4141
return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_WIN, FUNC_NAME);
42-
} else if (ompi_win_peer_invalid(win, rank)) {
42+
} else if (MPI_PROC_NULL != rank && ompi_win_peer_invalid(win, rank)) {
4343
return OMPI_ERRHANDLER_INVOKE(win, MPI_ERR_RANK, FUNC_NAME);
4444
}
4545
}

ompi/mpi/c/win_unlock.c

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
* All rights reserved.
1313
* Copyright (c) 2014 Los Alamos National Security, LLC. All rights
1414
* reserved.
15-
* Copyright (c) 2015 Research Organization for Information Science
15+
* Copyright (c) 2015-2017 Research Organization for Information Science
1616
* and Technology (RIST). All rights reserved.
1717
* $COPYRIGHT$
1818
*
@@ -54,9 +54,6 @@ int MPI_Win_unlock(int rank, MPI_Win win)
5454
}
5555
}
5656

57-
/* NTH: do not bother keeping track of unlocking MPI_PROC_NULL. */
58-
if (MPI_PROC_NULL == rank) return MPI_SUCCESS;
59-
6057
rc = win->w_osc_module->osc_unlock(rank, win);
6158
OMPI_ERRHANDLER_RETURN(rc, win, rc, FUNC_NAME);
6259
}

ompi/win/win.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ static inline int ompi_win_invalid(ompi_win_t *win) {
141141
}
142142

143143
static inline int ompi_win_peer_invalid(ompi_win_t *win, int peer) {
144-
if (win->w_group->grp_proc_count <= peer) return true;
144+
if (win->w_group->grp_proc_count <= peer || peer < 0) return true;
145145
return false;
146146
}
147147

0 commit comments

Comments
 (0)