From ef7c98c38003506bb8aac7380c2922bd44ecfe1d Mon Sep 17 00:00:00 2001 From: Jeff Hammond Date: Tue, 11 Apr 2017 14:21:06 -0700 Subject: [PATCH 1/3] check for negative ranks in ompi_win_peer_invalid resolves #3326 (https://github.com/open-mpi/ompi/issues/3326) Signed-off-by: jeff.r.hammond@intel.com (cherry picked from commit open-mpi/ompi@b3a20100d3d31e4937a5b23d012c8ae9b22e0cd3) --- ompi/win/win.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ompi/win/win.h b/ompi/win/win.h index ab4af8fc43e..bd49bb69279 100644 --- a/ompi/win/win.h +++ b/ompi/win/win.h @@ -162,7 +162,7 @@ static inline int ompi_win_invalid(ompi_win_t *win) { } static inline int ompi_win_peer_invalid(ompi_win_t *win, int peer) { - if (win->w_group->grp_proc_count <= peer) return true; + if (win->w_group->grp_proc_count <= peer || peer < 0) return true; return false; } From 7e81641cc8beed4a41fea4864e2481871fc8bde7 Mon Sep 17 00:00:00 2001 From: Gilles Gouaillardet Date: Wed, 19 Apr 2017 10:06:41 +0900 Subject: [PATCH 2/3] mpi/c: allow MPI_PROC_NULL in MPI_Win_shared_query() This fixes a regression introduced in open-mpi/ompi@b3a20100d3d31e4937a5b23d012c8ae9b22e0cd3 Signed-off-by: Gilles Gouaillardet (cherry picked from commit open-mpi/ompi@23dad50d515df0fa9910f7349b61e2423297eda0) --- ompi/mpi/c/win_shared_query.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ompi/mpi/c/win_shared_query.c b/ompi/mpi/c/win_shared_query.c index 9afdb91b818..780a66d34af 100644 --- a/ompi/mpi/c/win_shared_query.c +++ b/ompi/mpi/c/win_shared_query.c @@ -1,6 +1,6 @@ /* * Copyright (c) 2012-2013 Sandia National Laboratories. All rights reserved. - * Copyright (c) 2015 Research Organization for Information Science + * Copyright (c) 2015-2017 Research Organization for Information Science * and Technology (RIST). All rights reserved. * $COPYRIGHT$ * @@ -39,7 +39,7 @@ int MPI_Win_shared_query(MPI_Win win, int rank, MPI_Aint *size, int *disp_unit, if (ompi_win_invalid(win)) { return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_WIN, FUNC_NAME); - } else if (ompi_win_peer_invalid(win, rank)) { + } else if (MPI_PROC_NULL != rank && ompi_win_peer_invalid(win, rank)) { return OMPI_ERRHANDLER_INVOKE(win, MPI_ERR_RANK, FUNC_NAME); } } From 3e975bf078afe35e8db4a67e647c6b0e07c81c70 Mon Sep 17 00:00:00 2001 From: Gilles Gouaillardet Date: Sat, 22 Apr 2017 11:13:13 +0900 Subject: [PATCH 3/3] mpi/c: MPI_PROC_NULL is not a valid rank in MPI_Win_{lock,unlock} Signed-off-by: Gilles Gouaillardet (back-ported from commit open-mpi/ompi@ebe6125750091da9fe1293440e2addaf6ec3e071) --- ompi/mpi/c/win_lock.c | 5 +---- ompi/mpi/c/win_unlock.c | 5 +---- 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/ompi/mpi/c/win_lock.c b/ompi/mpi/c/win_lock.c index f27e017cfcb..794cd9c9bd8 100644 --- a/ompi/mpi/c/win_lock.c +++ b/ompi/mpi/c/win_lock.c @@ -12,7 +12,7 @@ * All rights reserved. * Copyright (c) 2014 Los Alamos National Security, LLC. All rights * reserved. - * Copyright (c) 2015 Research Organization for Information Science + * Copyright (c) 2015-2017 Research Organization for Information Science * and Technology (RIST). All rights reserved. * $COPYRIGHT$ * @@ -61,9 +61,6 @@ int MPI_Win_lock(int lock_type, int rank, int assert, MPI_Win win) } } - /* NTH: do not bother keeping track of locking MPI_PROC_NULL. */ - if (MPI_PROC_NULL == rank) return MPI_SUCCESS; - rc = win->w_osc_module->osc_lock(lock_type, rank, assert, win); OMPI_ERRHANDLER_RETURN(rc, win, rc, FUNC_NAME); } diff --git a/ompi/mpi/c/win_unlock.c b/ompi/mpi/c/win_unlock.c index a9d20f8b4ea..f900c88f09f 100644 --- a/ompi/mpi/c/win_unlock.c +++ b/ompi/mpi/c/win_unlock.c @@ -12,7 +12,7 @@ * All rights reserved. * Copyright (c) 2014 Los Alamos National Security, LLC. All rights * reserved. - * Copyright (c) 2015 Research Organization for Information Science + * Copyright (c) 2015-2017 Research Organization for Information Science * and Technology (RIST). All rights reserved. * $COPYRIGHT$ * @@ -54,9 +54,6 @@ int MPI_Win_unlock(int rank, MPI_Win win) } } - /* NTH: do not bother keeping track of unlocking MPI_PROC_NULL. */ - if (MPI_PROC_NULL == rank) return MPI_SUCCESS; - rc = win->w_osc_module->osc_unlock(rank, win); OMPI_ERRHANDLER_RETURN(rc, win, rc, FUNC_NAME); }