libsc  2.8.7
The SC library provides support for parallel scientific applications.
All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
sc_reduce.h
Go to the documentation of this file.
1 /*
2  This file is part of the SC Library.
3  The SC Library provides support for parallel scientific applications.
4 
5  Copyright (C) 2010 The University of Texas System
6  Additional copyright (C) 2011 individual authors
7 
8  The SC Library is free software; you can redistribute it and/or
9  modify it under the terms of the GNU Lesser General Public
10  License as published by the Free Software Foundation; either
11  version 2.1 of the License, or (at your option) any later version.
12 
13  The SC Library is distributed in the hope that it will be useful,
14  but WITHOUT ANY WARRANTY; without even the implied warranty of
15  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16  Lesser General Public License for more details.
17 
18  You should have received a copy of the GNU Lesser General Public
19  License along with the SC Library; if not, write to the Free Software
20  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
21  02110-1301, USA.
22 */
23 
40 #ifndef SC_REDUCE_H
41 #define SC_REDUCE_H
42 
43 #include <sc.h>
44 
45 #ifndef SC_REDUCE_ALLTOALL_LEVEL
47 #define SC_REDUCE_ALLTOALL_LEVEL 3
48 #endif
49 
50 SC_EXTERN_C_BEGIN;
51 
53 typedef void (*sc_reduce_t) (void *sendbuf, void *recvbuf,
54  int sendcount, sc_MPI_Datatype sendtype);
55 
65 int sc_allreduce_custom (void *sendbuf, void *recvbuf,
66  int sendcount,
67  sc_MPI_Datatype sendtype,
68  sc_reduce_t reduce_fn,
69  sc_MPI_Comm mpicomm);
70 
81 int sc_reduce_custom (void *sendbuf, void *recvbuf,
82  int sendcount, sc_MPI_Datatype sendtype,
83  sc_reduce_t reduce_fn,
84  int target, sc_MPI_Comm mpicomm);
85 
97 int sc_allreduce (void *sendbuf, void *recvbuf, int sendcount,
98  sc_MPI_Datatype sendtype,
99  sc_MPI_Op operation, sc_MPI_Comm mpicomm);
100 
113 int sc_reduce (void *sendbuf, void *recvbuf, int sendcount,
114  sc_MPI_Datatype sendtype, sc_MPI_Op operation,
115  int target, sc_MPI_Comm mpicomm);
116 
117 SC_EXTERN_C_END;
118 
119 #endif /* !SC_REDUCE_H */
Support for process management (memory allocation, logging, etc.)
sc3_MPI_Datatype_t sc_MPI_Datatype
Emulate MPI datatypes.
Definition: sc_mpi.h:452
sc3_MPI_Comm_t sc_MPI_Comm
Emulate an MPI communicator.
Definition: sc_mpi.h:450
sc3_MPI_Op_t sc_MPI_Op
Emulate MPI operations.
Definition: sc_mpi.h:453
int sc_reduce_custom(void *sendbuf, void *recvbuf, int sendcount, sc_MPI_Datatype sendtype, sc_reduce_t reduce_fn, int target, sc_MPI_Comm mpicomm)
Custom reduce operation with reproducible associativity.
int sc_reduce(void *sendbuf, void *recvbuf, int sendcount, sc_MPI_Datatype sendtype, sc_MPI_Op operation, int target, sc_MPI_Comm mpicomm)
Drop-in MPI_Reduce replacement with reproducible associativity.
int sc_allreduce(void *sendbuf, void *recvbuf, int sendcount, sc_MPI_Datatype sendtype, sc_MPI_Op operation, sc_MPI_Comm mpicomm)
Drop-in MPI_Allreduce replacement with reproducible associativity.
int sc_allreduce_custom(void *sendbuf, void *recvbuf, int sendcount, sc_MPI_Datatype sendtype, sc_reduce_t reduce_fn, sc_MPI_Comm mpicomm)
Custom allreduce operation with reproducible associativity.
void(* sc_reduce_t)(void *sendbuf, void *recvbuf, int sendcount, sc_MPI_Datatype sendtype)
Prototype for a user-defined reduce operation.
Definition: sc_reduce.h:53