win: fix erroneous argument check
When using dynamic memory windows the displacement becomes a pointer. Since the high bit may be set on valid pointers on some platforms the check for disp > 0 is invalid. This commit adds the window flavor to ompi_win_t and disables the displacement check when operating on dynamic memory windows. Signed-off-by: Nathan Hjelm <hjelmn@lanl.gov>
Этот коммит содержится в:
родитель
abe5002ee9
Коммит
6ae57647ab
@ -11,7 +11,7 @@
|
||||
* Copyright (c) 2004-2005 The Regents of the University of California.
|
||||
* All rights reserved.
|
||||
* Copyright (c) 2009 Sun Microsystmes, Inc. All rights reserved.
|
||||
* Copyright (c) 2013 Los Alamos National Security, LLC. All rights
|
||||
* Copyright (c) 2013-2015 Los Alamos National Security, LLC. All rights
|
||||
* reserved.
|
||||
* Copyright (c) 2015 Research Organization for Information Science
|
||||
* and Technology (RIST). All rights reserved.
|
||||
@ -72,7 +72,7 @@ int MPI_Accumulate(const void *origin_addr, int origin_count, MPI_Datatype origi
|
||||
rc = MPI_ERR_OP;
|
||||
} else if (!ompi_op_is_intrinsic(op)) {
|
||||
rc = MPI_ERR_OP;
|
||||
} else if ( target_disp < 0 ) {
|
||||
} else if ( MPI_WIN_FLAVOR_DYNAMIC != win->w_flavor && target_disp < 0 ) {
|
||||
rc = MPI_ERR_DISP;
|
||||
} else {
|
||||
OMPI_CHECK_DATATYPE_FOR_ONE_SIDED(rc, origin_datatype, origin_count);
|
||||
|
@ -1,3 +1,4 @@
|
||||
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
|
||||
/*
|
||||
* Copyright (c) 2004-2007 The Trustees of Indiana University and Indiana
|
||||
* University Research and Technology
|
||||
@ -13,6 +14,8 @@
|
||||
* Copyright (c) 2011 Sandia National Laboratories. All rights reserved.
|
||||
* Copyright (c) 2015 Research Organization for Information Science
|
||||
* and Technology (RIST). All rights reserved.
|
||||
* Copyright (c) 2015 Los Alamos National Security, LLC. All rights
|
||||
* reserved.
|
||||
* $COPYRIGHT$
|
||||
*
|
||||
* Additional copyrights may follow
|
||||
@ -55,7 +58,7 @@ int MPI_Compare_and_swap(const void *origin_addr, const void *compare_addr, void
|
||||
} else if (ompi_win_peer_invalid(win, target_rank) &&
|
||||
(MPI_PROC_NULL != target_rank)) {
|
||||
rc = MPI_ERR_RANK;
|
||||
} else if ( target_disp < 0 ) {
|
||||
} else if ( MPI_WIN_FLAVOR_DYNAMIC != win->w_flavor && target_disp < 0 ) {
|
||||
rc = MPI_ERR_DISP;
|
||||
} else {
|
||||
OMPI_CHECK_DATATYPE_FOR_ONE_SIDED(rc, datatype, 1);
|
||||
|
@ -1,3 +1,4 @@
|
||||
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
|
||||
/*
|
||||
* Copyright (c) 2004-2007 The Trustees of Indiana University and Indiana
|
||||
* University Research and Technology
|
||||
@ -11,6 +12,8 @@
|
||||
* All rights reserved.
|
||||
* Copyright (c) 2006 Cisco Systems, Inc. All rights reserved.
|
||||
* Copyright (c) 2011 Sandia National Laboratories. All rights reserved.
|
||||
* Copyright (c) 2015 Los Alamos National Security, LLC. All rights
|
||||
* reserved.
|
||||
* Copyright (c) 2015 Research Organization for Information Science
|
||||
* and Technology (RIST). All rights reserved.
|
||||
* $COPYRIGHT$
|
||||
@ -55,7 +58,7 @@ int MPI_Fetch_and_op(const void *origin_addr, void *result_addr, MPI_Datatype da
|
||||
} else if (ompi_win_peer_invalid(win, target_rank) &&
|
||||
(MPI_PROC_NULL != target_rank)) {
|
||||
rc = MPI_ERR_RANK;
|
||||
} else if ( target_disp < 0 ) {
|
||||
} else if ( MPI_WIN_FLAVOR_DYNAMIC != win->w_flavor && target_disp < 0 ) {
|
||||
rc = MPI_ERR_DISP;
|
||||
} else {
|
||||
OMPI_CHECK_DATATYPE_FOR_ONE_SIDED(rc, datatype, 1);
|
||||
|
@ -1,3 +1,4 @@
|
||||
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
|
||||
/*
|
||||
* Copyright (c) 2004-2007 The Trustees of Indiana University and Indiana
|
||||
* University Research and Technology
|
||||
@ -9,6 +10,8 @@
|
||||
* University of Stuttgart. All rights reserved.
|
||||
* Copyright (c) 2004-2005 The Regents of the University of California.
|
||||
* All rights reserved.
|
||||
* Copyright (c) 2015 Los Alamos National Security, LLC. All rights
|
||||
* reserved.
|
||||
* Copyright (c) 2015 Research Organization for Information Science
|
||||
* and Technology (RIST). All rights reserved.
|
||||
* $COPYRIGHT$
|
||||
@ -57,7 +60,7 @@ int MPI_Get(void *origin_addr, int origin_count,
|
||||
} else if (ompi_win_peer_invalid(win, target_rank) &&
|
||||
(MPI_PROC_NULL != target_rank)) {
|
||||
rc = MPI_ERR_RANK;
|
||||
} else if ( target_disp < 0 ) {
|
||||
} else if ( MPI_WIN_FLAVOR_DYNAMIC != win->w_flavor && target_disp < 0 ) {
|
||||
rc = MPI_ERR_DISP;
|
||||
} else {
|
||||
OMPI_CHECK_DATATYPE_FOR_ONE_SIDED(rc, origin_datatype, origin_count);
|
||||
|
@ -12,7 +12,7 @@
|
||||
* All rights reserved.
|
||||
* Copyright (c) 2009 Sun Microsystmes, Inc. All rights reserved.
|
||||
* Copyright (c) 2011 Sandia National Laboratories. All rights reserved.
|
||||
* Copyright (c) 2014 Los Alamos National Security, LLC. All rights
|
||||
* Copyright (c) 2014-2015 Los Alamos National Security, LLC. All rights
|
||||
* reserved.
|
||||
* Copyright (c) 2015 Research Organization for Information Science
|
||||
* and Technology (RIST). All rights reserved.
|
||||
@ -74,7 +74,7 @@ int MPI_Get_accumulate(const void *origin_addr, int origin_count, MPI_Datatype o
|
||||
rc = MPI_ERR_OP;
|
||||
} else if (!ompi_op_is_intrinsic(op)) {
|
||||
rc = MPI_ERR_OP;
|
||||
} else if ( target_disp < 0 ) {
|
||||
} else if ( MPI_WIN_FLAVOR_DYNAMIC != win->w_flavor && target_disp < 0 ) {
|
||||
rc = MPI_ERR_DISP;
|
||||
} else {
|
||||
/* the origin datatype is meaningless when using MPI_OP_NO_OP */
|
||||
|
@ -11,7 +11,7 @@
|
||||
* Copyright (c) 2004-2005 The Regents of the University of California.
|
||||
* All rights reserved.
|
||||
* Copyright (c) 2006 Cisco Systems, Inc. All rights reserved.
|
||||
* Copyright (c) 2013 Los Alamos National Security, LLC. All rights
|
||||
* Copyright (c) 2013-2015 Los Alamos National Security, LLC. All rights
|
||||
* reserved.
|
||||
* Copyright (c) 2015 Research Organization for Information Science
|
||||
* and Technology (RIST). All rights reserved.
|
||||
@ -63,7 +63,7 @@ int MPI_Put(const void *origin_addr, int origin_count, MPI_Datatype origin_datat
|
||||
} else if (NULL == target_datatype ||
|
||||
MPI_DATATYPE_NULL == target_datatype) {
|
||||
rc = MPI_ERR_TYPE;
|
||||
} else if ( target_disp < 0 ) {
|
||||
} else if ( MPI_WIN_FLAVOR_DYNAMIC != win->w_flavor && target_disp < 0 ) {
|
||||
rc = MPI_ERR_DISP;
|
||||
} else {
|
||||
OMPI_CHECK_DATATYPE_FOR_ONE_SIDED(rc, origin_datatype, origin_count);
|
||||
|
@ -12,7 +12,7 @@
|
||||
* All rights reserved.
|
||||
* Copyright (c) 2009 Sun Microsystmes, Inc. All rights reserved.
|
||||
* Copyright (c) 2011 Sandia National Laboratories. All rights reserved.
|
||||
* Copyright (c) 2014 Los Alamos National Security, LLC. All rights
|
||||
* Copyright (c) 2014-2015 Los Alamos National Security, LLC. All rights
|
||||
* reserved.
|
||||
* Copyright (c) 2015 Research Organization for Information Science
|
||||
* and Technology (RIST). All rights reserved.
|
||||
@ -73,7 +73,7 @@ int MPI_Raccumulate(const void *origin_addr, int origin_count, MPI_Datatype orig
|
||||
rc = MPI_ERR_OP;
|
||||
} else if (!ompi_op_is_intrinsic(op)) {
|
||||
rc = MPI_ERR_OP;
|
||||
} else if ( target_disp < 0 ) {
|
||||
} else if ( MPI_WIN_FLAVOR_DYNAMIC != win->w_flavor && target_disp < 0 ) {
|
||||
rc = MPI_ERR_DISP;
|
||||
} else {
|
||||
OMPI_CHECK_DATATYPE_FOR_ONE_SIDED(rc, origin_datatype, origin_count);
|
||||
|
@ -10,7 +10,7 @@
|
||||
* University of Stuttgart. All rights reserved.
|
||||
* Copyright (c) 2004-2005 The Regents of the University of California.
|
||||
* All rights reserved.
|
||||
* Copyright (c) 2014 Los Alamos National Security, LLC. ALl rights
|
||||
* Copyright (c) 2014-2015 Los Alamos National Security, LLC. ALl rights
|
||||
* reserved.
|
||||
* Copyright (c) 2015 Research Organization for Information Science
|
||||
* and Technology (RIST). All rights reserved.
|
||||
@ -60,7 +60,7 @@ int MPI_Rget(void *origin_addr, int origin_count,
|
||||
} else if (ompi_win_peer_invalid(win, target_rank) &&
|
||||
(MPI_PROC_NULL != target_rank)) {
|
||||
rc = MPI_ERR_RANK;
|
||||
} else if ( target_disp < 0 ) {
|
||||
} else if ( MPI_WIN_FLAVOR_DYNAMIC != win->w_flavor && target_disp < 0 ) {
|
||||
rc = MPI_ERR_DISP;
|
||||
} else {
|
||||
OMPI_CHECK_DATATYPE_FOR_ONE_SIDED(rc, origin_datatype, origin_count);
|
||||
|
@ -12,7 +12,7 @@
|
||||
* All rights reserved.
|
||||
* Copyright (c) 2009 Sun Microsystmes, Inc. All rights reserved.
|
||||
* Copyright (c) 2011 Sandia National Laboratories. All rights reserved.
|
||||
* Copyright (c) 2014 Los Alamos National Security, LLC. All right
|
||||
* Copyright (c) 2014-2015 Los Alamos National Security, LLC. All right
|
||||
* reserved.
|
||||
* Copyright (c) 2015 Research Organization for Information Science
|
||||
* and Technology (RIST). All rights reserved.
|
||||
@ -75,7 +75,7 @@ int MPI_Rget_accumulate(const void *origin_addr, int origin_count, MPI_Datatype
|
||||
rc = MPI_ERR_OP;
|
||||
} else if (!ompi_op_is_intrinsic(op)) {
|
||||
rc = MPI_ERR_OP;
|
||||
} else if ( target_disp < 0 ) {
|
||||
} else if ( MPI_WIN_FLAVOR_DYNAMIC != win->w_flavor && target_disp < 0 ) {
|
||||
rc = MPI_ERR_DISP;
|
||||
} else {
|
||||
/* the origin datatype is meaningless when using MPI_OP_NO_OP */
|
||||
|
@ -11,7 +11,7 @@
|
||||
* Copyright (c) 2004-2005 The Regents of the University of California.
|
||||
* All rights reserved.
|
||||
* Copyright (c) 2006 Cisco Systems, Inc. All rights reserved.
|
||||
* Copyright (c) 2014 Los Alamos National Security, LLC. All rights
|
||||
* Copyright (c) 2014-2015 Los Alamos National Security, LLC. All rights
|
||||
* reserved.
|
||||
* Copyright (c) 2015 Research Organization for Information Science
|
||||
* and Technology (RIST). All rights reserved.
|
||||
@ -63,7 +63,7 @@ int MPI_Rput(const void *origin_addr, int origin_count, MPI_Datatype origin_data
|
||||
} else if (NULL == target_datatype ||
|
||||
MPI_DATATYPE_NULL == target_datatype) {
|
||||
rc = MPI_ERR_TYPE;
|
||||
} else if ( target_disp < 0 ) {
|
||||
} else if ( MPI_WIN_FLAVOR_DYNAMIC != win->w_flavor && target_disp < 0 ) {
|
||||
rc = MPI_ERR_DISP;
|
||||
} else {
|
||||
OMPI_CHECK_DATATYPE_FOR_ONE_SIDED(rc, origin_datatype, origin_count);
|
||||
|
@ -12,7 +12,7 @@
|
||||
* All rights reserved.
|
||||
* Copyright (c) 2009 Sun Microsystems, Inc. All rights reserved.
|
||||
* Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved.
|
||||
* Copyright (c) 2013 Los Alamos National Security, LLC. All rights
|
||||
* Copyright (c) 2013-2015 Los Alamos National Security, LLC. All rights
|
||||
* reserved.
|
||||
* Copyright (c) 2015 Research Organization for Information Science
|
||||
* and Technology (RIST). All rights reserved.
|
||||
@ -119,7 +119,7 @@ int ompi_win_finalize(void)
|
||||
return OMPI_SUCCESS;
|
||||
}
|
||||
|
||||
static int alloc_window(struct ompi_communicator_t *comm, ompi_info_t *info, ompi_win_t **win_out)
|
||||
static int alloc_window(struct ompi_communicator_t *comm, ompi_info_t *info, int flavor, ompi_win_t **win_out)
|
||||
{
|
||||
ompi_win_t *win;
|
||||
ompi_group_t *group;
|
||||
@ -140,6 +140,7 @@ static int alloc_window(struct ompi_communicator_t *comm, ompi_info_t *info, omp
|
||||
}
|
||||
|
||||
win->w_acc_ops = acc_ops;
|
||||
win->w_flavor = flavor;
|
||||
|
||||
/* setup data that is independent of osc component */
|
||||
group = comm->c_local_group;
|
||||
@ -199,7 +200,7 @@ ompi_win_create(void *base, size_t size,
|
||||
int model;
|
||||
int ret;
|
||||
|
||||
ret = alloc_window (comm, info, &win);
|
||||
ret = alloc_window (comm, info, MPI_WIN_FLAVOR_CREATE, &win);
|
||||
if (OMPI_SUCCESS != ret) {
|
||||
return ret;
|
||||
}
|
||||
@ -231,7 +232,7 @@ ompi_win_allocate(size_t size, int disp_unit, ompi_info_t *info,
|
||||
int ret;
|
||||
void *base;
|
||||
|
||||
ret = alloc_window (comm, info, &win);
|
||||
ret = alloc_window (comm, info, MPI_WIN_FLAVOR_ALLOCATE, &win);
|
||||
if (OMPI_SUCCESS != ret) {
|
||||
return ret;
|
||||
}
|
||||
@ -264,7 +265,7 @@ ompi_win_allocate_shared(size_t size, int disp_unit, ompi_info_t *info,
|
||||
int ret;
|
||||
void *base;
|
||||
|
||||
ret = alloc_window (comm, info, &win);
|
||||
ret = alloc_window (comm, info, MPI_WIN_FLAVOR_SHARED, &win);
|
||||
if (OMPI_SUCCESS != ret) {
|
||||
return ret;
|
||||
}
|
||||
@ -295,7 +296,7 @@ ompi_win_create_dynamic(ompi_info_t *info, ompi_communicator_t *comm, ompi_win_t
|
||||
int model;
|
||||
int ret;
|
||||
|
||||
ret = alloc_window (comm, info, &win);
|
||||
ret = alloc_window (comm, info, MPI_WIN_FLAVOR_DYNAMIC, &win);
|
||||
if (OMPI_SUCCESS != ret) {
|
||||
return ret;
|
||||
}
|
||||
|
@ -12,7 +12,7 @@
|
||||
* All rights reserved.
|
||||
* Copyright (c) 2006-2012 Cisco Systems, Inc. All rights reserved.
|
||||
* Copyright (c) 2009 Sun Microsystems, Inc. All rights reserved.
|
||||
* Copyright (c) 2013 Los Alamos National Security, LLC. All rights
|
||||
* Copyright (c) 2013-2015 Los Alamos National Security, LLC. All rights
|
||||
* reserved.
|
||||
* $COPYRIGHT$
|
||||
*
|
||||
@ -67,6 +67,9 @@ struct ompi_win_t {
|
||||
/* Information about the state of the window. */
|
||||
uint16_t w_flags;
|
||||
|
||||
/** Window flavor */
|
||||
uint16_t w_flavor;
|
||||
|
||||
/** Accumulate ops */
|
||||
ompi_win_accumulate_ops_t w_acc_ops;
|
||||
|
||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user