[At this time, JuliusC is an interpreter. It takes a C program as input, it analyzes the input and it generates a type-DAG as output. The analysis may require the execution of the input, but in general, it is only partial.]
The Type-DAG has several practical applications and we will present some of them in the following. We present 6 types of application, each one representative of a particular feature-concept. We generate the type-DAG on demand using a cgi-scripts, but we have some limitations.
How to read the output? (what output?)
Parsing ... Semantic Analysis ... Binding Function Calls to Function Definitions ... ----------> get time 0 sec<------ Static Type Checking ... ----------> get time 0 sec<------ Checking Return statments... ----------> get time 0 sec<------ Call Graph from Main .... ----------> get time 0 sec<------ Function calls properties .... ----------> get time 0 sec<------ Data Dependency Analysis ... ----------> get time 0.02 sec<------ Data dependecy result .... ----------> get time 0 sec<------ Marking D&C formals ... ----------> get time 0 sec<------ Check the formals on the function definitions ... Interpretation ... ----------> get time 3.1 sec<------ On count Reuse Ratio 605379 ----------> get time 0.01 sec<------ main<> [1] {} |Rec| fractal_matrix_multiply<117,117,117> [1] {0} |Rec| fractal_matrix_multiply<59,59,59> [1] {0} |Rec| fractal_matrix_multiply<30,30,30> [20196] {0} |Rec| fractal_matrix_multiply<15,15,15> [223424] {0} |Rec| fractal_matrix_multiply<8,8,8> [441333] {0} |Rec| fractal_matrix_multiply<4,4,4> [13889186] {0} |Rec| mm<4,4,4> [13889186] {0} |LeaF| ....
We begin with time statistics (Wall Time expressed in seconds):
each function call has an entry that we can describe using a single line
name< size > [ number of times this function is called ] { value } |Rec| or |LeaF|
The problem fractal_matrix_multiply has problem type size <15,15,15>; it is called 223424 times; if there was dynamic programming on, { this value } presents the value - see binomial.c of factors.2.c; the last attribute is |Rec|, which stands for Recursive.
The problem mm has problem type size <4,4,4>; it is called 13889186 times; if there was dynamic programming on, { this value } presents the value - see binomial.c of factors.2.c; the last attribute is |LeaF|, non recursive.
Indentation: we use indentation to present the relation among calls.
fractal_matrix_multiply<4,4,4> [13889186] {0} |Rec| mm<4,4,4> [13889186] {0} |LeaF|mm() is a child of fractal_matrix_multiply()
Let's get started
The type-DAG can be used to help solving this problem. Indeed, a recursive algorithms does not stop, when, at any time, the execution visit a function call multiple times with same inputs. If the inputs specify the flow of the execution, this will create a loop in the type-DAG.
JuliusC is insensitive to the no-ended recursion: it stops when it reaches a computation leaf or when it finds a node with same characteristics. In the latter case, the type-DAG is not a DAG because it has a cycle. We find a cycle by determining a topological order of the type-DAG and specifying a back-edge.
cyclic_recursion.c is the input and run JuliusC
We present two examples: one is the classical binomial computation, the other computes a balanced factorization of on an integer n.
binomial.c is the input and Run JuliusC
We present two factorizations algorithms, very similar in nature. Both determine a balanced factorization: one is exact the other is a heuristic.
factors.2.c is the input and Run JuliusC
Vitter et al. proposed this algorithm and it takes O(nloglogn) steps for n=2^m. This algorithm is extremely interesting because it allows to minimize the number of function calls for any n (therefore the overhead). We present the type-DAG for two algorithms: one using an exact balanced factorization and another using a heuristic.
balanced_cooley_tookey.c is the input and Run JuliusC
balanced_heuristic_cooley_tookey.c is the input and Run JuliusC
Matrix Multiply has several algorithms (e.g.; Strassen's). We present a recursive algorithm with a simplified implementation using non standard layout (fractal layout or Z-morton). The result presented here is not correct, but the algorithm has the same sequence of function calls as well as complexity of the correct algorithm.
fractal_matrix_multiply.c is the input and Run JuliusC
We present an algorithm for APSP that is a version of Fractal matrix multiplication (the two algorithms are more than computationally equivalent). This algorithm use non standard layout and it is simplified. The output is incorrect but the algorithm has the same sequence of function calls as well as complexity of the correct algorithm.
transitive.c is the input and Run JuliusC
We compute the LU-factorization for a small matrix 50x50. Without pivoting, this algorithm is extremely unstable, therefore it may take a long time to run in this architecture because of it.
lu.c is the input Run JuliusC