Skip to content

Commit 9a50afe

Browse files
committed
Merge pull request open-mpi#629 from hjelmn/v1.10_libnbc_fixes
op: allow user operations in ompi_3buff_op_reduce
2 parents e8ae71b + e1ceb4e commit 9a50afe

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
@@ -595,6 +597,13 @@ static inline void ompi_op_reduce(ompi_op_t * op, void *source,
595597
return;
596598
}
597599

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

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

638651
END_C_DECLS

0 commit comments

Comments
 (0)