Skip to content

Commit c99a8a5

Browse files
committed
Merge pull request #967 from hjelmn/libnbc_fix
op: allow user operations in ompi_3buff_op_reduce
2 parents eb79edf + 57d3b83 commit c99a8a5

File tree

1 file changed

+18
-5
lines changed

1 file changed

+18
-5
lines changed

ompi/op/op.h

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* -*- Mode: C; c-basic-offset:4 ; -*- */
1+
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
22
/*
33
* Copyright (c) 2004-2006 The Trustees of Indiana University and Indiana
44
* University Research and Technology
@@ -13,6 +13,8 @@
1313
* Copyright (c) 2008 UT-Battelle, LLC
1414
* Copyright (c) 2008-2012 Cisco Systems, Inc. All rights reserved.
1515
* Copyright (c) 2009 Sun Microsystems, Inc. All rights reserved.
16+
* Copyright (c) 2015 Los Alamos National Security, LLC. All rights
17+
* reserved.
1618
* $COPYRIGHT$
1719
*
1820
* Additional copyrights may follow
@@ -594,6 +596,13 @@ static inline void ompi_op_reduce(ompi_op_t * op, void *source,
594596
return;
595597
}
596598

599+
static inline void ompi_3buff_op_user (ompi_op_t *op, void * restrict source1, void * restrict source2,
600+
void * restrict result, int count, struct ompi_datatype_t *dtype)
601+
{
602+
ompi_datatype_copy_content_same_ddt (dtype, count, result, source1);
603+
op->o_func.c_fn (source2, result, &count, &dtype);
604+
}
605+
597606
/**
598607
* Perform a reduction operation.
599608
*
@@ -628,10 +637,14 @@ static inline void ompi_3buff_op_reduce(ompi_op_t * op, void *source1,
628637
src2 = source2;
629638
tgt = target;
630639

631-
op->o_3buff_intrinsic.fns[ompi_op_ddt_map[dtype->id]](src1, src2,
632-
tgt, &count,
633-
&dtype,
634-
op->o_3buff_intrinsic.modules[ompi_op_ddt_map[dtype->id]]);
640+
if (OPAL_LIKELY(ompi_op_is_intrinsic (op))) {
641+
op->o_3buff_intrinsic.fns[ompi_op_ddt_map[dtype->id]](src1, src2,
642+
tgt, &count,
643+
&dtype,
644+
op->o_3buff_intrinsic.modules[ompi_op_ddt_map[dtype->id]]);
645+
} else {
646+
ompi_3buff_op_user (op, src1, src2, tgt, count, dtype);
647+
}
635648
}
636649

637650
END_C_DECLS

0 commit comments

Comments
 (0)