Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Rob Latham
MPICH-BlueGene
Commits
cede1792
Commit
cede1792
authored
Oct 08, 2008
by
Rajeev Thakur
Browse files
[svn-r3249] adding back SMP-aware allreduce
parent
481b1192
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/mpi/coll/allreduce.c
View file @
cede1792
...
...
@@ -680,10 +680,68 @@ int MPI_Allreduce ( void *sendbuf, void *recvbuf, int count,
}
else
{
if
(
comm_ptr
->
comm_kind
==
MPID_INTRACOMM
)
if
(
comm_ptr
->
comm_kind
==
MPID_INTRACOMM
)
{
/* intracommunicator */
#if USE_SMP_COLLECTIVES
MPID_Op
*
op_ptr
;
int
is_commutative
;
/* is the op commutative? We do SMP optimizations only if it is. */
if
(
HANDLE_GET_KIND
(
op
)
==
HANDLE_KIND_BUILTIN
)
is_commutative
=
1
;
else
{
MPID_Op_get_ptr
(
op
,
op_ptr
);
is_commutative
=
(
op_ptr
->
kind
==
MPID_OP_USER_NONCOMMUTE
)
?
0
:
1
;
}
if
(
MPIR_Comm_is_node_aware
(
comm_ptr
)
&&
is_commutative
)
{
/* on each node, do a reduce to the local root */
if
(
comm_ptr
->
node_comm
!=
NULL
)
{
/* take care of the MPI_IN_PLACE case. For reduce,
MPI_IN_PLACE is specified only on the root;
for allreduce it is specified on all processes. */
if
((
sendbuf
==
MPI_IN_PLACE
)
&&
(
comm_ptr
->
node_comm
->
rank
!=
0
))
{
/* IN_PLACE and not root of reduce. Data supplied to this
allreduce is in recvbuf. Pass that as the sendbuf to reduce. */
mpi_errno
=
MPIR_Reduce
(
recvbuf
,
NULL
,
count
,
datatype
,
op
,
0
,
comm_ptr
->
node_comm
);
}
else
{
mpi_errno
=
MPIR_Reduce
(
sendbuf
,
recvbuf
,
count
,
datatype
,
op
,
0
,
comm_ptr
->
node_comm
);
}
if
(
mpi_errno
)
goto
fn_fail
;
}
/* now do an IN_PLACE allreduce among the local roots of all nodes */
if
(
comm_ptr
->
node_roots_comm
!=
NULL
)
{
mpi_errno
=
MPIR_Allreduce
(
MPI_IN_PLACE
,
recvbuf
,
count
,
datatype
,
op
,
comm_ptr
->
node_roots_comm
);
if
(
mpi_errno
)
goto
fn_fail
;
}
/* now broadcast the result among local processes */
if
(
comm_ptr
->
node_comm
!=
NULL
)
{
MPIU_THREADPRIV_DECL
;
MPIU_THREADPRIV_GET
;
MPIR_Nest_incr
();
mpi_errno
=
MPIR_Bcast
(
recvbuf
,
count
,
datatype
,
0
,
comm_ptr
->
node_comm
);
MPIR_Nest_decr
();
}
}
else
{
mpi_errno
=
MPIR_Allreduce
(
sendbuf
,
recvbuf
,
count
,
datatype
,
op
,
comm_ptr
);
}
#else
mpi_errno
=
MPIR_Allreduce
(
sendbuf
,
recvbuf
,
count
,
datatype
,
op
,
comm_ptr
);
#endif
}
else
{
/* intercommunicator */
mpi_errno
=
MPIR_Allreduce_inter
(
sendbuf
,
recvbuf
,
count
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment