<s>
Collective	B-Operating_System
operations	I-Operating_System
are	O
building	O
blocks	O
for	O
interaction	O
patterns	O
,	O
that	O
are	O
often	O
used	O
in	O
SPMD	B-Operating_System
algorithms	O
in	O
the	O
parallel	B-Operating_System
programming	I-Operating_System
context	O
.	O
</s>
<s>
A	O
realization	O
of	O
the	O
collective	B-Operating_System
operations	I-Operating_System
is	O
provided	O
by	O
the	O
Message	B-Application
Passing	I-Application
Interface	I-Application
(	O
MPI	O
)	O
.	O
</s>
<s>
A	O
distributed	B-Operating_System
memory	I-Operating_System
model	I-Operating_System
is	O
assumed	O
.	O
</s>
<s>
The	O
concepts	O
are	O
similar	O
for	O
the	O
shared	B-Operating_System
memory	I-Operating_System
model	I-Operating_System
.	O
</s>
<s>
However	O
,	O
shared	B-Operating_System
memory	I-Operating_System
systems	O
can	O
provide	O
hardware	O
support	O
for	O
some	O
operations	O
like	O
broadcast	O
(	O
)	O
for	O
example	O
,	O
which	O
allows	O
convenient	O
concurrent	B-Operating_System
read	O
.	O
</s>
<s>
The	O
broadcast	O
pattern	O
is	O
used	O
to	O
distribute	O
data	O
from	O
one	O
processing	O
unit	O
to	O
all	O
processing	O
units	O
,	O
which	O
is	O
often	O
needed	O
in	O
SPMD	B-Operating_System
parallel	B-Operating_System
programs	I-Operating_System
to	O
dispense	O
input	O
or	O
global	O
values	O
.	O
</s>
<s>
Since	O
an	O
implementation	O
by	O
means	O
of	O
a	O
sequential	O
for-loop	O
with	O
iterations	O
becomes	O
a	O
bottleneck	O
,	O
divide-and-conquer	B-Algorithm
approaches	I-Algorithm
are	O
common	O
.	O
</s>
<s>
For	O
long	O
messages	O
a	O
corresponding	O
implementation	O
is	O
suitable	O
,	O
whereas	O
for	O
short	O
messages	O
,	O
the	O
latency	O
can	O
be	O
reduced	O
by	O
using	O
a	O
hypercube	B-Operating_System
(	O
)	O
topology	B-Architecture
,	O
if	O
is	O
a	O
power	O
of	O
two	O
.	O
</s>
<s>
All-reduce	O
can	O
also	O
be	O
implemented	O
with	O
a	O
butterfly	B-Architecture
algorithm	I-Architecture
and	O
achieve	O
optimal	O
latency	O
and	O
bandwidth	O
.	O
</s>
<s>
All-reduce	O
implemented	O
with	O
a	O
butterfly	B-Architecture
algorithm	I-Architecture
achieves	O
the	O
same	O
asymptotic	O
runtime	O
.	O
</s>
<s>
For	O
short	O
messages	O
,	O
this	O
can	O
be	O
achieved	O
with	O
a	O
hypercube	B-Operating_System
topology	B-Architecture
if	O
is	O
a	O
power	O
of	O
two	O
.	O
</s>
<s>
For	O
long	O
messages	O
,	O
the	O
hypercube	B-Operating_System
(	O
,	O
)	O
topology	B-Architecture
is	O
not	O
suitable	O
,	O
since	O
all	O
processing	O
units	O
are	O
active	O
in	O
every	O
step	O
and	O
therefore	O
pipelining	O
ca	O
n't	O
be	O
used	O
.	O
</s>
<s>
A	O
binary	O
tree	O
topology	B-Architecture
is	O
better	O
suited	O
for	O
arbitrary	O
and	O
long	O
messages	O
(	O
)	O
.	O
</s>
<s>
The	O
barrier	B-Operating_System
as	O
a	O
collective	B-Operating_System
operation	I-Operating_System
is	O
a	O
generalization	O
of	O
the	O
concept	O
of	O
a	O
barrier	B-Operating_System
,	O
that	O
can	O
be	O
used	O
in	O
distributed	O
computing	O
.	O
</s>
<s>
When	O
a	O
processing	O
unit	O
calls	O
barrier	B-Operating_System
,	O
it	O
waits	O
until	O
all	O
other	O
processing	O
units	O
have	O
called	O
barrier	B-Operating_System
as	O
well	O
.	O
</s>
<s>
Barrier	B-Operating_System
is	O
thus	O
used	O
to	O
achieve	O
global	O
synchronization	O
in	O
distributed	O
computing	O
.	O
</s>
<s>
One	O
way	O
to	O
implement	O
barrier	B-Operating_System
is	O
to	O
call	O
all-reduce	O
(	O
)	O
with	O
an	O
empty/	O
dummy	O
operand	O
.	O
</s>
<s>
If	O
the	O
message	O
size	O
is	O
small	O
and	O
latency	O
dominates	O
the	O
communication	O
,	O
a	O
hypercube	B-Operating_System
algorithm	O
can	O
be	O
used	O
to	O
distribute	O
the	O
messages	O
in	O
time	O
.	O
</s>
<s>
This	O
table	O
gives	O
an	O
overview	O
over	O
the	O
best	O
known	O
asymptotic	O
runtimes	O
,	O
assuming	O
we	O
have	O
free	O
choice	O
of	O
network	B-Architecture
topology	I-Architecture
.	O
</s>
<s>
Example	O
topologies	B-Architecture
we	O
want	O
for	O
optimal	O
runtime	O
are	O
binary	O
tree	O
,	O
binomial	O
tree	O
,	O
hypercube	B-Operating_System
.	O
</s>
<s>
In	O
practice	O
,	O
we	O
have	O
to	O
adjust	O
to	O
the	O
available	O
physical	B-Architecture
topologies	I-Architecture
,	O
e.g.	O
</s>
<s>
dragonfly	O
,	O
fat	B-Protocol
tree	I-Protocol
,	O
grid	B-Protocol
network	I-Protocol
(	O
references	O
other	O
topologies	B-Architecture
,	O
too	O
)	O
.	O
</s>
<s>
More	O
information	O
under	O
Network	B-Architecture
topology	I-Architecture
.	O
</s>
<s>
Complexity	O
gives	O
the	O
asymptotic	O
runtime	O
complexity	O
of	O
an	O
optimal	O
implementation	O
under	O
free	O
choice	O
of	O
topology	B-Architecture
.	O
</s>
