Différences
Ci-dessous, les différences entre deux révisions de la page.
| Prochaine révision | Révision précédente | ||
| cusp [2011/08/30 09:06] – créée admin | cusp [2017/12/14 12:44] (Version actuelle) – admin | ||
|---|---|---|---|
| Ligne 1: | Ligne 1: | ||
| - | ====== | + | ====== |
| - | Cusp is a library for sparse linear algebra and graph computations on CUDA. Cusp provides a flexible, high-level interface for manipulating sparse matrices and solving sparse linear systems. Get Started with Cusp today! | + | **Cusp** is a library for sparse linear algebra and graph computations on CUDA. Cusp provides a flexible, high-level interface for manipulating sparse matrices and solving sparse linear systems. Get Started with Cusp today! |
| - | ====== Version installée====== | + | ===== Version installée===== |
| * v0.2.0 | * v0.2.0 | ||
| - | ====== Utilisation | + | ===== Utilisation ===== |
| + | <note important> | ||
| + | Pour utiliser CUSP il suffit de se connecter sur les machines tesla et de charger l' | ||
| + | <code bash> | ||
| + | $ qlogin -q tesla.q | ||
| + | $ module load gpu/cuda | ||
| + | </ | ||
| + | |||
| + | ==== Exemples ==== | ||
| + | |||
| + | ** Calcul le transposé d'une matrice ** | ||
| + | |||
| + | <file cpp transpose.cu> | ||
| + | |||
| + | #include < | ||
| + | #include < | ||
| + | #include < | ||
| + | |||
| + | int main(void) | ||
| + | { | ||
| + | // initialize a 2x3 matrix | ||
| + | cusp:: | ||
| + | A(0,0) = 10; A(0,1) = 20; A(0,2) = 30; | ||
| + | A(1,0) = 40; A(1,1) = 50; A(1,2) = 60; | ||
| + | |||
| + | // print A | ||
| + | cusp:: | ||
| + | |||
| + | // compute the transpose | ||
| + | cusp:: | ||
| + | cusp:: | ||
| + | |||
| + | // print A^T | ||
| + | cusp:: | ||
| + | |||
| + | return 0; | ||
| + | } | ||
| + | |||
| + | </ | ||
| + | |||
| + | |||
| + | ** Chargement d'une matrice depuis un fichier (MatrixMarket), | ||
| + | <file cpp cg.cu> | ||
| + | #include < | ||
| + | #include < | ||
| + | #include < | ||
| + | |||
| + | int main(void) | ||
| + | { | ||
| + | // create an empty sparse matrix structure (HYB format) | ||
| + | cusp:: | ||
| + | |||
| + | // load a matrix stored in MatrixMarket format | ||
| + | cusp:: | ||
| + | |||
| + | // allocate storage for solution (x) and right hand side (b) | ||
| + | cusp:: | ||
| + | cusp:: | ||
| + | |||
| + | // solve the linear system A * x = b with the Conjugate Gradient method | ||
| + | cusp:: | ||
| + | |||
| + | return 0; | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ==== Compilation ==== | ||
| + | |||
| + | |||
| + | < | ||
| + | <code bash> | ||
| + | $ nvcc transpose.cu -o transpose | ||
| + | </ | ||
| + | |||
| + | ===== Liens ===== | ||
| + | |||
| + | http:// | ||