MAGMA

MAGMA Matrix Algebra on GPU and Multicore Architectures

The MAGMA project aims to develop a dense linear algebra library similar to LAPACK but for heterogeneous/hybrid architectures, starting with current "Multicore+GPU" systems.

Included are routines for the following algorithms:

  • LU, QR, and Cholesky factorizations in both real and complex arithmetic (single and double);
  • Hessenberg, bidiagonal, and tridiagonal reductions in both real and complex arithmetic (single and double);
  • Linear solvers based on LU, QR, and Cholesky in both real and complex arithmetic (single and double);
  • Eigen and singular value problem solvers in both real and complex arithmetic (single and double);
  • Generalized Hermitian-definite eigenproblem solvers;
  • Mixed-precision iterative refinement solvers based on LU, QR, and Cholesky in both real and complex arithmetic;
  • MAGMA BLAS in real arithmetic (single and double), including gemm, gemv, symv, and trsm.

MAGMA is like BLAS/LAPACK for GPU or CPU + GPU

Version installée

  • magma/cuda/1.5.1 (use module avail magma)

Cette bibliothèque dépend de MKL (blas/lapack) et de CUDA bien sûr

Utilisation

Exemple : Matrix Multiplication using MAGMA (subroutine : DGEMM )

...
...
 
magma_dsetmatrix( Am, An, h_A, lda, d_A, ldda );
magma_dsetmatrix( Bm, Bn, h_B, ldb, d_B, lddb );
magma_dsetmatrix( M, N, h_C, ldc, d_C, lddc );
 
start = get_current_time();
 
magmablas_dgemm( transA, transB, M, N, K, 
                 alpha, d_A, ldda,
                 d_B, lddb,
                 beta,  d_C, lddc );
 
end = get_current_time();
 
magma_perf = flops / GetTimerValue(start, end);
 
magma_dgetmatrix( M, N, d_C, lddc, h_C2, ldc );
...
...

Pour compiler un programme utilisant MAGMA vous devez vous connecter aux machines tesla

Exemple :

qlogin -q tesla.q -l k20

Charger le module magma :

module load magma

Adapter le Makefile suivant selon vos besoins :

include ${MAGMA_HOME}/make.inc
 
# change $(CC) to $(FORT) to use fortran compiler
#------------------------------------------------
 
### You only need to set your program source file
 
dgmem:
 
     $(CC) dgemm.cpp -o dgmem $(OPTS) $(INC) $(LIBDIR) $(LDLIBS)