From 526b0a32c469f8a28e96f37c4040a99af1b8a1bb Mon Sep 17 00:00:00 2001 From: Todd Kordenbrock Date: Thu, 25 Jul 2024 14:21:00 -0500 Subject: [PATCH] portals4: use PtlHandleIsEqual() to compare handles The Portals4 standard requires the use of PtlHandleIsEqual() instead of the (in)equality operatror, because a handle may be a compound data type that cannot be directly compared. Signed-off-by: Todd Kordenbrock --- ompi/mca/osc/portals4/osc_portals4_comm.c | 18 +++++++++--------- ompi/mca/osc/portals4/osc_portals4_component.c | 4 ++-- opal/mca/btl/portals4/btl_portals4.c | 4 ++-- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/ompi/mca/osc/portals4/osc_portals4_comm.c b/ompi/mca/osc/portals4/osc_portals4_comm.c index 5d318dc89c0..0d81f5fabac 100644 --- a/ompi/mca/osc/portals4/osc_portals4_comm.c +++ b/ompi/mca/osc/portals4/osc_portals4_comm.c @@ -496,7 +496,7 @@ get_to_iovec(ompi_osc_portals4_module_t *module, ptrdiff_t length, origin_lb, target_lb, extent; ptl_md_t md; - if (module->origin_iovec_md_h != PTL_INVALID_HANDLE) { + if (!PtlHandleIsEqual(module->origin_iovec_md_h,PTL_INVALID_HANDLE)) { PtlMDRelease(module->origin_iovec_md_h); free(module->origin_iovec_list); module->origin_iovec_md_h = PTL_INVALID_HANDLE; @@ -583,7 +583,7 @@ atomic_get_to_iovec(ompi_osc_portals4_module_t *module, ptrdiff_t length, origin_lb, target_lb, extent; ptl_md_t md; - if (module->origin_iovec_md_h != PTL_INVALID_HANDLE) { + if (!PtlHandleIsEqual(module->origin_iovec_md_h,PTL_INVALID_HANDLE)) { PtlMDRelease(module->origin_iovec_md_h); free(module->origin_iovec_list); module->origin_iovec_md_h = PTL_INVALID_HANDLE; @@ -665,7 +665,7 @@ put_from_iovec(ompi_osc_portals4_module_t *module, ptrdiff_t length, origin_lb, target_lb, extent; ptl_md_t md; - if (module->origin_iovec_md_h != PTL_INVALID_HANDLE) { + if (!PtlHandleIsEqual(module->origin_iovec_md_h,PTL_INVALID_HANDLE)) { PtlMDRelease(module->origin_iovec_md_h); free(module->origin_iovec_list); module->origin_iovec_md_h = PTL_INVALID_HANDLE; @@ -754,7 +754,7 @@ atomic_put_from_iovec(ompi_osc_portals4_module_t *module, ptrdiff_t length, origin_lb, target_lb, extent; ptl_md_t md; - if (module->origin_iovec_md_h != PTL_INVALID_HANDLE) { + if (!PtlHandleIsEqual(module->origin_iovec_md_h,PTL_INVALID_HANDLE)) { PtlMDRelease(module->origin_iovec_md_h); free(module->origin_iovec_list); module->origin_iovec_md_h = PTL_INVALID_HANDLE; @@ -841,7 +841,7 @@ atomic_from_iovec(ompi_osc_portals4_module_t *module, ptl_op_t ptl_op; ptl_datatype_t ptl_dt; - if (module->origin_iovec_md_h != PTL_INVALID_HANDLE) { + if (!PtlHandleIsEqual(module->origin_iovec_md_h,PTL_INVALID_HANDLE)) { PtlMDRelease(module->origin_iovec_md_h); free(module->origin_iovec_list); module->origin_iovec_md_h = PTL_INVALID_HANDLE; @@ -940,7 +940,7 @@ swap_to_iovec(ompi_osc_portals4_module_t *module, ptl_md_t md; ptl_datatype_t ptl_dt; - if (module->result_iovec_md_h != PTL_INVALID_HANDLE) { + if (!PtlHandleIsEqual(module->result_iovec_md_h,PTL_INVALID_HANDLE)) { PtlMDRelease(module->result_iovec_md_h); free(module->result_iovec_list); module->result_iovec_md_h = PTL_INVALID_HANDLE; @@ -971,7 +971,7 @@ swap_to_iovec(ompi_osc_portals4_module_t *module, return ret; } - if (module->origin_iovec_md_h != PTL_INVALID_HANDLE) { + if (!PtlHandleIsEqual(module->origin_iovec_md_h,PTL_INVALID_HANDLE)) { PtlMDRelease(module->origin_iovec_md_h); free(module->origin_iovec_list); module->origin_iovec_md_h = PTL_INVALID_HANDLE; @@ -1066,7 +1066,7 @@ fetch_atomic_to_iovec(ompi_osc_portals4_module_t *module, ptl_op_t ptl_op; ptl_datatype_t ptl_dt; - if (module->result_iovec_md_h != PTL_INVALID_HANDLE) { + if (!PtlHandleIsEqual(module->result_iovec_md_h,PTL_INVALID_HANDLE)) { PtlMDRelease(module->result_iovec_md_h); free(module->result_iovec_list); module->result_iovec_md_h = PTL_INVALID_HANDLE; @@ -1097,7 +1097,7 @@ fetch_atomic_to_iovec(ompi_osc_portals4_module_t *module, return ret; } - if (module->origin_iovec_md_h != PTL_INVALID_HANDLE) { + if (!PtlHandleIsEqual(module->origin_iovec_md_h,PTL_INVALID_HANDLE)) { PtlMDRelease(module->origin_iovec_md_h); free(module->origin_iovec_list); module->origin_iovec_md_h = PTL_INVALID_HANDLE; diff --git a/ompi/mca/osc/portals4/osc_portals4_component.c b/ompi/mca/osc/portals4/osc_portals4_component.c index 1e0edbb1f2e..e2725b8af00 100644 --- a/ompi/mca/osc/portals4/osc_portals4_component.c +++ b/ompi/mca/osc/portals4/osc_portals4_component.c @@ -655,11 +655,11 @@ ompi_osc_portals4_free(struct ompi_win_t *win) PtlMEUnlink(module->control_me_h); PtlMEUnlink(module->data_me_h); PtlMDRelease(module->md_h); - if (module->origin_iovec_md_h != PTL_INVALID_HANDLE) { + if (!PtlHandleIsEqual(module->origin_iovec_md_h,PTL_INVALID_HANDLE)) { PtlMDRelease(module->origin_iovec_md_h); free(module->origin_iovec_list); } - if (module->result_iovec_md_h != PTL_INVALID_HANDLE) { + if (!PtlHandleIsEqual(module->result_iovec_md_h,PTL_INVALID_HANDLE)) { PtlMDRelease(module->result_iovec_md_h); free(module->result_iovec_list); } diff --git a/opal/mca/btl/portals4/btl_portals4.c b/opal/mca/btl/portals4/btl_portals4.c index 77f5e909cd5..d71c69a8943 100644 --- a/opal/mca/btl/portals4/btl_portals4.c +++ b/opal/mca/btl/portals4/btl_portals4.c @@ -487,13 +487,13 @@ int mca_btl_portals4_free(struct mca_btl_base_module_t *btl_base, mca_btl_base_d OPAL_BTL_PORTALS4_FRAG_RETURN_EAGER(portals4_btl, frag); } else if (BTL_PORTALS4_FRAG_TYPE_MAX == frag->type) { - if (frag->me_h != PTL_INVALID_HANDLE) { + if (!PtlHandleIsEqual(frag->me_h,PTL_INVALID_HANDLE)) { frag->me_h = PTL_INVALID_HANDLE; } OPAL_BTL_PORTALS4_FRAG_RETURN_MAX(portals4_btl, frag); } else if (BTL_PORTALS4_FRAG_TYPE_USER == frag->type) { - if (frag->me_h != PTL_INVALID_HANDLE) { + if (!PtlHandleIsEqual(frag->me_h,PTL_INVALID_HANDLE)) { frag->me_h = PTL_INVALID_HANDLE; } OPAL_THREAD_ADD_FETCH32(&portals4_btl->portals_outstanding_ops, -1);