![Page 1: Meeting 12 - MAGMA - sparse matrixwlazlowski.fizyka.pw.edu.pl/pdfs/dydaktyka/NTO/meeting... · 2020. 5. 27. · Name: Gabriel Surname: Wlazlowski E-mail: gabriel.wlazlowski@pw.edu.pl](https://reader035.vdocuments.site/reader035/viewer/2022070217/611ff1c40f468552b57ea420/html5/thumbnails/1.jpg)
Meeting 12
- MAGMA- sparse matrix
GabrielWlazłowski
![Page 3: Meeting 12 - MAGMA - sparse matrixwlazlowski.fizyka.pw.edu.pl/pdfs/dydaktyka/NTO/meeting... · 2020. 5. 27. · Name: Gabriel Surname: Wlazlowski E-mail: gabriel.wlazlowski@pw.edu.pl](https://reader035.vdocuments.site/reader035/viewer/2022070217/611ff1c40f468552b57ea420/html5/thumbnails/3.jpg)
Extensive library of examples:
https://developer.nvidia.com/sites/default/files/akamai/cuda/files/Misc/mygpu.pdf
See:inversion-magma.cSee:inversion-magma.c
![Page 4: Meeting 12 - MAGMA - sparse matrixwlazlowski.fizyka.pw.edu.pl/pdfs/dydaktyka/NTO/meeting... · 2020. 5. 27. · Name: Gabriel Surname: Wlazlowski E-mail: gabriel.wlazlowski@pw.edu.pl](https://reader035.vdocuments.site/reader035/viewer/2022070217/611ff1c40f468552b57ea420/html5/thumbnails/4.jpg)
I took such code…
see:google_inversion.c
![Page 5: Meeting 12 - MAGMA - sparse matrixwlazlowski.fizyka.pw.edu.pl/pdfs/dydaktyka/NTO/meeting... · 2020. 5. 27. · Name: Gabriel Surname: Wlazlowski E-mail: gabriel.wlazlowski@pw.edu.pl](https://reader035.vdocuments.site/reader035/viewer/2022070217/611ff1c40f468552b57ea420/html5/thumbnails/5.jpg)
Consider heat equation (1D):
Using finite difference:
discretization
Updating scheme
Matrix is sparse!
→ Sparse matrices are very common to problems that utilize finite difference methods
![Page 6: Meeting 12 - MAGMA - sparse matrixwlazlowski.fizyka.pw.edu.pl/pdfs/dydaktyka/NTO/meeting... · 2020. 5. 27. · Name: Gabriel Surname: Wlazlowski E-mail: gabriel.wlazlowski@pw.edu.pl](https://reader035.vdocuments.site/reader035/viewer/2022070217/611ff1c40f468552b57ea420/html5/thumbnails/6.jpg)
Consider Poisson’s equation:
Algebraic problem: sparse linear system
3D case
![Page 7: Meeting 12 - MAGMA - sparse matrixwlazlowski.fizyka.pw.edu.pl/pdfs/dydaktyka/NTO/meeting... · 2020. 5. 27. · Name: Gabriel Surname: Wlazlowski E-mail: gabriel.wlazlowski@pw.edu.pl](https://reader035.vdocuments.site/reader035/viewer/2022070217/611ff1c40f468552b57ea420/html5/thumbnails/7.jpg)
![Page 8: Meeting 12 - MAGMA - sparse matrixwlazlowski.fizyka.pw.edu.pl/pdfs/dydaktyka/NTO/meeting... · 2020. 5. 27. · Name: Gabriel Surname: Wlazlowski E-mail: gabriel.wlazlowski@pw.edu.pl](https://reader035.vdocuments.site/reader035/viewer/2022070217/611ff1c40f468552b57ea420/html5/thumbnails/8.jpg)
Sparse matrix - representation
The COO format is a particularly simple storage scheme.
It is defined by the three arrays.
![Page 9: Meeting 12 - MAGMA - sparse matrixwlazlowski.fizyka.pw.edu.pl/pdfs/dydaktyka/NTO/meeting... · 2020. 5. 27. · Name: Gabriel Surname: Wlazlowski E-mail: gabriel.wlazlowski@pw.edu.pl](https://reader035.vdocuments.site/reader035/viewer/2022070217/611ff1c40f468552b57ea420/html5/thumbnails/9.jpg)
Sparse matrix - representation
The CSR format is the most popular sparse matrix representation.
It stores column indices and nonzero values in two arrays and uses a third array of row pointers, to mark the boundaries of each row
Analogous CSC (Compressed Sparse Column)
![Page 10: Meeting 12 - MAGMA - sparse matrixwlazlowski.fizyka.pw.edu.pl/pdfs/dydaktyka/NTO/meeting... · 2020. 5. 27. · Name: Gabriel Surname: Wlazlowski E-mail: gabriel.wlazlowski@pw.edu.pl](https://reader035.vdocuments.site/reader035/viewer/2022070217/611ff1c40f468552b57ea420/html5/thumbnails/10.jpg)
See:example_sparse.cfrom MAGMA library
See:example_sparse.cfrom MAGMA library
![Page 11: Meeting 12 - MAGMA - sparse matrixwlazlowski.fizyka.pw.edu.pl/pdfs/dydaktyka/NTO/meeting... · 2020. 5. 27. · Name: Gabriel Surname: Wlazlowski E-mail: gabriel.wlazlowski@pw.edu.pl](https://reader035.vdocuments.site/reader035/viewer/2022070217/611ff1c40f468552b57ea420/html5/thumbnails/11.jpg)
Preparation for lab 13:
1) Register to PL-Grid:
https://portal.plgrid.pl/registration/form
For more info see: https://docs.cyfronet.pl/display/PLGDoc/User+Manual#UserManual-Basicinformation
To confirm affilition, you can use my data as “Supervisor’s affiliation”:
Name: GabrielSurname: WlazlowskiE-mail: [email protected]: 225935
2) Create trial grant
3) Activate service: access to Zeus supercomputer, or access to Eagle supercomputr, or other
4) Try to login to the granted supercomputer
![Page 12: Meeting 12 - MAGMA - sparse matrixwlazlowski.fizyka.pw.edu.pl/pdfs/dydaktyka/NTO/meeting... · 2020. 5. 27. · Name: Gabriel Surname: Wlazlowski E-mail: gabriel.wlazlowski@pw.edu.pl](https://reader035.vdocuments.site/reader035/viewer/2022070217/611ff1c40f468552b57ea420/html5/thumbnails/12.jpg)
Task for lab 13:
1) Execute strong scaling of MPI code (preferably your code constructed for matrix diagonalization, if you do not have this code working yet, use demonstration code for matrix inversion inversion-scalapack.c)
2) Execute strong scaling using one of computers provided by PL-Grid (via trial grant)
3) Suppose that your problem requires 100 diagonalizations (inversions) of matrix of size 25,000 x 25,000.
For such problem propose parameters of runs (how many nodes/cores), estimate time-to-solution, and estimate needed budget (CPU-hours),
4) Deadline: will be provided during lab. Weight: 2 In the report provide:
→ compilation script / command and sample of your submission script, → strong scaling plot, → Proposition of execution parameters with time-to-solution and cost estimation
with short justification, why you selected these parameters.
Time-to-solution: time needed by a computer to solve you problem (hr, min, sec, …) strongly depends on running parameters like number of processes
Computing cost = Time-to-solution x number of processes (CPU-hr, Node-hr, GPU-hr…) Example: if your code was running for 1 hour using 100 CPUs then computing cost was 100 CPU-hr.