Actual source code: cupmblas.h
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 and hipBLAS functionality
12: */
14: #pragma once
16: /* MANSEC = Sys */
18: #if PetscDefined(HAVE_CUDA)
20: /* complex single */
21: #if PetscDefined(USE_COMPLEX)
22: #if PetscDefined(USE_REAL_SINGLE)
23: #define cublasXgetrfBatched(a,b,c,d,e,f,g) cublasCgetrfBatched((a),(b),(cuComplex**)(c),(d),(e),(f),(g))
24: #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))
25: #else /* complex double */
26: #define cublasXgetrfBatched(a,b,c,d,e,f,g) cublasZgetrfBatched((a),(b),(cuDoubleComplex**)(c),(d),(e),(f),(g))
27: #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))
28: #endif
29: #else /* real single */
30: #if PetscDefined(USE_REAL_SINGLE)
31: #define cublasXgetrfBatched cublasSgetrfBatched
32: #define cublasXgetrsBatched cublasSgetrsBatched
33: #else /* real double */
34: #define cublasXgetrfBatched cublasDgetrfBatched
35: #define cublasXgetrsBatched cublasDgetrsBatched
36: #endif
37: #endif
39: /* the following ones are used for PetscComplex in both real and complex scalars */
40: #if PetscDefined(USE_REAL_SINGLE)
41: #define cublasXCaxpy(a,b,c,d,e,f,g) cublasCaxpy((a),(b),(const cuComplex *)(c),(const cuComplex *)(d),(e),(cuComplex *)(f),(g))
42: #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))
43: #define cublasXCscal(a,b,c,d,e) cublasCscal((a),(b),(const cuComplex *)(c),(cuComplex *)(d),(e))
44: #else
45: #define cublasXCaxpy(a,b,c,d,e,f,g) cublasZaxpy((a),(b),(const cuDoubleComplex *)(c),(const cuDoubleComplex *)(d),(e),(cuDoubleComplex *)(f),(g))
46: #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))
47: #define cublasXCscal(a,b,c,d,e) cublasZscal((a),(b),(const cuDoubleComplex *)(c),(cuDoubleComplex *)(d),(e))
48: #endif
50: #endif // PETSC_HAVE_CUDA
52: #if PetscDefined(HAVE_HIP)
54: /* complex single */
55: #if PetscDefined(USE_COMPLEX)
56: #if PetscDefined(USE_REAL_SINGLE)
57: #else /* complex double */
58: #endif
59: #else /* real single */
60: #if PetscDefined(USE_REAL_SINGLE)
61: #else /* real double */
62: #endif
63: #endif
65: #endif // PETSC_HAVE_HIP