forked from johannesgerer/jburkardt-f
-
Notifications
You must be signed in to change notification settings - Fork 1
/
matmul.html
431 lines (397 loc) · 12.9 KB
/
matmul.html
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
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
<html>
<head>
<title>
MATMUL - A Matrix Multiplication Benchmark
</title>
</head>
<body bgcolor="#EEEEEE" link="#CC0000" alink="#FF3300" vlink="#000055">
<h1 align = "center">
MATMUL <br> A Matrix Multiplication Benchmark
</h1>
<hr>
<p>
<b>MATMUL</b>
is a FORTRAN90 program which
compares various methods for computing the matrix product
<pre><b>
A * B = C.
</b></pre>
</p>
<p>
<b>MATMUL</b> can do this for a variety of matrix sizes, and for different
arithmetics (real, complex, double precision, integer, even logical!)
There are many algorithms built in, including the
simple triple DO loop (actually not so simple; there are 6 ways to
set it up), some unrolling techniques, and the level 1 and 2 BLAS
routines.
</p>
<p>
<b>MATMUL</b> is interactive, so the user can easily pursue any
line of inquiry that seems promising. New algorithms or locally
available methods are not to hard to add.
</p>
<h3 align = "center">
Licensing:
</h3>
<p>
The computer code and data files described and made available on this web page
are distributed under
<a href = "../../txt/gnu_lgpl.txt">the GNU LGPL license.</a>
</p>
<h3 align = "center">
Languages:
</h3>
<p>
<b>MATMUL</b> is available in
<a href = "../../c_src/matmul/matmul.html">a C version</a> and
<a href = "../../f77_src/matmul/matmul.html">a FORTRAN77 version</a> and
<a href = "../../f_src/matmul/matmul.html">a FORTRAN90 version.</a>
</p>
<h3 align = "center">
Related Data and Programs:
</h3>
<p>
<a href = "../../f_src/linpack_bench/linpack_bench.html">
LINPACK_BENCH</a>,
a FORTRAN90 program which
measures the time needed to factor and solve a linear system.
</p>
<p>
<a href = "../../f77_src/mdbnch/mdbnch.html">
MDBNCH</a>,
a FORTRAN77 program which
is a benchmark code for a molecular dynamics calculation.
</p>
<p>
<a href = "../../f_src/memory_test/memory_test.html">
MEMORY_TEST</a>,
a FORTRAN90 program which
declares and uses a sequence of larger
and larger vectors, to see how big a vector can be used on a given
machine and compiler.
</p>
<p>
<a href = "../../f_src/mxm/mxm.html">
MXM</a>,
a FORTRAN90 program which
sets up a matrix multiplication problem A=B*C of arbitrary size,
and compares the time required for IJK, IKJ, JIK, JKI, KIJ and KJI orderings
of the loops.
</p>
<p>
<a href = "../../f_src/mxv/mxv.html">
MXV</a>,
a FORTRAN90 program which
compares the performance of (DO I, DO J) loops, (DO J, DO I) loops,
and MATMUL for computing the product of an MxN matrix A and an N vector X.
</p>
<p>
<a href = "../../f_src/nas/nas.html">
NAS</a>,
a FORTRAN90 program which
runs the NASA kernel benchmark.
</p>
<p>
<a href = "../../f_src/sum_million/sum_million.html">
SUM_MILLION</a>,
a FORTRAN90 program which
sums the integers from 1 to 1,000,000, as a demonstration of how
to rate a computer's speed;
</p>
<p>
<a href = "../../f_src/timer/timer.html">
TIMER</a>,
a FORTRAN90 program which
demonstrates how to compute CPU time or elapsed time.
</p>
<h3 align = "center">
Reference:
</h3>
<p>
<ol>
<li>
John Burkardt, Paul Puglielli,<br>
Pittsburgh Supercomputing Center,<br>
<a href = "../../presentations/matmul.pdf">
MATMUL: An Interactive Matrix Multiplication Benchmark
</a>
</li>
</ol>
</p>
<h3 align = "center">
Source Code:
</h3>
<p>
<ul>
<li>
<a href = "matmul.f90">matmul.f90</a>, the source code;
</li>
<li>
<a href = "matmul.sh">matmul.sh</a>,
commands to compile and load the source code;
</li>
</ul>
</p>
<h3 align = "center">
Examples and Tests:
</h3>
<p>
<ul>
<li>
<a href = "matmul_input.txt">matmul_input.txt</a>,
sample input commands (normally, the program is used interactively);
</li>
<li>
<a href = "matmul_alpha.txt">matmul_alpha.txt</a>,
the output file on an Alpha;
</li>
<li>
<a href = "matmul_osx.txt">matmul_osx.txt</a>,
the output file on an Apple Macintosh running OSX;
</li>
<li>
<a href = "matmul_sgi.txt">matmul_sgi.txt</a>,
the output file on an SGI;
</li>
</ul>
</p>
<h3 align = "center">
List of Routines:
</h3>
<p>
<ul>
<li>
<b>MAIN</b> is the main program for MATMUL.
</li>
<li>
<b>CH_CAP</b> capitalizes a single character.
</li>
<li>
<b>C4_IJK</b> computes A = B*C using index order IJK and complex arithmetic.
</li>
<li>
<b>C4_MATMUL</b> computes A = B*C using FORTRAN90 MATMUL and C4 arithmetic.
</li>
<li>
<b>C4_SET</b> initializes the A, B and C matrices using C4 arithmetic.
</li>
<li>
<b>DOMETHOD</b> calls a specific multiplication routine.
</li>
<li>
<b>GETSHO</b> determines what items the user wishes to print out.
</li>
<li>
<b>HEADER</b> prints out a header for the results.
</li>
<li>
<b>HELLO</b> says hello to the user.
</li>
<li>
<b>HELP</b> prints a list of the available commands.
</li>
<li>
<b>INIT</b> initializes data.
</li>
<li>
<b>I4_MATMUL</b> computes A = B*C using FORTRAN90 MATMUL and I4 arithmetic.
</li>
<li>
<b>I4_IJK</b> multiplies A = B*C using index order IJK, using I4 arithmetic.
</li>
<li>
<b>I46_IJK</b> multiplies A = B*C using index order IJK, and I46 arithmetic.
</li>
<li>
<b>I4_SET</b> initializes the A, B and C matrices using I4 arithmetic.
</li>
<li>
<b>L_IJK</b> "multiplies" A = B*C using index order IJK, using logical data.
</li>
<li>
<b>L_SET</b> initializes the A, B and C matrices using "logical arithmetic".
</li>
<li>
<b>MATMUL_CPU_TIMER</b> computes total CPU seconds.
</li>
<li>
<b>MATMUL_REAL_TIMER</b> returns a reading of the real time clock.
</li>
<li>
<b>MULT</b> carries out the matrix multiplication, using the requested method.
</li>
<li>
<b>N_GET</b> determines the problem sizes desired by the user.
</li>
<li>
<b>N_STEP</b> is used when a set of values of N is being generated.
</li>
<li>
<b>ORDER_GET</b> reads a new value of order from the user.
</li>
<li>
<b>ORDER_LIST_PRINT</b> prints the list of choices for the algorithm.
</li>
<li>
<b>PRINTR</b> prints out those parameters the user wants to see.
</li>
<li>
<b>R4_DOT_PRODUCT</b> multiplies A = B*C using DOT_PRODUCT and R4 arithmetic.
</li>
<li>
<b>R4_MATMUL</b> computes A = B*C using FORTRAN90 MATMUL and R4 arithmetic.
</li>
<li>
<b>R4_IJ</b> sets A = B*C using index order IJ with implicit K and R4 arithmetic.
</li>
<li>
<b>R4_IJK</b> multiplies A = B*C using index order IJK and R4 arithmetic.
</li>
<li>
<b>R4_IJK_IMPLICIT</b> sets A = B*C, index order IJK, implicit loops, R4 arithmetic.
</li>
<li>
<b>R4_IJK_M</b> multiplies A = B*C using index order IJK and R4 arithmetic.
</li>
<li>
<b>R4_IJK_S</b> sets A = B*C, index order IJK, no Cray vectorization, R4 arithmetic.
</li>
<li>
<b>R4_IJK_I2</b> sets A = B*C, index order IJK, unrolling I 2 times, R4 arithmetic.
</li>
<li>
<b>R4_IJK_I4</b> sets A = B*C, index order IJK, unrolling I 4 times, R4 arithmetic.
</li>
<li>
<b>R4_IJK_I8</b> sets A = B*C, index order IJK, unrolling I 8 times, R4 arithmetic.
</li>
<li>
<b>R4_IJK_J4</b> sets A = B*C, index order IJK, unrolling on J, R4 arithmetic.
</li>
<li>
<b>R4_IJK_K4</b> sets A = B*C, index order IJK, unrolling on K, R4 arithmetic.
</li>
<li>
<b>R4_IKJ</b> multiplies A = B*C using index order IKJ, R4 arithmetic.
</li>
<li>
<b>R4_IKJ</b> multiplies A = B*C, index order IKJ, DOT_PRODUCT, R4 arithmetic.
</li>
<li>
<b>R4_JIK</b> multiplies A = B*C using index order JIK, R4 arithmetic.
</li>
<li>
<b>R4_JIK_implicit</b> sets A = B*C, index order JIK, implicit loops, R4 arithmetic.
</li>
<li>
<b>R4_JKI</b> multiplies A = B*C using index order JKI, R4 arithmetic.
</li>
<li>
<b>R4_JKI_IMPLICIT</b> sets A = B*C, index order JKI, implicit loops, R4 arithmetic.
</li>
<li>
<b>R4_KIJ</b> multiplies A = B*C using index order KIJ, R4 arithmetic.
</li>
<li>
<b>R4_KIJ_DOT</b> sets A = B*C using index order KIJ and DOT_PRODUCT, R4 arithmetic.
</li>
<li>
<b>R4_KJI</b> multiplies A = B*C using index order KJI, R4 arithmetic.
</li>
<li>
<b>R4_KJI_IMPLICIT</b> sets A = B*C, index order KJI, implicit loops, R4 arithmetic.
</li>
<li>
<b>R4_KJI_M</b> sets A = B*C using index order KJI and multitasking, R4 arithmetic.
</li>
<li>
<b>R4_MXMA</b> multiplies A = B*C using optimized MXMA, R4 arithmetic.
</li>
<li>
<b>R4_SAXPYC</b> multiplies A = B*C columnwise, using optimized SAXPY, R4 arithmetic.
</li>
<li>
<b>R4_SAXPYR</b> multiplies A = B*C "rowwise", using optimized SAXPY, R4 arithmetic.
</li>
<li>
<b>R4_SDOT</b> multiplies A = B*C using optimized SDOT, R4 arithmetic.
</li>
<li>
<b>R4_SET</b> initializes the A, B and C matrices using R4 arithmetic.
</li>
<li>
<b>R4_SGEMM</b> multiplies A = B*C using optimized SGEMM, R4 arithmetic.
</li>
<li>
<b>R4_SGEMMS</b> multiplies A = B*C using optimized SGEMMS, R4 arithmetic.
</li>
<li>
<b>R4_TAXPYC</b> sets A = B*C columnwise, using source code SAXPY, R4 arithmetic.
</li>
<li>
<b>R4_TAXPYR</b> multiplies A = B*C rowwise using source code SAXPY, R4 arithmetic
</li>
<li>
<b>R4_TDOT</b> multiplies A = B * C using source code SDOT, R4 arithmetic.
</li>
<li>
<b>R4_TGEMM</b> multiplies A = B*C using source code SGEMM, R4 arithmetic.
</li>
<li>
<b>R8_MATMUL</b> computes A = B*C using FORTRAN90 MATMUL and R8 arithmetic.
</li>
<li>
<b>R8_IJK</b> multiplies A = B*C using index order IJK and R8 arithmetic.
</li>
<li>
<b>R8_SET</b> initializes the matrices A, B and C using R8 arithmetic.
</li>
<li>
<b>REPORT</b> reports the results for each multiplication experiment.
</li>
<li>
<b>S_BLANK_DELETE</b> removes blanks from a string, left justifying the remainder.
</li>
<li>
<b>S_CAP</b> replaces any lowercase letters by uppercase ones in a string.
</li>
<li>
<b>S_EQI</b> is a case insensitive comparison of two strings for equality.
</li>
<li>
<b>S_TO_I4</b> reads an I4 from a string.
</li>
<li>
<b>TAXPY</b> is unoptimized standard BLAS routine SAXPY.
</li>
<li>
<b>TDOT</b> computes the inner product of two vectors.
</li>
<li>
<b>TERBLA</b> is the source code for the BLAS error handler.
</li>
<li>
<b>TGEMM</b> is a source code copy of SGEMM, a BLAS matrix * matrix routine.
</li>
<li>
<b>TGEMVF</b> is a source code copy of BLAS SGEMVF, a matrix * vector routine.
</li>
<li>
<b>TIMESTAMP</b> prints the current YMDHMS date as a time stamp.
</li>
<li>
<b>TLSAME</b> is a source code copy of BLAS LSAME, testing character equality.
</li>
</ul>
</p>
<p>
You can go up one level to <a href = "../f_src.html">
the FORTRAN90 source codes</a>.
</p>
<hr>
<i>
Last revised on 23 March 2008.
</i>
<!-- John Burkardt -->
</body>
</html>