Benchmark programs form an important part of the development of new optimization, analysis, and parallelization techniques. Without some sort of quantitative measurement, we cannot really evaluate how well the new techniques work. In order to build up a comprehensive benchmark suite, each person will provide one program that can be incorporated into the suite.
This year, you will be using MATLAB and AspectMatlab. You learned about MATLAB in Assignment #0, and you will be given an introduction to AspectMatlab in class. The web page for AspectMatlab is http://www.sable.mcgill.ca/mclab/projects/aspect-matlab. If you get stuck using the tools, please consult with the TAs and share your expertise with other class mates.
When choosing your benchmark, consider the following:
There are many places to look. Here are a few possibilities:
Report the version of MATLAB that you used.
Report the architecture and OS on which you did the experiments.
Summarize your profile results. Based on this profile discuss which are the most important parts of the program to optimize?
Inside this directory you should have a sub-directory called src/ which contains your source code (the original version), all the inputs, all the outputs, a README that describes how to compile and run your benchmark. Also include a sub-directory called aspect/ that contains the source code for your aspect, also with a README describing your aspect. Finally, include a sub-directory called improved/ that contains the source code of your hand-optimized benchmark, along with a README summarizing the differences between this version and the orig/ version. Also include an info.json file which contains following keys:
{
"name": "benchmark name",
"version": "1.0",
"sources": "benchmarkName/src",
"runPath": "benchmarkName/src/driverFileName.m",
"tags": ["Fall2015_COMP621",“array_growing”]
}
Please change name, sources, runPath and tags with appropriate values. Please include the tag "Fall2015_COMP621", and then other tags can have following values which describe the characteristics of the benchmark. For example, if the benchmark has a recursive function, tags will contain a "recursion" entry.
feval eval array_growing structure function_handle lambda end nested_function subfunction global_variable persistent_variable recursion Complex
Thus, your file should be something like hendren.tar.gz and when unzipped it should create a directory structure like:
/fibonacci
/src
README
<otherfiles>
/aspect
README
<otherfiles>
/improved
README
<otherfiles>
/info.json
Send a link to this file, or as an attachment, to erick.lavoie@mail.mcgill.ca. Indicate on the title of the message cs621 Matlab Benchmark. Please make sure to send just one copy but if you must update what you've already handed in, indicate this in the subject line with the word UPDATE.
Assume the following simplified C-like language which also has some Matlab-like features.
<stmt_seq> ::= <empty_stmt> | <stmt> <stmt_seq>
<stmt> ::= <basic_stmt> ; |
if ( <cond_expr> ) <stmt> else <stmt> |
while ( <cond_expr> ) do <stmt> |
do <stmt> while ( <cond_expr> ) ; |
{ <stmt_seq> }
<basic_stmt> ::= <id> = <id_const> <bin_op> <id_const> |
<id> = <id_const> |
<id> = read_int() |
<id> = read_double() |
<id> = read_array( <id_const>, <id_const> ) |
<id> = <id_const> |
int( <int_const> ) |
sum( <id> ) |
transpose ( <id> ) |
write( <id> ) |
break
<cond_expr> ::= <id_const> <relop> <id_const>
<id_const> ::= <id> | <int_const> | <double_const> | <array_const>
<bin_op> ::= + | * | - | / | mod
<rel_op> ::= < | > | <= | >= | == | !=
This language has three types of variables, scalar integers, scalar doubles and two-dimensional arrays of doubles.
Scalar integers are created via a call to an integer creator, (i.e. int(3)), or via read_int.
Scalar doubles are created via a real constant (i.e. 3, 3.0 or 3e10), or via read_double. Note that 3 denotes the same double value as 3.0.
Arrays of doubles are created via the array constant (i.e. [3.0, 4.0; 5.0, 6.0] would create a 2x2 array), or via read_array.
The rel_op operators must get two scalar arguments, and the result is always the integer 1 for true or the integer 0 false, these values are used to determine control flow. The bin_op operators can have arguments of any of three data types.
The typing rules are dynamic (i.e. checked at run-time) and are summarized as follows:
int bin_op int -> int int bin_op double -> int double bin_op int -> int double bin_op double -> double array bin_op array -> array sum(array) -> double transpose(array) -> array int rel_op int -> int double rel_op double -> int
Any other combination of argument types gives a runtime error.
Consider the following example program.
1: n = read_int();
2: m = read_int();
3: x = read_array(m,n);
4: y = read_array(n,m)
5: if (n > m)
6: { s = 0;
7: do {
8: t1 = x * y;
9: t2 = sum(t1);
10: t3 = s + t2;
11: n = n - 1;
12: } while (n > 0);
13: write(s);
14: }
15: else
16: { p = 1;
17: i = 0;
18: x_tr = transpose(x);
19: while (i < n)
20: { t1 = sum(x);
21: x = x + t1;
22: t2 = sum(x_tr);
22: if (t2 < 0)
24: break; % breaks out of closest enclosing loop
25: p = t1 * t2;
26: i = i + 1;
27: }
28: write(p);
29: }
30: write(n);
Design and formalize an analysis to identify which program variables may be stored as integers. Give the rules for your analysis, and the types it would compute for the example program.
This document was generated using the LaTeX2HTML translator Version 2008 (1.71)
Copyright © 1993, 1994, 1995, 1996,
Nikos Drakos,
Computer Based Learning Unit, University of Leeds.
Copyright © 1997, 1998, 1999,
Ross Moore,
Mathematics Department, Macquarie University, Sydney.
The command line arguments were:
latex2html -local_icons -split 0 a1.tex
The translation was initiated by Laurie HENDREN on 2015-09-21
Laurie HENDREN 2015-09-21