Skip to content

op: allow user operations in ompi_3buff_op_reduce #967

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 3, 2015
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 18 additions & 5 deletions ompi/op/op.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* -*- Mode: C; c-basic-offset:4 ; -*- */
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
/*
* Copyright (c) 2004-2006 The Trustees of Indiana University and Indiana
* University Research and Technology
Expand All @@ -13,6 +13,8 @@
* Copyright (c) 2008 UT-Battelle, LLC
* Copyright (c) 2008-2012 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2009 Sun Microsystems, Inc. All rights reserved.
* Copyright (c) 2015 Los Alamos National Security, LLC. All rights
* reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
Expand Down Expand Up @@ -594,6 +596,13 @@ static inline void ompi_op_reduce(ompi_op_t * op, void *source,
return;
}

static inline void ompi_3buff_op_user (ompi_op_t *op, void * restrict source1, void * restrict source2,
void * restrict result, int count, struct ompi_datatype_t *dtype)
{
ompi_datatype_copy_content_same_ddt (dtype, count, result, source1);
op->o_func.c_fn (source2, result, &count, &dtype);
}

/**
* Perform a reduction operation.
*
Expand Down Expand Up @@ -628,10 +637,14 @@ static inline void ompi_3buff_op_reduce(ompi_op_t * op, void *source1,
src2 = source2;
tgt = target;

op->o_3buff_intrinsic.fns[ompi_op_ddt_map[dtype->id]](src1, src2,
tgt, &count,
&dtype,
op->o_3buff_intrinsic.modules[ompi_op_ddt_map[dtype->id]]);
if (OPAL_LIKELY(ompi_op_is_intrinsic (op))) {
op->o_3buff_intrinsic.fns[ompi_op_ddt_map[dtype->id]](src1, src2,
tgt, &count,
&dtype,
op->o_3buff_intrinsic.modules[ompi_op_ddt_map[dtype->id]]);
} else {
ompi_3buff_op_user (op, src1, src2, tgt, count, dtype);
}
}

END_C_DECLS
Expand Down