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

Actual source code: slepccublas.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 CUBLAS functionality
     12: */

     14: #if !defined(SLEPCCUBLAS_H)
     15: #define SLEPCCUBLAS_H
     16: #include <petscdevice.h>

     18: /* complex single */
     19: #if defined(PETSC_USE_COMPLEX)
     20: #if defined(PETSC_USE_REAL_SINGLE)
     21: #define cublasXgemm(a,b,c,d,e,f,g,h,i,j,k,l,m,n) cublasCgemm((a),(b),(c),(d),(e),(f),(const cuComplex*)(g),(const cuComplex*)(h),(i),(const cuComplex*)(j),(k),(const cuComplex*)(l),(cuComplex*)(m),(n))
     22: #define cublasXgemv(a,b,c,d,e,f,g,h,i,j,k,l) cublasCgemv((a),(b),(c),(d),(cuComplex*)(e),(cuComplex*)(f),(g),(cuComplex*)(h),(i),(cuComplex*)(j),(cuComplex*)(k),(l))
     23: #define cublasXscal(a,b,c,d,e) cublasCscal((a),(b),(const cuComplex*)(c),(cuComplex*)(d),(e))
     24: #define cublasXnrm2(a,b,c,d,e) cublasScnrm2((a),(b),(const cuComplex*)(c),(d),(e))
     25: #define cublasXaxpy(a,b,c,d,e,f,g) cublasCaxpy((a),(b),(const cuComplex*)(c),(const cuComplex*)(d),(e),(cuComplex*)(f),(g))
     26: #define cublasXdotc(a,b,c,d,e,f,g) cublasCdotc((a),(b),(const cuComplex *)(c),(d),(const cuComplex *)(e),(f),(cuComplex *)(g))
     27: #define cublasXgetrfBatched(a,b,c,d,e,f,g) cublasCgetrfBatched((a),(b),(cuComplex**)(c),(d),(e),(f),(g))
     28: #define cublasXgetrsBatched(a,b,c,d,e,f,g,h,i,j,k) cublasCgetrsBatched((a),(b),(c),(d),(const cuComplex**)(e),(f),(g),(cuComplex**)(h),(i),(j),(k))
     29: #else /* complex double */
     30: #define cublasXgemm(a,b,c,d,e,f,g,h,i,j,k,l,m,n) cublasZgemm((a),(b),(c),(d),(e),(f),(const cuDoubleComplex*)(g),(const cuDoubleComplex*)(h),(i),(const cuDoubleComplex*)(j),(k),(const cuDoubleComplex*)(l),(cuDoubleComplex *)(m),(n))
     31: #define cublasXgemv(a,b,c,d,e,f,g,h,i,j,k,l) cublasZgemv((a),(b),(c),(d),(cuDoubleComplex*)(e),(cuDoubleComplex*)(f),(g),(cuDoubleComplex*)(h),(i),(cuDoubleComplex*)(j),(cuDoubleComplex*)(k),(l))
     32: #define cublasXscal(a,b,c,d,e) cublasZscal((a),(b),(const cuDoubleComplex*)(c),(cuDoubleComplex*)(d),(e))
     33: #define cublasXnrm2(a,b,c,d,e) cublasDznrm2((a),(b),(const cuDoubleComplex*)(c),(d),(e))
     34: #define cublasXaxpy(a,b,c,d,e,f,g) cublasZaxpy((a),(b),(const cuDoubleComplex*)(c),(const cuDoubleComplex*)(d),(e),(cuDoubleComplex*)(f),(g))
     35: #define cublasXdotc(a,b,c,d,e,f,g) cublasZdotc((a),(b),(const cuDoubleComplex *)(c),(d),(const cuDoubleComplex *)(e),(f),(cuDoubleComplex *)(g))
     36: #define cublasXgetrfBatched(a,b,c,d,e,f,g) cublasZgetrfBatched((a),(b),(cuDoubleComplex**)(c),(d),(e),(f),(g))
     37: #define cublasXgetrsBatched(a,b,c,d,e,f,g,h,i,j,k) cublasZgetrsBatched((a),(b),(c),(d),(const cuDoubleComplex**)(e),(f),(g),(cuDoubleComplex**)(h),(i),(j),(k))
     38: #endif
     39: #else /* real single */
     40: #if defined(PETSC_USE_REAL_SINGLE)
     41: #define cublasXgemm cublasSgemm
     42: #define cublasXgemv cublasSgemv
     43: #define cublasXscal cublasSscal
     44: #define cublasXnrm2 cublasSnrm2
     45: #define cublasXaxpy cublasSaxpy
     46: #define cublasXdotc cublasSdot
     47: #define cublasXgetrfBatched cublasSgetrfBatched
     48: #define cublasXgetrsBatched cublasSgetrsBatched
     49: #else /* real double */
     50: #define cublasXgemm cublasDgemm
     51: #define cublasXgemv cublasDgemv
     52: #define cublasXscal cublasDscal
     53: #define cublasXnrm2 cublasDnrm2
     54: #define cublasXaxpy cublasDaxpy
     55: #define cublasXdotc cublasDdot
     56: #define cublasXgetrfBatched cublasDgetrfBatched
     57: #define cublasXgetrsBatched cublasDgetrsBatched
     58: #endif
     59: #endif

     61: #if defined(PETSC_USE_REAL_SINGLE)
     62: #define cublasXCaxpy(a,b,c,d,e,f,g)                cublasCaxpy((a),(b),(const cuComplex *)(c),(const cuComplex *)(d),(e),(cuComplex *)(f),(g))
     63: #define cublasXCgemm(a,b,c,d,e,f,g,h,i,j,k,l,m,n)  cublasCgemm((a),(b),(c),(d),(e),(f),(const cuComplex *)(g),(const cuComplex *)(h),(i),(const cuComplex *)(j),(k),(const cuComplex *)(l),(cuComplex *)(m),(n))
     64: #define cublasXCscal(a,b,c,d,e)                    cublasCscal((a),(b),(const cuComplex *)(c),(cuComplex *)(d),(e))
     65: #else
     66: #define cublasXCaxpy(a,b,c,d,e,f,g)                cublasZaxpy((a),(b),(const cuDoubleComplex *)(c),(const cuDoubleComplex *)(d),(e),(cuDoubleComplex *)(f),(g))
     67: #define cublasXCgemm(a,b,c,d,e,f,g,h,i,j,k,l,m,n)  cublasZgemm((a),(b),(c),(d),(e),(f),(const cuDoubleComplex *)(g),(const cuDoubleComplex *)(h),(i),(const cuDoubleComplex *)(j),(k),(const cuDoubleComplex *)(l),(cuDoubleComplex *)(m),(n))
     68: #define cublasXCscal(a,b,c,d,e)                    cublasZscal((a),(b),(const cuDoubleComplex *)(c),(cuDoubleComplex *)(d),(e))
     69: #endif /* COMPLEX */

     71: #endif