Actual source code: slepccupmblas.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: #include <petscdevice.h>
17: #include <petsc/private/petsclegacycupmblas.h>
19: /* MANSEC = Sys */
21: #if defined(PETSC_HAVE_CUDA)
23: /* complex single */
24: #if defined(PETSC_USE_COMPLEX)
25: #if defined(PETSC_USE_REAL_SINGLE)
26: #define cublasXgetrfBatched(a,b,c,d,e,f,g) cublasCgetrfBatched((a),(b),(cuComplex**)(c),(d),(e),(f),(g))
27: #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))
28: #else /* complex double */
29: #define cublasXgetrfBatched(a,b,c,d,e,f,g) cublasZgetrfBatched((a),(b),(cuDoubleComplex**)(c),(d),(e),(f),(g))
30: #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))
31: #endif
32: #else /* real single */
33: #if defined(PETSC_USE_REAL_SINGLE)
34: #define cublasXgetrfBatched cublasSgetrfBatched
35: #define cublasXgetrsBatched cublasSgetrsBatched
36: #else /* real double */
37: #define cublasXgetrfBatched cublasDgetrfBatched
38: #define cublasXgetrsBatched cublasDgetrsBatched
39: #endif
40: #endif
42: /* the following ones are used for PetscComplex in both real and complex scalars */
43: #if defined(PETSC_USE_REAL_SINGLE)
44: #define cublasXCaxpy(a,b,c,d,e,f,g) cublasCaxpy((a),(b),(const cuComplex *)(c),(const cuComplex *)(d),(e),(cuComplex *)(f),(g))
45: #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))
46: #define cublasXCscal(a,b,c,d,e) cublasCscal((a),(b),(const cuComplex *)(c),(cuComplex *)(d),(e))
47: #else
48: #define cublasXCaxpy(a,b,c,d,e,f,g) cublasZaxpy((a),(b),(const cuDoubleComplex *)(c),(const cuDoubleComplex *)(d),(e),(cuDoubleComplex *)(f),(g))
49: #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))
50: #define cublasXCscal(a,b,c,d,e) cublasZscal((a),(b),(const cuDoubleComplex *)(c),(cuDoubleComplex *)(d),(e))
51: #endif
53: #endif // PETSC_HAVE_CUDA
55: #if defined(PETSC_HAVE_HIP)
57: /* complex single */
58: #if defined(PETSC_USE_COMPLEX)
59: #if defined(PETSC_USE_REAL_SINGLE)
60: #else /* complex double */
61: #endif
62: #else /* real single */
63: #if defined(PETSC_USE_REAL_SINGLE)
64: #else /* real double */
65: #endif
66: #endif
68: #endif // PETSC_HAVE_HIP