1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<!--Converted with LaTeX2HTML 98.2 beta6 (August 14th, 1998)
original version by: Nikos Drakos, CBLU, University of Leeds
* revised and updated by: Marcus Hennecke, Ross Moore, Herb Swan
* with significant contributions from:
Jens Lippmann, Marek Rouchal, Martin Wilck and others -->
<HTML>
<HEAD>
<TITLE>The BLAS as the Key to Portability</TITLE>
<META NAME="description" CONTENT="The BLAS as the Key to Portability">
<META NAME="keywords" CONTENT="lug_l2h">
<META NAME="resource-type" CONTENT="document">
<META NAME="distribution" CONTENT="global">
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<LINK REL="STYLESHEET" HREF="lug_l2h.css">
<LINK REL="next" HREF="node66.html">
<LINK REL="previous" HREF="node61.html">
<LINK REL="up" HREF="node60.html">
<LINK REL="next" HREF="node66.html">
</HEAD>
<BODY >
<!--Navigation Panel-->
<A NAME="tex2html5070"
HREF="node66.html">
<IMG WIDTH="37" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="next"
SRC="next_motif.png"></A>
<A NAME="tex2html5064"
HREF="node60.html">
<IMG WIDTH="26" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="up"
SRC="up_motif.png"></A>
<A NAME="tex2html5058"
HREF="node64.html">
<IMG WIDTH="63" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="previous"
SRC="previous_motif.png"></A>
<A NAME="tex2html5066"
HREF="node1.html">
<IMG WIDTH="65" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="contents"
SRC="contents_motif.png"></A>
<A NAME="tex2html5068"
HREF="node152.html">
<IMG WIDTH="43" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="index"
SRC="index_motif.png"></A>
<BR>
<B> Next:</B> <A NAME="tex2html5071"
HREF="node66.html">Block Algorithms and their</A>
<B> Up:</B> <A NAME="tex2html5065"
HREF="node60.html">Performance of LAPACK</A>
<B> Previous:</B> <A NAME="tex2html5059"
HREF="node64.html">Parallelism</A>
  <B> <A NAME="tex2html5067"
HREF="node1.html">Contents</A></B>
  <B> <A NAME="tex2html5069"
