Skip to content

Commit

Permalink
portals4: use PtlHandleIsEqual() to compare handles
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
tkordenbrock committed Jul 25, 2024
1 parent 20b900e commit 6c0a2d1
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 13 deletions.
18 changes: 9 additions & 9 deletions ompi/mca/osc/portals4/osc_portals4_comm.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions ompi/mca/osc/portals4/osc_portals4_component.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
4 changes: 2 additions & 2 deletions opal/mca/btl/portals4/btl_portals4.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 6c0a2d1

Please sign in to comment.