<s>
In	O
computing	O
,	O
a	O
cache-oblivious	B-Application
algorithm	I-Application
(	O
or	O
cache-transcendent	O
algorithm	O
)	O
is	O
an	O
algorithm	O
designed	O
to	O
take	O
advantage	O
of	O
a	O
processor	B-General_Concept
cache	I-General_Concept
without	O
having	O
the	O
size	O
of	O
the	O
cache	B-General_Concept
(	O
or	O
the	O
length	O
of	O
the	O
cache	B-General_Concept
lines	I-General_Concept
,	O
etc	O
.	O
)	O
</s>
<s>
An	O
optimal	O
cache-oblivious	B-Application
algorithm	I-Application
is	O
a	O
cache-oblivious	B-Application
algorithm	I-Application
that	O
uses	O
the	O
cache	B-General_Concept
optimally	O
(	O
in	O
an	O
asymptotic	O
sense	O
,	O
ignoring	O
constant	O
factors	O
)	O
.	O
</s>
<s>
Thus	O
,	O
a	O
cache-oblivious	B-Application
algorithm	I-Application
is	O
designed	O
to	O
perform	O
well	O
,	O
without	O
modification	O
,	O
on	O
multiple	O
machines	O
with	O
different	O
cache	B-General_Concept
sizes	O
,	O
or	O
for	O
a	O
memory	B-General_Concept
hierarchy	I-General_Concept
with	O
different	O
levels	O
of	O
cache	B-General_Concept
having	O
different	O
sizes	O
.	O
</s>
<s>
Cache-oblivious	B-Application
algorithms	I-Application
are	O
contrasted	O
with	O
explicit	O
loop	O
tiling	O
,	O
which	O
explicitly	O
breaks	O
a	O
problem	O
into	O
blocks	O
that	O
are	O
optimally	O
sized	O
for	O
a	O
given	O
cache	B-General_Concept
.	O
</s>
<s>
Optimal	O
cache-oblivious	B-Application
algorithms	I-Application
are	O
known	O
for	O
matrix	O
multiplication	O
,	O
matrix	O
transposition	O
,	O
sorting	B-Algorithm
,	O
and	O
several	O
other	O
problems	O
.	O
</s>
<s>
Some	O
more	O
general	O
algorithms	O
,	O
such	O
as	O
Cooley	B-Algorithm
–	I-Algorithm
Tukey	I-Algorithm
FFT	I-Algorithm
,	O
are	O
optimally	O
cache-oblivious	B-Application
under	O
certain	O
choices	O
of	O
parameters	O
.	O
</s>
<s>
As	O
these	O
algorithms	O
are	O
only	O
optimal	O
in	O
an	O
asymptotic	O
sense	O
(	O
ignoring	O
constant	O
factors	O
)	O
,	O
further	O
machine-specific	O
tuning	B-Device
may	O
be	O
required	O
to	O
obtain	O
nearly	O
optimal	O
performance	O
in	O
an	O
absolute	O
sense	O
.	O
</s>
<s>
The	O
goal	O
of	O
cache-oblivious	B-Application
algorithms	I-Application
is	O
to	O
reduce	O
the	O
amount	O
of	O
such	O
tuning	B-Device
that	O
is	O
required	O
.	O
</s>
<s>
Typically	O
,	O
a	O
cache-oblivious	B-Application
algorithm	I-Application
works	O
by	O
a	O
recursive	O
divide-and-conquer	B-Algorithm
algorithm	I-Algorithm
,	O
where	O
the	O
problem	O
is	O
divided	O
into	O
smaller	O
and	O
smaller	O
subproblems	O
.	O
</s>
<s>
Eventually	O
,	O
one	O
reaches	O
a	O
subproblem	O
size	O
that	O
fits	O
into	O
the	O
cache	B-General_Concept
,	O
regardless	O
of	O
the	O
cache	B-General_Concept
size	O
.	O
</s>
<s>
For	O
example	O
,	O
an	O
optimal	O
cache-oblivious	B-Application
matrix	O
multiplication	O
is	O
obtained	O
by	O
recursively	O
dividing	O
each	O
matrix	O
into	O
four	O
sub-matrices	O
to	O
be	O
multiplied	O
,	O
multiplying	O
the	O
submatrices	O
in	O
a	O
depth-first	B-Algorithm
fashion	O
.	O
</s>
<s>
In	O
tuning	B-Device
for	O
a	O
specific	O
machine	O
,	O
one	O
may	O
use	O
a	O
hybrid	B-Algorithm
algorithm	I-Algorithm
which	O
uses	O
loop	O
tiling	O
tuned	O
for	O
the	O
specific	O
cache	B-General_Concept
sizes	O
at	O
the	O
bottom	O
level	O
but	O
otherwise	O
uses	O
the	O
cache-oblivious	B-Application
algorithm	I-Application
.	O
</s>
<s>
The	O
idea	O
(	O
and	O
name	O
)	O
for	O
cache-oblivious	B-Application
algorithms	I-Application
was	O
conceived	O
by	O
Charles	O
E	O
.	O
Leiserson	O
as	O
early	O
as	O
1996	O
and	O
first	O
published	O
by	O
Harald	O
Prokop	O
in	O
his	O
master	O
's	O
thesis	O
at	O
the	O
Massachusetts	O
Institute	O
of	O
Technology	O
in	O
1999	O
.	O
</s>
<s>
1987	O
,	O
Frigo	O
1996	O
for	O
matrix	O
multiplication	O
and	O
LU	O
decomposition	O
,	O
and	O
Todd	O
Veldhuizen	O
1996	O
for	O
matrix	O
algorithms	O
in	O
the	O
Blitz++	B-Language
library	O
.	O
</s>
<s>
In	O
general	O
,	O
a	O
program	B-Application
can	O
be	O
made	O
more	O
cache-conscious	O
:	O
</s>
<s>
Cache-oblivious	B-Application
algorithms	I-Application
are	O
typically	O
analyzed	O
using	O
an	O
idealized	O
model	O
of	O
the	O
cache	B-General_Concept
,	O
sometimes	O
called	O
the	O
cache-oblivious	B-Application
model	I-Application
.	O
</s>
<s>
This	O
model	O
is	O
much	O
easier	O
to	O
analyze	O
than	O
a	O
real	O
cache	B-General_Concept
's	O
characteristics	O
(	O
which	O
have	O
complicated	O
associativity	O
,	O
replacement	O
policies	O
,	O
etc	O
.	O
</s>
<s>
)	O
,	O
but	O
in	O
many	O
cases	O
is	O
within	O
a	O
constant	O
factor	O
of	O
a	O
more	O
realistic	O
cache	B-General_Concept
's	O
performance	O
.	O
</s>
<s>
It	O
is	O
different	O
than	O
the	O
external	B-Application
memory	I-Application
model	I-Application
because	O
cache-oblivious	B-Application
algorithms	I-Application
do	O
not	O
know	O
the	O
block	B-General_Concept
size	I-General_Concept
or	O
the	O
cache	B-General_Concept
size	O
.	O
</s>
<s>
In	O
particular	O
,	O
the	O
cache-oblivious	B-Application
model	I-Application
is	O
an	O
abstract	B-Application
machine	I-Application
(	O
i.e.	O
,	O
a	O
theoretical	O
model	O
of	O
computation	O
)	O
.	O
</s>
<s>
It	O
is	O
similar	O
to	O
the	O
RAM	B-Application
machine	I-Application
model	I-Application
which	O
replaces	O
the	B-Architecture
Turing	I-Architecture
machine	I-Architecture
's	O
infinite	O
tape	O
with	O
an	O
infinite	O
array	O
.	O
</s>
<s>
Each	O
location	O
within	O
the	O
array	O
can	O
be	O
accessed	O
in	O
time	O
,	O
similar	O
to	O
the	O
random-access	B-Architecture
memory	I-Architecture
on	O
a	O
real	O
computer	O
.	O
</s>
<s>
Unlike	O
the	O
RAM	B-Application
machine	I-Application
model	I-Application
,	O
it	O
also	O
introduces	O
a	O
cache	B-General_Concept
:	O
the	O
second	O
level	O
of	O
storage	O
between	O
the	O
RAM	B-Architecture
and	O
the	O
CPU	O
.	O
</s>
<s>
In	O
the	O
cache-oblivious	B-Application
model	I-Application
:	O
</s>
<s>
A	O
load	O
or	O
a	O
store	O
between	O
main	O
memory	O
and	O
a	O
CPU	O
register	O
may	O
now	O
be	O
serviced	O
from	O
the	O
cache	B-General_Concept
.	O
</s>
<s>
If	O
a	O
load	O
or	O
a	O
store	O
cannot	O
be	O
serviced	O
from	O
the	O
cache	B-General_Concept
,	O
it	O
is	O
called	O
a	O
cache	B-General_Concept
miss	O
.	O
</s>
<s>
A	O
cache	B-General_Concept
miss	O
results	O
in	O
one	O
block	O
being	O
loaded	O
from	O
the	O
main	O
memory	O
into	O
the	O
cache	B-General_Concept
.	O
</s>
<s>
Namely	O
,	O
if	O
the	O
CPU	O
tries	O
to	O
access	O
word	O
and	O
is	O
the	O
line	O
containing	O
,	O
then	O
is	O
loaded	O
into	O
the	O
cache	B-General_Concept
.	O
</s>
<s>
If	O
the	O
cache	B-General_Concept
was	O
previously	O
full	O
,	O
then	O
a	O
line	O
will	O
be	O
evicted	O
as	O
well	O
(	O
see	O
replacement	O
policy	O
below	O
)	O
.	O
</s>
<s>
The	O
cache	B-General_Concept
holds	O
objects	O
,	O
where	O
.	O
</s>
<s>
This	O
is	O
also	O
known	O
as	O
the	O
tall	O
cache	B-General_Concept
assumption	O
.	O
</s>
<s>
The	O
cache	B-General_Concept
is	O
fully	O
associative	O
:	O
each	O
line	O
can	O
be	O
loaded	O
into	O
any	O
location	O
in	O
the	O
cache	B-General_Concept
.	O
</s>
<s>
In	O
other	O
words	O
,	O
the	O
cache	B-General_Concept
is	O
assumed	O
to	O
be	O
given	O
the	O
entire	O
sequence	O
of	O
memory	O
accesses	O
during	O
algorithm	O
execution	O
.	O
</s>
<s>
To	O
measure	O
the	O
complexity	O
of	O
an	O
algorithm	O
that	O
executes	O
within	O
the	O
cache-oblivious	B-Application
model	I-Application
,	O
we	O
measure	O
the	O
number	O
of	O
cache	B-General_Concept
misses	O
that	O
the	O
algorithm	O
experiences	O
.	O
</s>
<s>
Because	O
the	O
model	O
captures	O
the	O
fact	O
that	O
accessing	O
elements	O
in	O
the	O
cache	B-General_Concept
is	O
much	O
faster	O
than	O
accessing	O
things	O
in	O
main	O
memory	O
,	O
the	O
running	O
time	O
of	O
the	O
algorithm	O
is	O
defined	O
only	O
by	O
the	O
number	O
of	O
memory	O
transfers	O
between	O
the	O
cache	B-General_Concept
and	O
main	O
memory	O
.	O
</s>
<s>
This	O
is	O
similar	O
to	O
the	O
external	B-Application
memory	I-Application
model	I-Application
,	O
which	O
all	O
of	O
the	O
features	O
above	O
,	O
but	O
cache-oblivious	B-Application
algorithms	I-Application
are	O
independent	O
of	O
cache	B-General_Concept
parameters	O
(	O
and	O
)	O
.	O
</s>
<s>
The	O
benefit	O
of	O
such	O
an	O
algorithm	O
is	O
that	O
what	O
is	O
efficient	O
on	O
a	O
cache-oblivious	B-Application
machine	O
is	O
likely	O
to	O
be	O
efficient	O
across	O
many	O
real	O
machines	O
without	O
fine-tuning	O
for	O
particular	O
real	O
machine	O
parameters	O
.	O
</s>
<s>
For	O
many	O
problems	O
,	O
an	O
optimal	O
cache-oblivious	B-Application
algorithm	I-Application
will	O
also	O
be	O
optimal	O
for	O
a	O
machine	O
with	O
more	O
than	O
two	O
memory	B-General_Concept
hierarchy	I-General_Concept
levels	O
.	O
</s>
<s>
The	O
simplest	O
cache-oblivious	B-Application
algorithm	I-Application
presented	O
in	O
Frigo	O
et	O
al	O
.	O
</s>
<s>
is	O
an	O
out-of-place	O
matrix	O
transpose	O
operation	O
(	O
in-place	B-Algorithm
algorithms	I-Algorithm
have	O
also	O
been	O
devised	O
for	O
transposition	O
,	O
but	O
are	O
much	O
more	O
complicated	O
for	O
non-square	O
matrices	O
)	O
.	O
</s>
<s>
The	O
result	O
is	O
that	O
when	O
the	O
matrices	O
are	O
large	O
,	O
we	O
get	O
a	O
cache	B-General_Concept
miss	O
on	O
every	O
step	O
of	O
the	O
column-wise	O
traversal	O
.	O
</s>
<s>
The	O
total	O
number	O
of	O
cache	B-General_Concept
misses	O
is	O
.	O
</s>
<s>
The	O
cache-oblivious	B-Application
algorithm	I-Application
has	O
optimal	O
work	O
complexity	O
and	O
optimal	O
cache	B-General_Concept
complexity	O
.	O
</s>
<s>
We	O
do	O
this	O
by	O
dividing	O
the	O
matrices	O
in	O
half	O
along	O
their	O
larger	O
dimension	O
until	O
we	O
just	O
have	O
to	O
perform	O
the	O
transpose	O
of	O
a	O
matrix	O
that	O
will	O
fit	O
into	O
the	O
cache	B-General_Concept
.	O
</s>
<s>
Because	O
the	O
cache	B-General_Concept
size	O
is	O
not	O
known	O
to	O
the	O
algorithm	O
,	O
the	O
matrices	O
will	O
continue	O
to	O
be	O
divided	O
recursively	O
even	O
after	O
this	O
point	O
,	O
but	O
these	O
further	O
subdivisions	O
will	O
be	O
in	O
cache	B-General_Concept
.	O
</s>
<s>
Once	O
the	O
dimensions	O
and	O
are	O
small	O
enough	O
so	O
an	O
input	O
array	O
of	O
size	O
and	O
an	O
output	O
array	O
of	O
size	O
fit	O
into	O
the	O
cache	B-General_Concept
,	O
both	O
row-major	O
and	O
column-major	O
traversals	O
result	O
in	O
work	O
and	O
cache	B-General_Concept
misses	O
.	O
</s>
<s>
By	O
using	O
this	O
divide	B-Algorithm
and	I-Algorithm
conquer	I-Algorithm
approach	I-Algorithm
we	O
can	O
achieve	O
the	O
same	O
level	O
of	O
complexity	O
for	O
the	O
overall	O
matrix	O
.	O
</s>
<s>
1616	O
)	O
in	O
order	O
to	O
amortize	B-General_Concept
the	O
overhead	O
of	O
the	O
recursive	O
subroutine	O
calls	O
.	O
)	O
</s>
<s>
Most	O
cache-oblivious	B-Application
algorithms	I-Application
rely	O
on	O
a	O
divide-and-conquer	O
approach	O
.	O
</s>
<s>
They	O
reduce	O
the	O
problem	O
,	O
so	O
that	O
it	O
eventually	O
fits	O
in	O
cache	B-General_Concept
no	O
matter	O
how	O
small	O
the	O
cache	B-General_Concept
is	O
,	O
and	O
end	O
the	O
recursion	O
at	O
some	O
small	O
size	O
determined	O
by	O
the	O
function-call	O
overhead	O
and	O
similar	O
cache-unrelated	O
optimizations	O
,	O
and	O
then	O
use	O
some	O
cache-efficient	O
access	O
pattern	O
to	O
merge	O
the	O
results	O
of	O
these	O
small	O
,	O
solved	O
problems	O
.	O
</s>
<s>
Like	O
external	B-Algorithm
sorting	I-Algorithm
in	O
the	O
external	B-Application
memory	I-Application
model	I-Application
,	O
cache-oblivious	B-Application
sorting	B-Algorithm
is	O
possible	O
in	O
two	O
variants	O
:	O
funnelsort	B-Algorithm
,	O
which	O
resembles	O
mergesort	B-Algorithm
,	O
and	O
cache-oblivious	B-Application
distribution	I-Application
sort	I-Application
,	O
which	O
resembles	O
quicksort	B-Algorithm
.	O
</s>
<s>
Like	O
their	O
external	O
memory	O
counterparts	O
,	O
both	O
achieve	O
a	O
running	O
time	O
of	O
,	O
which	O
matches	O
a	O
lower	O
bound	O
and	O
is	O
thus	O
asymptotically	B-General_Concept
optimal	I-General_Concept
.	O
</s>
<s>
An	O
empirical	O
comparison	O
of	O
2	O
RAM-based	O
,	O
1	O
cache-aware	O
,	O
and	O
2	O
cache-oblivious	B-Application
algorithms	I-Application
implementing	O
priority	B-Application
queues	I-Application
found	O
that	O
:	O
</s>
<s>
Cache-oblivious	B-Application
algorithms	I-Application
performed	O
worse	O
than	O
RAM-based	O
and	O
cache-aware	O
algorithms	O
when	O
data	O
fits	O
into	O
main	O
memory	O
.	O
</s>
<s>
The	O
cache-aware	O
algorithm	O
did	O
not	O
seem	O
significantly	O
more	O
complex	O
to	O
implement	O
than	O
the	O
cache-oblivious	B-Application
algorithms	I-Application
,	O
and	O
offered	O
the	O
best	O
performance	O
in	O
all	O
cases	O
tested	O
in	O
the	O
study	O
.	O
</s>
<s>
Cache	B-Application
oblivious	I-Application
algorithms	O
outperformed	O
RAM-based	O
algorithms	O
when	O
data	O
size	O
exceeded	O
the	O
size	O
of	O
main	O
memory	O
.	O
</s>
<s>
Another	O
study	O
compared	O
hash	B-Algorithm
tables	I-Algorithm
(	O
as	O
RAM-based	O
or	O
cache-unaware	O
)	O
,	O
B-trees	B-Architecture
(	O
as	O
cache-aware	O
)	O
,	O
and	O
a	O
cache-oblivious	B-Application
data	O
structure	O
referred	O
to	O
as	O
a	O
"	O
Bender	O
set	O
"	O
.	O
</s>
<s>
For	O
both	O
execution	O
time	O
and	O
memory	O
usage	O
,	O
the	O
hash	B-Algorithm
table	I-Algorithm
was	O
best	O
,	O
followed	O
by	O
the	O
B-tree	B-Architecture
,	O
with	O
the	O
Bender	O
set	O
the	O
worst	O
in	O
all	O
cases	O
.	O
</s>
<s>
The	O
hash	B-Algorithm
tables	I-Algorithm
were	O
described	O
as	O
easy	O
to	O
implement	O
,	O
while	O
the	O
Bender	O
set	O
"	O
required	O
a	O
greater	O
amount	O
of	O
effort	O
to	O
implement	O
correctly	O
"	O
.	O
</s>
