Date: 2022-11-02T11:47:50+00:00

Actual source code: slepcmagma.h
slepc-3.18.1 2022-11-02
Report Typos and Errors

      1: /*
      2:    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      3:    SLEPc - Scalable Library for Eigenvalue Problem Computations
      4:    Copyright (c) 2002-, Universitat Politecnica de Valencia, Spain

      6:    This file is part of SLEPc.
      7:    SLEPc is distributed under a 2-clause BSD license (see LICENSE).
      8:    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      9: */
     10: /*
     11:    Macro definitions to use MAGMA functionality
     12: */

     14: #if !defined(SLEPCMAGMA_H)
     15: #define SLEPCMAGMA_H

     17: #if defined(PETSC_HAVE_MAGMA)

     19: #include <magma_v2.h>

     21: SLEPC_EXTERN PetscErrorCode SlepcMagmaInit(void);

     23: #define PetscCallMAGMA(func, ...) do { \
     24:     PetscErrorCode magma_ierr_; \
     25:     PetscStackPushExternal(PetscStringize(func)); \
     26:     func(__VA_ARGS__,&magma_ierr_); \
     27:     PetscStackPop; \
     29:   } while (0)
     30: #define CHKERRMAGMA(...) PetscCall(__VA_ARGS__)

     32: #if defined(PETSC_USE_COMPLEX)
     33: #if defined(PETSC_USE_REAL_SINGLE)
     34: #define magma_xgeev(a,b,c,d,e,f,g,h,i,j,k,l.m.n) magma_cgeev((a),(b),(c),(magmaFloatComplex*)(d),(e),(magmaFloatComplex*)(f),(magmaFloatComplex*)(g),(h),(magmaFloatComplex*)(i),(j),(magmaFloatComplex*)(k),(l),(m),(n))
     35: #define magma_xgesv_gpu(a,b,c,d,e,f,g,h)         magma_cgesv_gpu((a),(b),(magmaFloatComplex_ptr)(c),(d),(e),(magmaFloatComplex_ptr)(f),(g),(h))
     36: #define magma_xgetrf_gpu(a,b,c,d,e,f)   magma_cgetrf_gpu((a),(b),(magmaFloatComplex_ptr)(c),(d),(e),(f))
     37: #define magma_xgetri_gpu(a,b,c,d,e,f,g) magma_cgetri_gpu((a),(magmaFloatComplex_ptr)(b),(c),(d),(magmaFloatComplex_ptr)(e),(f),(g))
     38: #define magma_get_xgetri_nb             magma_get_cgetri_nb
     39: #else
     40: #define magma_xgeev(a,b,c,d,e,f,g,h,i,j,k,l,m,n) magma_zgeev((a),(b),(c),(magmaDoubleComplex*)(d),(e),(magmaDoubleComplex*)(f),(magmaDoubleComplex*)(g),(h),(magmaDoubleComplex*)(i),(j),(magmaDoubleComplex*)(k),(l),(m),(n))
     41: #define magma_xgesv_gpu(a,b,c,d,e,f,g,h)         magma_zgesv_gpu((a),(b),(magmaDoubleComplex_ptr)(c),(d),(e),(magmaDoubleComplex_ptr)(f),(g),(h))
     42: #define magma_xgetrf_gpu(a,b,c,d,e,f)   magma_zgetrf_gpu((a),(b),(magmaDoubleComplex_ptr)(c),(d),(e),(f))
     43: #define magma_xgetri_gpu(a,b,c,d,e,f,g) magma_zgetri_gpu((a),(magmaDoubleComplex_ptr)(b),(c),(d),(magmaDoubleComplex_ptr)(e),(f),(g))
     44: #define magma_get_xgetri_nb             magma_get_zgetri_nb
     45: #endif
     46: #else
     47: #if defined(PETSC_USE_REAL_SINGLE)
     48: #define magma_xgeev                     magma_sgeev
     49: #define magma_xgesv_gpu                 magma_sgesv_gpu
     50: #define magma_xgetrf_gpu                magma_sgetrf_gpu
     51: #define magma_xgetri_gpu                magma_sgetri_gpu
     52: #define magma_get_xgetri_nb             magma_get_sgetri_nb
     53: #else
     54: #define magma_xgeev                     magma_dgeev
     55: #define magma_xgesv_gpu                 magma_dgesv_gpu
     56: #define magma_xgetrf_gpu                magma_dgetrf_gpu
     57: #define magma_xgetri_gpu                magma_dgetri_gpu
     58: #define magma_get_xgetri_nb             magma_get_dgetri_nb
     59: #endif
     60: #endif

     62: #if defined(PETSC_USE_REAL_SINGLE)
     63: #define magma_Cgesv_gpu(a,b,c,d,e,f,g,h)         magma_cgesv_gpu((a),(b),(magmaFloatComplex_ptr)(c),(d),(e),(magmaFloatComplex_ptr)(f),(g),(h))
     64: #else
     65: #define magma_Cgesv_gpu(a,b,c,d,e,f,g,h)         magma_zgesv_gpu((a),(b),(magmaDoubleComplex_ptr)(c),(d),(e),(magmaDoubleComplex_ptr)(f),(g),(h))
     66: #endif

     68: #endif
     69: #endif