Ceci est une ancienne révision du document !
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.2.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 );
...
...
Plusieurs exemples se trouvent dans $MAGMA_HOME/testing
Compilation
Pour compiler un programme utilisant MAGMA vous devez vous connecter aux machines
tesla
qlogin -q tesla
Charger le module magma :
module load magma/1.2.1
Adapter le Makefile suivant selon vos besoins :
- Makefile
CC := icpc -DADD_ CFLAGS += -O3 -DMKL_ILP64 -m64 -I$(CUDA_INC) -I$(MKL_INC) -I$(MAGMA_ROOT)/include LDFLAGS := -L$(CUDA_LIB) -L$(MKL_LIB) LIBS := -L$(MAGMA_ROOT)/lib -lmagma -lmagmablas -lmagma LDLIBS := -lmkl_intel_lp64 -lmkl_intel_thread -lmkl_lapack95_ilp64 -lmkl_core -liomp5 -lpthread -lcublas -lcudart -lm