# Presentation: 076635

## The Lapack For Clusters (LFC) Project

- Piotr Luszczek
- University of Tennessee

## LFC Overview

**Interactive clients**
**Mathematica**
**Matlab**
**Python**

## LFC: Behind the Scenes

- Internet
- Intranet
- Shared memory
- ...

**x = lfc.gesv(A, b)**

**x = b.copy()**
**command('pdgesv', A.id, x.id)**

**send(c_sckt, buf)**

**recv(s_sckt, buf)**

**call pdgesv(A, x)**

**Batch mode bypass**

## LFC: Current Functionality

**Linear systems (via factorizations)**
**Cholesky: A = U****T****U****	****A = LL****T**
**Gaussian: PA = LU**
**Least Squares: A = QR**
**Singular- and eigen-value problems**
**A = U****Σ****V****T****	****   ****(thin SVD)**
**AV=VΛ=A****H****V (symmetric AEP)**
**AV = VΛ****	****(non-symmetric AEP)**
**Norms, condition number estimates**
**Precision, data-types**
**Single, double**
**Real, complex**
**Mixed precision (by upcasting)**

**User data routines**
**Loading/Saving**
**MPI I/O**
**...**
**Generating**
**Plugins**
**Moving**
**More to come...**
**Now working on sparse matrices support**

## LFC: Design and Implementation

**Client logic (Python)**

**Server logic (Python)**

**Jython**

**PLW**

**PLW**

**Prototyping**

**Deployment**

**Java**

** ****C**
** ****MathLink**
** ****MEX**

**beowulf $ python setup.py install**
**beowulf $ mpirun python server.py**

**Pyrex**

**beowulf $ ./configure**
**beowulf $ make**
**beowulf $ make install**
**beowulf $ mpiexec server**

- Network

## LFC: Implemented MATLAB Functionality

| Name | Single | Double | S-Complex | D-Complex | Description |
| --- | --- | --- | --- | --- | --- |
| chol |  |  |  |  | Cholesky factorization: LLT, UTU |
| lu |  |  |  |  | LU factorization: PA=LU |
| qr |  |  | -1 | -1 | QR factorization: A = QR |
| qrp | -1 | -1 | -1 | -1 | QR factorization+pivoting: PA=QR |
| Svd |  |  |  |  | Singular Value Decomposition: A=UVT |
| Eig | -1 | -1 | -1 | -1 | Eigenvalue problem: AX=X |
| Syev |  |  | n/a | n/a | Symmetric eigenvalue problem |
| Heev | n/a | n/a |  |  | Hermitian eigenvalue problem |
| Diag |  |  |  |  | Diagonal matrix/vector |
| Trans |  |  |  |  | Matrix/vector transpose |
| Herm | n/a | n/a |  |  | Matrix/vector hermitian transpose |
| Norm |  |  |  |  | Matrix/vector norm |
| Cond |  |  |  |  | Condition number estimate |
| Inv | 0 | 0 | 0 | 0 | Explicit matrix inverse |

## Sample LFC Code: Linear System Solve

**Matlab with LFC (parallel):**_**	**_**n = lfc(1000);****	****nrhs = 1;****	****A = rand(n);****	****b = rand(n, 1);****	****x = A \ b;****	****r = A*x – b;****	****norm(r, ‘fro’)**
**Matlab – no LFC (sequential):****	****n = 1000;****	****nrhs = 1;****	****A = rand(n);****	****b = rand(n, 1);****	****x = A \ b;****	****r = A*x – b;****	****norm(r, ‘fro’)**

**Python with LFC (parallel):****	****n = 1000****	****nrhs = 1****	****A = lfc.rand(n)****	****b = lfc.rand(n, 1)****	****x = lfc.solve(A, b)****	****r = A*x – b****	****print r.norm(‘F’)**

## LFC’ C Interface: sequential calls, parallel execution

**In-memory routines**
**LFC_********gels()**
**LFC_********gesv()**
**LFC_********posv()**
**Limitations**
**Data must fit on caller**
**Cluster state funcitons**
**LFC_hosts_create()**
**LFC_hosts_free()**
**LFC_get_available_CPU()**
**LFC_get_free_memory()**

**Disk-based routines**
**LFC_********gels_file_all()**
**LFC_********gesv_file_all()**
**LFC_********posv****_file_all()**
**Limitations**
**Must pay I/O cost each time**

## LFC’ Ease of Deployment

**Only one file to download**
**Just type: ./configure && make && make install**

**ScaLAPACK**

**LAPACK**

**BLAS (vendor)**

**PBLAS**

**BLACS**

**MPI**

** ****LFC clients: C, Mathematica, Matlab, Python**

**BLAS (LFC) **

**serial interface**

**parallel interface**

**global addressing**

**portable**

**local addressing**

**platform specific**

**External**
** ****to LFC**

**External**
** ****to LFC**

## Software Technology Used by LFC

**Client**
**Python**
**Sockets**
**Matlab**
**Embedded Java**
**Jython**
**Reuse of Python code**
**C/C++**
**Code:**
**fork()**
**execvp()**
**Shell (implicit)**
**mpirun**
**mpiexec**

**Server**
**Libraries**
**MPI**
**BLAS**
**BLACS**
**LAPACK**
**ScaLAPACK**
**Languages**
**Python**
**Pyrex (C wrappers)**
**PLW**
**Python compiler**
**Translation to C**

## Contact

- Piotr Luszczek
**http://icl.cs.utk.edu/lfc/**