Download presentation
Presentation is loading. Please wait.
Published byHoward Oliver Modified over 5 years ago
1
Coding FLAME Algorithms with FLAME@lab Example: Cholesky factorization
Robert van de Geijn Department of Computer Sciences, UT-Austin
2
What is is the Mscript Application Programming Interface (API) for coding FLAME algorithms. Mscript is the programming language for Matlab and Octave (which is a public domain version of Matlab).
3
This tutorial assumes that you have already completed the FLaTeX tutorial or that you are at least familiar with the Spark tool
4
Download paper Step one: download from Paolo Bientinesi and Robert van de Geijn. " Representing Dense Linear Algebra Algorithms: A Farewell to Indices." FLAME Working Note #17 The University of Texas at Austin, Department of Computer Sciences. Technical Report TR-2006-??. Postscript PDF (Actually, you just need Figure 6, which also appears on the next slide)
6
This tutorial will show you how to code the algorithms in Figure 6 with FLAME@lab
7
Download FLAME@lab Download the FLAME@lab files by visiting
8
Translate the Cholesky factorization algorithms to code
9
Start the Spark tool for generating code skeletons at
10
Fill in the form
11
Select FLAME@lab and click
“Generate Code”
12
Click on the right window and Select All
13
Copy
14
Paste into your favorite text editor
15
Translate the update for unblocked variant 1 in Figure 6 into Mscript operations
Save the result in a file called “Chol_unb_var1.m” From Figure 6
16
Write a simple test routine
% B = rand 5x5 matrix B = rand( 5, 5 ); % A is Symmetric Positive Definite A = B * B’ % Use matlab to compute Cholesky factor L. % Note that chol( A ) computes U s.t. A = U’ * U % so that L = chol( A )’ L = chol( A )’ % Compute Cholesky factor with your implementation. % Note that only lower triangular part is updated! myL = Chol_unb_var1( A ) Diff = L – tril( myL ) % Check the difference Save the result in a file called “test_chol.m”
17
Test your Cholesky factorization (Variant 1)
Assumption: The “.m” files are in the same directory as all the files listed below OR you have set the path to where you put them. You have the following files in the directory Chol_unb_var1.m test_chol.m Start octave (or Matlab): octave --traditional test_chol
19
The difference is very small, but nonzero due to roundoff errors
20
Exercises Before going on, try the following exercises (the answers are in the subsequent slides) Use the Spark tool to generate a code skeleton for blocked algorithm variant 1 (See Figure 6). Store the result in file “Chol_blk_var1.m” Note: to test it, change the obvious call to myL = Chol_blk_var1( A, 2 ) so that a block size of 2 is used. Repeat for unblocked and blocked variants 2
Similar presentations
© 2024 SlidePlayer.com Inc.
All rights reserved.