HREF="node152.html">Index</A></B>
<BR>
<BR>
<!--End of Navigation Panel-->
<H1><A NAME="SECTION03320000000000000000"></A><A NAME="secblasport"></A><A NAME="7605"></A>
<BR>
The BLAS as the Key to Portability
</H1>
<P>
How then can we hope to be able to achieve sufficient control over
vectorization, data movement, and parallelism in portable Fortran code,
to obtain the levels of performance that machines can offer?
<P>
The LAPACK strategy for combining
efficiency with portability<A NAME="7606"></A> is to construct the software
as much as possible
out of calls to the BLAS (Basic Linear Algebra Subprograms); the BLAS are
used
as building blocks.
<P>
The efficiency<A NAME="7607"></A> of LAPACK software depends on efficient
implementations
of the BLAS being provided by computer vendors (or others) for their
machines.
Thus the BLAS form a low-level interface between LAPACK software and
different machine architectures.
Above this level, almost all of the LAPACK software is truly portable.
<P>
There are now three levels of BLAS:
<P>
<DL>
<DT><STRONG>Level 1 BLAS [<A
HREF="node151.html#blas1">78</A>]:</STRONG>
<DD>for vector operations, such as
<!-- MATH
$y \leftarrow \alpha x + y$
-->
<IMG
WIDTH="92" HEIGHT="30" ALIGN="MIDDLE" BORDER="0"
SRC="img207.png"
ALT="$y \leftarrow \alpha x + y$">
<P>
<DT><STRONG>Level 2 BLAS [<A
HREF="node151.html#blas2">42</A>]:</STRONG>
<DD>for matrix-vector operations, such as
<!-- MATH
$y \leftarrow \alpha A x + \beta y$
-->
<IMG
WIDTH="116" HEIGHT="32" ALIGN="MIDDLE" BORDER="0"
SRC="img208.png"
ALT="$y \leftarrow \alpha A x + \beta y$">
<P>
<DT><STRONG>Level 3 BLAS [<A
HREF="node151.html#blas3">40</A>]:</STRONG>
<DD>for matrix-matrix operations, such as
<!-- MATH
$C \leftarrow \alpha A B + \beta C$
-->
<IMG
WIDTH="129" HEIGHT="32" ALIGN="MIDDLE" BORDER="0"
SRC="img209.png"
ALT="$C \leftarrow \alpha A B + \beta C$">
<P>
</DL>
<P>
Here, <B><I>A</I></B>, <B><I>B</I></B> and <B><I>C</I></B> are matrices, <B><I>x</I></B> and <B><I>y</I></B> are vectors, and <IMG
WIDTH="16" HEIGHT="16" ALIGN="BOTTOM" BORDER="0"
SRC="img49.png"
ALT="$\alpha$">
and
<IMG
WIDTH="15" HEIGHT="32" ALIGN="MIDDLE" BORDER="0"
SRC="img50.png"
ALT="$\beta$">
are scalars.
<P>
The Level 1 BLAS<A NAME="7613"></A> are used in LAPACK,
but for convenience rather than
for performance: they perform an insignificant fraction of the computation,
and they cannot achieve high efficiency on most modern supercomputers.
<P>
The Level 2 BLAS<A NAME="7614"></A> can achieve near-peak performance
on many vector processors,
such as a single processor of a CRAY Y-MP, CRAY C90, or CONVEX C4 machine.
However on other vector processors, such as a CRAY 2,
or a RISC workstation or PC with one more levels of cache,
their performance is limited by the rate of data movement between different
levels of memory.
<P>
This limitation is overcome by the Level 3 BLAS<A NAME="7615"></A>,
which perform <B><I>O</I>(<I>n</I><SUP>3</SUP>)</B>
floating-point operations on <B><I>O</I>(<I>n</I><SUP>2</SUP>)</B> data, whereas the Level 2 BLAS
perform only <B><I>O</I>(<I>n</I><SUP>2</SUP>)</B> operations on <B><I>O</I>(<I>n</I><SUP>2</SUP>)</B> data.
<P>
The BLAS also allow us to exploit parallelism in a way that is transparent
to the software that calls them.
Even the Level 2 BLAS offer some scope for exploiting parallelism, but
greater
scope is provided by the Level 3 BLAS, as Table <A HREF="node65.html#tabsgiblas">3.1</A>
illustrates.
<P>
<BR>
<DIV ALIGN="CENTER">
<A NAME="tabsgiblas"></A>
<P>
<DIV ALIGN="CENTER">
(all matrices are of order 1000; <B><I>U</I></B> is upper triangular)
</DIV>
<P>
<DIV ALIGN="CENTER">
<BR>
</DIV>
<P>
<DIV ALIGN="CENTER"><A NAME="7618"></A>
<TABLE CELLPADDING=3 BORDER="1">
<CAPTION><STRONG>Table 3.1:</STRONG>
Speed in megaflops of Level 2 and Level 3 BLAS operations on an
SGI Origin 2000</CAPTION>
<TR><TD ALIGN="LEFT">Number of processors:</TD>
<TD ALIGN="RIGHT">1</TD>
<TD ALIGN="RIGHT">2</TD>
<TD ALIGN="RIGHT">4</TD>
<TD ALIGN="RIGHT">8</TD>
<TD ALIGN="RIGHT">16</TD>
</TR>
<TR><TD ALIGN="LEFT">Level 2:
<!-- MATH
$y \leftarrow \alpha A x + \beta y$
-->
<IMG
WIDTH="116" HEIGHT="32" ALIGN="MIDDLE" BORDER="0"
SRC="img208.png"
ALT="$y \leftarrow \alpha A x + \beta y$"></TD>
<TD ALIGN="RIGHT">210</TD>
<TD ALIGN="RIGHT">154</TD>
<TD ALIGN="RIGHT">385</TD>
<TD ALIGN="RIGHT">493</TD>
<TD ALIGN="RIGHT">163</TD>
</TR>
<TR><TD ALIGN="LEFT">Level 3:
<!-- MATH
$C \leftarrow \alpha A B + \beta C$
-->
<IMG
WIDTH="129" HEIGHT="32" ALIGN="MIDDLE" BORDER="0"
SRC="img209.png"
ALT="$C \leftarrow \alpha A B + \beta C$"></TD>
<TD ALIGN="RIGHT">555</TD>
<TD ALIGN="RIGHT">1021</TD>
<TD ALIGN="RIGHT">1864</TD>
<TD ALIGN="RIGHT">3758</TD>
<TD ALIGN="RIGHT">4200</TD>
</TR>
<TR><TD ALIGN="LEFT">Level 2:
<!-- MATH
$x \leftarrow U x$
-->
<IMG
WIDTH="65" HEIGHT="16" ALIGN="BOTTOM" BORDER="0"
SRC="img210.png"
ALT="$x \leftarrow U x$"></TD>
<TD ALIGN="RIGHT">162</TD>
<TD ALIGN="RIGHT">152</TD>
<TD ALIGN="RIGHT">148</TD>
<TD ALIGN="RIGHT">153</TD>
<TD ALIGN="RIGHT">137</TD>
</TR>
<TR><TD ALIGN="LEFT">Level 3:
<!-- MATH
$B \leftarrow U B$
-->
<IMG
WIDTH="74" HEIGHT="16" ALIGN="BOTTOM" BORDER="0"
SRC="img211.png"
ALT="$B \leftarrow U B$"></TD>
<TD ALIGN="RIGHT">518</TD>
<TD ALIGN="RIGHT">910</TD>
<TD ALIGN="RIGHT">1842</TD>
<TD ALIGN="RIGHT">3519</TD>
<TD ALIGN="RIGHT">5171</TD>
</TR>
<TR><TD ALIGN="LEFT">Level 2:
<!-- MATH
$x \leftarrow U^{-1} x$
-->
<IMG
WIDTH="83" HEIGHT="19" ALIGN="BOTTOM" BORDER="0"
SRC="img212.png"
ALT="$x \leftarrow U^{-1} x$"></TD>
<TD ALIGN="RIGHT">172</TD>
<TD ALIGN="RIGHT">80</TD>
<TD ALIGN="RIGHT">140</TD>
<TD ALIGN="RIGHT">168</TD>
<TD ALIGN="RIGHT">17</TD>
</TR>
<TR><TD ALIGN="LEFT">Level 3:
<!-- MATH
$B \leftarrow U^{-1} B$
-->
<IMG
WIDTH="92" HEIGHT="19" ALIGN="BOTTOM" BORDER="0"
SRC="img213.png"
ALT="$B \leftarrow U^{-1} B$"></TD>
<TD ALIGN="RIGHT">519</TD>
<TD ALIGN="RIGHT">967</TD>
<TD ALIGN="RIGHT">1859</TD>
<TD ALIGN="RIGHT">3507</TD>
<TD ALIGN="RIGHT">5078</TD>
</TR>
</TABLE>
</DIV>
</DIV>
<BR><HR>
<!--Navigation Panel-->
<A NAME="tex2html5070"
HREF="node66.html">
<IMG WIDTH="37" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="next"
SRC="next_motif.png"></A>
<A NAME="tex2html5064"
HREF="node60.html">
<IMG WIDTH="26" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="up"
SRC="up_motif.png"></A>
<A NAME="tex2html5058"
HREF="node64.html">
<IMG WIDTH="63" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="previous"
SRC="previous_motif.png"></A>
<A NAME="tex2html5066"
HREF="node1.html">
<IMG WIDTH="65" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="contents"
SRC="contents_motif.png"></A>
<A NAME="tex2html5068"
HREF="node152.html">
<IMG WIDTH="43" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="index"
SRC="index_motif.png"></A>
<BR>
<B> Next:</B> <A NAME="tex2html5071"
HREF="node66.html">Block Algorithms and their</A>
<B> Up:</B> <A NAME="tex2html5065"
HREF="node60.html">Performance of LAPACK</A>
<B> Previous:</B> <A NAME="tex2html5059"
HREF="node64.html">Parallelism</A>
  <B> <A NAME="tex2html5067"
HREF="node1.html">Contents</A></B>
  <B> <A NAME="tex2html5069"
HREF="node152.html">Index</A></B>
<!--End of Navigation Panel-->
<ADDRESS>
<I>Susan Blackford</I>
<BR><I>1999-10-01</I>
</ADDRESS>
</BODY>
</HTML>
|