====== Cusp ====== **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===== * v0.2.0 ===== Utilisation ===== Pour utiliser CUSP il suffit de se connecter sur les machines tesla et de charger l'environnement CUDA $ qlogin -q tesla.q $ module load gpu/cuda ==== Exemples ==== ** Calcul le transposé d'une matrice ** #include #include #include int main(void) { // initialize a 2x3 matrix cusp::array2d A(2,3); 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::print(A); // compute the transpose cusp::array2d At; cusp::transpose(A, At); // print A^T cusp::print(At); return 0; } ** Chargement d'une matrice depuis un fichier (MatrixMarket), résolution du système A.X=b sur GPU en utilisant la méthode GC.** #include #include #include int main(void) { // create an empty sparse matrix structure (HYB format) cusp::hyb_matrix A; // load a matrix stored in MatrixMarket format cusp::io::read_matrix_market_file(A, "5pt_10x10.mtx"); // allocate storage for solution (x) and right hand side (b) cusp::array1d x(A.num_rows, 0); cusp::array1d b(A.num_rows, 1); // solve the linear system A * x = b with the Conjugate Gradient method cusp::krylov::cg(A, x, b); return 0; } ==== Compilation ==== Il suffit d'utiliser le compilateur Nvidia ''nvcc'' $ nvcc transpose.cu -o transpose ===== Liens ===== http://code.google.com/p/cusp-library/