From 88d79efd9f720bc9fc643549869add1e8e866810 Mon Sep 17 00:00:00 2001 From: Todd Kordenbrock Date: Tue, 6 Oct 2015 12:03:12 -0500 Subject: [PATCH] mtl-portals4: fix bug in the Portals4 get_peer family The Portals4 get_peer family incorrectly cast the ompi_proc_t to ptl_process_t and returned that as the peer. The ptl_process_t is actually found in the endpoint array. This commit fixes the Portals4 get_peer family to return the dereferenced endpoint pointer. --- ompi/mca/mtl/portals4/mtl_portals4.h | 4 ++-- ompi/mca/mtl/portals4/mtl_portals4_endpoint.h | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/ompi/mca/mtl/portals4/mtl_portals4.h b/ompi/mca/mtl/portals4/mtl_portals4.h index 88da025796d..2cde423a313 100644 --- a/ompi/mca/mtl/portals4/mtl_portals4.h +++ b/ompi/mca/mtl/portals4/mtl_portals4.h @@ -224,7 +224,7 @@ ompi_mtl_portals4_get_proc_group(struct ompi_group_t *group, int rank); static inline ptl_process_t ompi_mtl_portals4_get_peer_group(struct ompi_group_t *group, int rank) { - return *((ptl_process_t*)ompi_mtl_portals4_get_proc_group(group, rank)); + return *((ptl_process_t*)(ompi_mtl_portals4_get_proc_group(group, rank)->proc_endpoints[OMPI_PROC_ENDPOINT_TAG_PORTALS4])); } static inline ompi_proc_t * @@ -236,7 +236,7 @@ ompi_mtl_portals4_get_proc(struct ompi_communicator_t *comm, int rank) static inline ptl_process_t ompi_mtl_portals4_get_peer(struct ompi_communicator_t *comm, int rank) { - return *((ptl_process_t*)ompi_mtl_portals4_get_proc(comm, rank)); + return *((ptl_process_t*)(ompi_mtl_portals4_get_proc(comm, rank)->proc_endpoints[OMPI_PROC_ENDPOINT_TAG_PORTALS4])); } diff --git a/ompi/mca/mtl/portals4/mtl_portals4_endpoint.h b/ompi/mca/mtl/portals4/mtl_portals4_endpoint.h index 5670c908a8c..2c135cc126f 100644 --- a/ompi/mca/mtl/portals4/mtl_portals4_endpoint.h +++ b/ompi/mca/mtl/portals4/mtl_portals4_endpoint.h @@ -20,6 +20,8 @@ #ifndef OMPI_MTL_PORTALS_ENDPOINT_H #define OMPI_MTL_PORTALS_ENDPOINT_H +#include "ompi/mca/mtl/portals4/mtl_portals4.h" + struct mca_mtl_base_endpoint_t { ptl_process_t ptl_proc; };