Actual source code: petsclegacycupmblas.h

      1: #pragma once

      3: #include <petscdevice_cupm.h>

      5: #if defined(PETSC_HAVE_CUDA)
      6:   /* complex single */
      7:   #if defined(PETSC_USE_COMPLEX)
      8:     #if defined(PETSC_USE_REAL_SINGLE)
      9:       #define cublasXaxpy(a, b, c, d, e, f, g)                      cublasCaxpy((a), (b), (cuComplex *)(c), (cuComplex *)(d), (e), (cuComplex *)(f), (g))
     10:       #define cublasXscal(a, b, c, d, e)                            cublasCscal((a), (b), (cuComplex *)(c), (cuComplex *)(d), (e))
     11:       #define cublasXdotu(a, b, c, d, e, f, g)                      cublasCdotu((a), (b), (cuComplex *)(c), (d), (cuComplex *)(e), (f), (cuComplex *)(g))
     12:       #define cublasXdot(a, b, c, d, e, f, g)                       cublasCdotc((a), (b), (cuComplex *)(c), (d), (cuComplex *)(e), (f), (cuComplex *)(g))
     13:       #define cublasXswap(a, b, c, d, e, f)                         cublasCswap((a), (b), (cuComplex *)(c), (d), (cuComplex *)(e), (f))
     14:       #define cublasXnrm2(a, b, c, d, e)                            cublasScnrm2((a), (b), (cuComplex *)(c), (d), (e))
     15:       #define cublasIXamax(a, b, c, d, e)                           cublasIcamax((a), (b), (cuComplex *)(c), (d), (e))
     16:       #define cublasXasum(a, b, c, d, e)                            cublasScasum((a), (b), (cuComplex *)(c), (d), (e))
     17:       #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))
     18:       #define cublasXgemm(a, b, c, d, e, f, g, h, i, j, k, l, m, n) cublasCgemm((a), (b), (c), (d), (e), (f), (cuComplex *)(g), (cuComplex *)(h), (i), (cuComplex *)(j), (k), (cuComplex *)(l), (cuComplex *)(m), (n))
     19:       #define cublasXgeam(a, b, c, d, e, f, g, h, i, j, k, l, m)    cublasCgeam((a), (b), (c), (d), (e), (cuComplex *)(f), (cuComplex *)(g), (h), (cuComplex *)(i), (cuComplex *)(j), (k), (cuComplex *)(l), (m))
     20:       #define cublasXgemvStridedBatched(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p) \
     21:         cublasCgemvStridedBatched((a), (b), (c), (d), (const cuComplex *)(e), (const cuComplex *)(f), (g), (h), (const cuComplex *)(i), (j), (k), (const cuComplex *)(l), (cuComplex *)(m), (n), (o), (p))
     22:     #else /* complex double */
     23:       #define cublasXaxpy(a, b, c, d, e, f, g)                      cublasZaxpy((a), (b), (cuDoubleComplex *)(c), (cuDoubleComplex *)(d), (e), (cuDoubleComplex *)(f), (g))
     24:       #define cublasXscal(a, b, c, d, e)                            cublasZscal((a), (b), (cuDoubleComplex *)(c), (cuDoubleComplex *)(d), (e))
     25:       #define cublasXdotu(a, b, c, d, e, f, g)                      cublasZdotu((a), (b), (cuDoubleComplex *)(c), (d), (cuDoubleComplex *)(e), (f), (cuDoubleComplex *)(g))
     26:       #define cublasXdot(a, b, c, d, e, f, g)                       cublasZdotc((a), (b), (cuDoubleComplex *)(c), (d), (cuDoubleComplex *)(e), (f), (cuDoubleComplex *)(g))
     27:       #define cublasXswap(a, b, c, d, e, f)                         cublasZswap((a), (b), (cuDoubleComplex *)(c), (d), (cuDoubleComplex *)(e), (f))
     28:       #define cublasXnrm2(a, b, c, d, e)                            cublasDznrm2((a), (b), (cuDoubleComplex *)(c), (d), (e))
     29:       #define cublasIXamax(a, b, c, d, e)                           cublasIzamax((a), (b), (cuDoubleComplex *)(c), (d), (e))
     30:       #define cublasXasum(a, b, c, d, e)                            cublasDzasum((a), (b), (cuDoubleComplex *)(c), (d), (e))
     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 cublasXgemm(a, b, c, d, e, f, g, h, i, j, k, l, m, n) cublasZgemm((a), (b), (c), (d), (e), (f), (cuDoubleComplex *)(g), (cuDoubleComplex *)(h), (i), (cuDoubleComplex *)(j), (k), (cuDoubleComplex *)(l), (cuDoubleComplex *)(m), (n))
     33:       #define cublasXgeam(a, b, c, d, e, f, g, h, i, j, k, l, m)    cublasZgeam((a), (b), (c), (d), (e), (cuDoubleComplex *)(f), (cuDoubleComplex *)(g), (h), (cuDoubleComplex *)(i), (cuDoubleComplex *)(j), (k), (cuDoubleComplex *)(l), (m))
     34:       #define cublasXgemvStridedBatched(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p) \
     35:         cublasZgemvStridedBatched((a), (b), (c), (d), (const cuDoubleComplex *)(e), (const cuDoubleComplex *)(f), (g), (h), (const cuDoubleComplex *)(i), (j), (k), (const cuDoubleComplex *)(l), (cuDoubleComplex *)(m), (n), (o), (p))

     37:     #endif
     38:   #else /* real single */
     39:     #if defined(PETSC_USE_REAL_SINGLE)
     40:       #define cublasXaxpy               cublasSaxpy
     41:       #define cublasXscal               cublasSscal
     42:       #define cublasXdotu               cublasSdot
     43:       #define cublasXdot                cublasSdot
     44:       #define cublasXswap               cublasSswap
     45:       #define cublasXnrm2               cublasSnrm2
     46:       #define cublasIXamax              cublasIsamax
     47:       #define cublasXasum               cublasSasum
     48:       #define cublasXgemv               cublasSgemv
     49:       #define cublasXgemm               cublasSgemm
     50:       #define cublasXgeam               cublasSgeam
     51:       #define cublasXgemvStridedBatched cublasSgemvStridedBatched
     52:     #else /* real double */
     53:       #define cublasXaxpy               cublasDaxpy
     54:       #define cublasXscal               cublasDscal
     55:       #define cublasXdotu               cublasDdot
     56:       #define cublasXdot                cublasDdot
     57:       #define cublasXswap               cublasDswap
     58:       #define cublasXnrm2               cublasDnrm2
     59:       #define cublasIXamax              cublasIdamax
     60:       #define cublasXasum               cublasDasum
     61:       #define cublasXgemv               cublasDgemv
     62:       #define cublasXgemm               cublasDgemm
     63:       #define cublasXgeam               cublasDgeam
     64:       #define cublasXgemvStridedBatched cublasDgemvStridedBatched
     65:     #endif
     66:   #endif

     68:   #if defined(PETSC_USE_COMPLEX)
     69:     #if defined(PETSC_USE_REAL_SINGLE)
     70:       #define cusolverDnXpotrf(a, b, c, d, e, f, g, h)                        cusolverDnCpotrf((a), (b), (c), (cuComplex *)(d), (e), (cuComplex *)(f), (g), (h))
     71:       #define cusolverDnXpotrf_bufferSize(a, b, c, d, e, f)                   cusolverDnCpotrf_bufferSize((a), (b), (c), (cuComplex *)(d), (e), (f))
     72:       #define cusolverDnXpotrs(a, b, c, d, e, f, g, h, i)                     cusolverDnCpotrs((a), (b), (c), (d), (cuComplex *)(e), (f), (cuComplex *)(g), (h), (i))
     73:       #define cusolverDnXpotri(a, b, c, d, e, f, g, h)                        cusolverDnCpotri((a), (b), (c), (cuComplex *)(d), (e), (cuComplex *)(f), (g), (h))
     74:       #define cusolverDnXpotri_bufferSize(a, b, c, d, e, f)                   cusolverDnCpotri_bufferSize((a), (b), (c), (cuComplex *)(d), (e), (f))
     75:       #define cusolverDnXsytrf(a, b, c, d, e, f, g, h, i)                     cusolverDnCsytrf((a), (b), (c), (cuComplex *)(d), (e), (f), (cuComplex *)(g), (h), (i))
     76:       #define cusolverDnXsytrf_bufferSize(a, b, c, d, e)                      cusolverDnCsytrf_bufferSize((a), (b), (cuComplex *)(c), (d), (e))
     77:       #define cusolverDnXgetrf(a, b, c, d, e, f, g, h)                        cusolverDnCgetrf((a), (b), (c), (cuComplex *)(d), (e), (cuComplex *)(f), (g), (h))
     78:       #define cusolverDnXgetrf_bufferSize(a, b, c, d, e, f)                   cusolverDnCgetrf_bufferSize((a), (b), (c), (cuComplex *)(d), (e), (f))
     79:       #define cusolverDnXgetrs(a, b, c, d, e, f, g, h, i, j)                  cusolverDnCgetrs((a), (b), (c), (d), (cuComplex *)(e), (f), (g), (cuComplex *)(h), (i), (j))
     80:       #define cusolverDnXgeqrf_bufferSize(a, b, c, d, e, f)                   cusolverDnCgeqrf_bufferSize((a), (b), (c), (cuComplex *)(d), (e), (f))
     81:       #define cusolverDnXgeqrf(a, b, c, d, e, f, g, h, i)                     cusolverDnCgeqrf((a), (b), (c), (cuComplex *)(d), (e), (cuComplex *)(f), (cuComplex *)(g), (h), (i))
     82:       #define cusolverDnXormqr_bufferSize(a, b, c, d, e, f, g, h, i, j, k, l) cusolverDnCunmqr_bufferSize((a), (b), (c), (d), (e), (f), (cuComplex *)(g), (h), (cuComplex *)(i), (cuComplex *)(j), (k), (l))
     83:       #define cusolverDnXormqr(a, b, c, d, e, f, g, h, i, j, k, l, m, n)      cusolverDnCunmqr((a), (b), (c), (d), (e), (f), (cuComplex *)(g), (h), (cuComplex *)(i), (cuComplex *)(j), (k), (cuComplex *)(l), (m), (n))
     84:       #define cublasXtrsm(a, b, c, d, e, f, g, h, i, j, k, l)                 cublasCtrsm((a), (b), (c), (d), (e), (f), (g), (cuComplex *)(h), (cuComplex *)(i), (j), (cuComplex *)(k), (l))
     85:     #else /* complex double */
     86:       #define cusolverDnXpotrf(a, b, c, d, e, f, g, h)                        cusolverDnZpotrf((a), (b), (c), (cuDoubleComplex *)(d), (e), (cuDoubleComplex *)(f), (g), (h))
     87:       #define cusolverDnXpotrf_bufferSize(a, b, c, d, e, f)                   cusolverDnZpotrf_bufferSize((a), (b), (c), (cuDoubleComplex *)(d), (e), (f))
     88:       #define cusolverDnXpotrs(a, b, c, d, e, f, g, h, i)                     cusolverDnZpotrs((a), (b), (c), (d), (cuDoubleComplex *)(e), (f), (cuDoubleComplex *)(g), (h), (i))
     89:       #define cusolverDnXpotri(a, b, c, d, e, f, g, h)                        cusolverDnZpotri((a), (b), (c), (cuDoubleComplex *)(d), (e), (cuDoubleComplex *)(f), (g), (h))
     90:       #define cusolverDnXpotri_bufferSize(a, b, c, d, e, f)                   cusolverDnZpotri_bufferSize((a), (b), (c), (cuDoubleComplex *)(d), (e), (f))
     91:       #define cusolverDnXsytrf(a, b, c, d, e, f, g, h, i)                     cusolverDnZsytrf((a), (b), (c), (cuDoubleComplex *)(d), (e), (f), (cuDoubleComplex *)(g), (h), (i))
     92:       #define cusolverDnXsytrf_bufferSize(a, b, c, d, e)                      cusolverDnZsytrf_bufferSize((a), (b), (cuDoubleComplex *)(c), (d), (e))
     93:       #define cusolverDnXgetrf(a, b, c, d, e, f, g, h)                        cusolverDnZgetrf((a), (b), (c), (cuDoubleComplex *)(d), (e), (cuDoubleComplex *)(f), (g), (h))
     94:       #define cusolverDnXgetrf_bufferSize(a, b, c, d, e, f)                   cusolverDnZgetrf_bufferSize((a), (b), (c), (cuDoubleComplex *)(d), (e), (f))
     95:       #define cusolverDnXgetrs(a, b, c, d, e, f, g, h, i, j)                  cusolverDnZgetrs((a), (b), (c), (d), (cuDoubleComplex *)(e), (f), (g), (cuDoubleComplex *)(h), (i), (j))
     96:       #define cusolverDnXgeqrf_bufferSize(a, b, c, d, e, f)                   cusolverDnZgeqrf_bufferSize((a), (b), (c), (cuDoubleComplex *)(d), (e), (f))
     97:       #define cusolverDnXgeqrf(a, b, c, d, e, f, g, h, i)                     cusolverDnZgeqrf((a), (b), (c), (cuDoubleComplex *)(d), (e), (cuDoubleComplex *)(f), (cuDoubleComplex *)(g), (h), (i))
     98:       #define cusolverDnXormqr_bufferSize(a, b, c, d, e, f, g, h, i, j, k, l) cusolverDnZunmqr_bufferSize((a), (b), (c), (d), (e), (f), (cuDoubleComplex *)(g), (h), (cuDoubleComplex *)(i), (cuDoubleComplex *)(j), (k), (l))
     99:       #define cusolverDnXormqr(a, b, c, d, e, f, g, h, i, j, k, l, m, n)      cusolverDnZunmqr((a), (b), (c), (d), (e), (f), (cuDoubleComplex *)(g), (h), (cuDoubleComplex *)(i), (cuDoubleComplex *)(j), (k), (cuDoubleComplex *)(l), (m), (n))
    100:       #define cublasXtrsm(a, b, c, d, e, f, g, h, i, j, k, l)                 cublasZtrsm((a), (b), (c), (d), (e), (f), (g), (cuDoubleComplex *)(h), (cuDoubleComplex *)(i), (j), (cuDoubleComplex *)(k), (l))
    101:     #endif
    102:   #else /* real single */
    103:     #if defined(PETSC_USE_REAL_SINGLE)
    104:       #define cusolverDnXpotrf(a, b, c, d, e, f, g, h)                        cusolverDnSpotrf((a), (b), (c), (d), (e), (f), (g), (h))
    105:       #define cusolverDnXpotrf_bufferSize(a, b, c, d, e, f)                   cusolverDnSpotrf_bufferSize((a), (b), (c), (d), (e), (f))
    106:       #define cusolverDnXpotrs(a, b, c, d, e, f, g, h, i)                     cusolverDnSpotrs((a), (b), (c), (d), (e), (f), (g), (h), (i))
    107:       #define cusolverDnXpotri(a, b, c, d, e, f, g, h)                        cusolverDnSpotri((a), (b), (c), (d), (e), (f), (g), (h))
    108:       #define cusolverDnXpotri_bufferSize(a, b, c, d, e, f)                   cusolverDnSpotri_bufferSize((a), (b), (c), (d), (e), (f))
    109:       #define cusolverDnXsytrf(a, b, c, d, e, f, g, h, i)                     cusolverDnSsytrf((a), (b), (c), (d), (e), (f), (g), (h), (i))
    110:       #define cusolverDnXsytrf_bufferSize(a, b, c, d, e)                      cusolverDnSsytrf_bufferSize((a), (b), (c), (d), (e))
    111:       #define cusolverDnXgetrf(a, b, c, d, e, f, g, h)                        cusolverDnSgetrf((a), (b), (c), (d), (e), (f), (g), (h))
    112:       #define cusolverDnXgetrf_bufferSize(a, b, c, d, e, f)                   cusolverDnSgetrf_bufferSize((a), (b), (c), (d), (e), (f))
    113:       #define cusolverDnXgetrs(a, b, c, d, e, f, g, h, i, j)                  cusolverDnSgetrs((a), (b), (c), (d), (e), (f), (g), (h), (i), (j))
    114:       #define cusolverDnXgeqrf_bufferSize(a, b, c, d, e, f)                   cusolverDnSgeqrf_bufferSize((a), (b), (c), (float *)(d), (e), (f))
    115:       #define cusolverDnXgeqrf(a, b, c, d, e, f, g, h, i)                     cusolverDnSgeqrf((a), (b), (c), (float *)(d), (e), (float *)(f), (float *)(g), (h), (i))
    116:       #define cusolverDnXormqr_bufferSize(a, b, c, d, e, f, g, h, i, j, k, l) cusolverDnSormqr_bufferSize((a), (b), (c), (d), (e), (f), (float *)(g), (h), (float *)(i), (float *)(j), (k), (l))
    117:       #define cusolverDnXormqr(a, b, c, d, e, f, g, h, i, j, k, l, m, n)      cusolverDnSormqr((a), (b), (c), (d), (e), (f), (float *)(g), (h), (float *)(i), (float *)(j), (k), (float *)(l), (m), (n))
    118:       #define cublasXtrsm(a, b, c, d, e, f, g, h, i, j, k, l)                 cublasStrsm((a), (b), (c), (d), (e), (f), (g), (float *)(h), (float *)(i), (j), (float *)(k), (l))
    119:     #else /* real double */
    120:       #define cusolverDnXpotrf(a, b, c, d, e, f, g, h)                        cusolverDnDpotrf((a), (b), (c), (d), (e), (f), (g), (h))
    121:       #define cusolverDnXpotrf_bufferSize(a, b, c, d, e, f)                   cusolverDnDpotrf_bufferSize((a), (b), (c), (d), (e), (f))
    122:       #define cusolverDnXpotrs(a, b, c, d, e, f, g, h, i)                     cusolverDnDpotrs((a), (b), (c), (d), (e), (f), (g), (h), (i))
    123:       #define cusolverDnXpotri(a, b, c, d, e, f, g, h)                        cusolverDnDpotri((a), (b), (c), (d), (e), (f), (g), (h))
    124:       #define cusolverDnXpotri_bufferSize(a, b, c, d, e, f)                   cusolverDnDpotri_bufferSize((a), (b), (c), (d), (e), (f))
    125:       #define cusolverDnXsytrf(a, b, c, d, e, f, g, h, i)                     cusolverDnDsytrf((a), (b), (c), (d), (e), (f), (g), (h), (i))
    126:       #define cusolverDnXsytrf_bufferSize(a, b, c, d, e)                      cusolverDnDsytrf_bufferSize((a), (b), (c), (d), (e))
    127:       #define cusolverDnXgetrf(a, b, c, d, e, f, g, h)                        cusolverDnDgetrf((a), (b), (c), (d), (e), (f), (g), (h))
    128:       #define cusolverDnXgetrf_bufferSize(a, b, c, d, e, f)                   cusolverDnDgetrf_bufferSize((a), (b), (c), (d), (e), (f))
    129:       #define cusolverDnXgetrs(a, b, c, d, e, f, g, h, i, j)                  cusolverDnDgetrs((a), (b), (c), (d), (e), (f), (g), (h), (i), (j))
    130:       #define cusolverDnXgeqrf_bufferSize(a, b, c, d, e, f)                   cusolverDnDgeqrf_bufferSize((a), (b), (c), (double *)(d), (e), (f))
    131:       #define cusolverDnXgeqrf(a, b, c, d, e, f, g, h, i)                     cusolverDnDgeqrf((a), (b), (c), (double *)(d), (e), (double *)(f), (double *)(g), (h), (i))
    132:       #define cusolverDnXormqr_bufferSize(a, b, c, d, e, f, g, h, i, j, k, l) cusolverDnDormqr_bufferSize((a), (b), (c), (d), (e), (f), (double *)(g), (h), (double *)(i), (double *)(j), (k), (l))
    133:       #define cusolverDnXormqr(a, b, c, d, e, f, g, h, i, j, k, l, m, n)      cusolverDnDormqr((a), (b), (c), (d), (e), (f), (double *)(g), (h), (double *)(i), (double *)(j), (k), (double *)(l), (m), (n))
    134:       #define cublasXtrsm(a, b, c, d, e, f, g, h, i, j, k, l)                 cublasDtrsm((a), (b), (c), (d), (e), (f), (g), (double *)(h), (double *)(i), (j), (double *)(k), (l))
    135:     #endif
    136:   #endif
    137: #endif // PETSC_HAVE_CUDA

    139: #if defined(PETSC_HAVE_HIP)
    140:   #if defined(PETSC_USE_COMPLEX)
    141:     #if defined(PETSC_USE_REAL_SINGLE)
    142:       #define hipsolverDnXpotrf(a, b, c, d, e, f, g, h)                        hipsolverCpotrf((a), (b), (c), (hipComplex *)(d), (e), (hipComplex *)(f), (g), (h))
    143:       #define hipsolverDnXpotrf_bufferSize(a, b, c, d, e, f)                   hipsolverCpotrf_bufferSize((a), (b), (c), (hipComplex *)(d), (e), (f))
    144:       #define hipsolverDnXpotrs(a, b, c, d, e, f, g, h, i, j, k)               hipsolverCpotrs((a), (b), (c), (d), (hipComplex *)(e), (f), (hipComplex *)(g), (h), (hipComplex *)(i), (j), (k))
    145:       #define hipsolverDnXpotri(a, b, c, d, e, f, g, h)                        hipsolverCpotri((a), (b), (c), (hipComplex *)(d), (e), (hipComplex *)(f), (g), (h))
    146:       #define hipsolverDnXpotri_bufferSize(a, b, c, d, e, f)                   hipsolverCpotri_bufferSize((a), (b), (c), (hipComplex *)(d), (e), (f))
    147:       #define hipsolverDnXsytrf(a, b, c, d, e, f, g, h, i)                     hipsolverCsytrf((a), (b), (c), (hipComplex *)(d), (e), (f), (hipComplex *)(g), (h), (i))
    148:       #define hipsolverDnXsytrf_bufferSize(a, b, c, d, e)                      hipsolverCsytrf_bufferSize((a), (b), (hipComplex *)(c), (d), (e))
    149:       #define hipsolverDnXgetrf(a, b, c, d, e, f, g, h, i)                     hipsolverCgetrf((a), (b), (c), (hipComplex *)(d), (e), (hipComplex *)(f), (g), (h), (i))
    150:       #define hipsolverDnXgetrf_bufferSize(a, b, c, d, e, f)                   hipsolverCgetrf_bufferSize((a), (b), (c), (hipComplex *)(d), (e), (f))
    151:       #define hipsolverDnXgetrs(a, b, c, d, e, f, g, h, i, j, k, l)            hipsolverCgetrs((a), (b), (c), (d), (hipComplex *)(e), (f), (g), (hipComplex *)(h), (i), (hipComplex *)(j), (k), (l))
    152:       #define hipsolverDnXgeqrf_bufferSize(a, b, c, d, e, f)                   hipsolverCgeqrf_bufferSize((a), (b), (c), (hipComplex *)(d), (e), (f))
    153:       #define hipsolverDnXgeqrf(a, b, c, d, e, f, g, h, i)                     hipsolverCgeqrf((a), (b), (c), (hipComplex *)(d), (e), (hipComplex *)(f), (hipComplex *)(g), (h), (i))
    154:       #define hipsolverDnXormqr_bufferSize(a, b, c, d, e, f, g, h, i, j, k, l) hipsolverCunmqr_bufferSize((a), (b), (c), (d), (e), (f), (hipComplex *)(g), (h), (hipComplex *)(i), (hipComplex *)(j), (k), (l))
    155:       #define hipsolverDnXormqr(a, b, c, d, e, f, g, h, i, j, k, l, m, n)      hipsolverCunmqr((a), (b), (c), (d), (e), (f), (hipComplex *)(g), (h), (hipComplex *)(i), (hipComplex *)(j), (k), (hipComplex *)(l), (m), (n))
    156:       #define hipblasXtrsm(a, b, c, d, e, f, g, h, i, j, k, l)                 hipblasCtrsm((a), (b), (c), (d), (e), (f), (g), (hipComplex *)(h), (hipComplex *)(i), (j), (hipComplex *)(k), (l))
    157:     #else /* complex double */
    158:       #define hipsolverDnXpotrf(a, b, c, d, e, f, g, h)                        hipsolverZpotrf((a), (b), (c), (hipDoubleComplex *)(d), (e), (hipDoubleComplex *)(f), (g), (h))
    159:       #define hipsolverDnXpotrf_bufferSize(a, b, c, d, e, f)                   hipsolverZpotrf_bufferSize((a), (b), (c), (hipDoubleComplex *)(d), (e), (f))
    160:       #define hipsolverDnXpotrs(a, b, c, d, e, f, g, h, i, j, k)               hipsolverZpotrs((a), (b), (c), (d), (hipDoubleComplex *)(e), (f), (hipDoubleComplex *)(g), (h), (hipDoubleComplex *)(i), (j), (k))
    161:       #define hipsolverDnXpotri(a, b, c, d, e, f, g, h)                        hipsolverZpotri((a), (b), (c), (hipDoubleComplex *)(d), (e), (hipDoubleComplex *)(f), (g), (h))
    162:       #define hipsolverDnXpotri_bufferSize(a, b, c, d, e, f)                   hipsolverZpotri_bufferSize((a), (b), (c), (hipDoubleComplex *)(d), (e), (f))
    163:       #define hipsolverDnXsytrf(a, b, c, d, e, f, g, h, i)                     hipsolverZsytrf((a), (b), (c), (hipDoubleComplex *)(d), (e), (f), (hipDoubleComplex *)(g), (h), (i))
    164:       #define hipsolverDnXsytrf_bufferSize(a, b, c, d, e)                      hipsolverZsytrf_bufferSize((a), (b), (hipDoubleComplex *)(c), (d), (e))
    165:       #define hipsolverDnXgetrf(a, b, c, d, e, f, g, h, i)                     hipsolverZgetrf((a), (b), (c), (hipDoubleComplex *)(d), (e), (hipDoubleComplex *)(f), (g), (h), (i))
    166:       #define hipsolverDnXgetrf_bufferSize(a, b, c, d, e, f)                   hipsolverZgetrf_bufferSize((a), (b), (c), (hipDoubleComplex *)(d), (e), (f))
    167:       #define hipsolverDnXgetrs(a, b, c, d, e, f, g, h, i, j, k, l)            hipsolverZgetrs((a), (b), (c), (d), (hipDoubleComplex *)(e), (f), (g), (hipDoubleComplex *)(h), (i), (hipDoubleComplex *)(j), (k), (l))
    168:       #define hipsolverDnXgeqrf_bufferSize(a, b, c, d, e, f)                   hipsolverZgeqrf_bufferSize((a), (b), (c), (hipDoubleComplex *)(d), (e), (f))
    169:       #define hipsolverDnXgeqrf(a, b, c, d, e, f, g, h, i)                     hipsolverZgeqrf((a), (b), (c), (hipDoubleComplex *)(d), (e), (hipDoubleComplex *)(f), (hipDoubleComplex *)(g), (h), (i))
    170:       #define hipsolverDnXormqr_bufferSize(a, b, c, d, e, f, g, h, i, j, k, l) hipsolverZunmqr_bufferSize((a), (b), (c), (d), (e), (f), (hipDoubleComplex *)(g), (h), (hipDoubleComplex *)(i), (hipDoubleComplex *)(j), (k), (l))
    171:       #define hipsolverDnXormqr(a, b, c, d, e, f, g, h, i, j, k, l, m, n)      hipsolverZunmqr((a), (b), (c), (d), (e), (f), (hipDoubleComplex *)(g), (h), (hipDoubleComplex *)(i), (hipDoubleComplex *)(j), (k), (hipDoubleComplex *)(l), (m), (n))
    172:       #define hipblasXtrsm(a, b, c, d, e, f, g, h, i, j, k, l)                 hipblasZtrsm((a), (b), (c), (d), (e), (f), (g), (hipDoubleComplex *)(h), (hipDoubleComplex *)(i), (j), (hipDoubleComplex *)(k), (l))
    173:     #endif
    174:   #else /* real single */
    175:     #if defined(PETSC_USE_REAL_SINGLE)
    176:       #define hipsolverDnXpotrf(a, b, c, d, e, f, g, h)                        hipsolverSpotrf((a), (b), (c), (float *)(d), (e), (float *)(f), (g), (h))
    177:       #define hipsolverDnXpotrf_bufferSize(a, b, c, d, e, f)                   hipsolverSpotrf_bufferSize((a), (b), (c), (float *)(d), (e), (f))
    178:       #define hipsolverDnXpotrs(a, b, c, d, e, f, g, h, i, j, k)               hipsolverSpotrs((a), (b), (c), (d), (float *)(e), (f), (float *)(g), (h), (float *)(i), (j), (k))
    179:       #define hipsolverDnXpotri(a, b, c, d, e, f, g, h)                        hipsolverSpotri((a), (b), (c), (float *)(d), (e), (float *)(f), (g), (h))
    180:       #define hipsolverDnXpotri_bufferSize(a, b, c, d, e, f)                   hipsolverSpotri_bufferSize((a), (b), (c), (float *)(d), (e), (f))
    181:       #define hipsolverDnXsytrf(a, b, c, d, e, f, g, h, i)                     hipsolverSsytrf((a), (b), (c), (float *)(d), (e), (f), (float *)(g), (h), (i))
    182:       #define hipsolverDnXsytrf_bufferSize(a, b, c, d, e)                      hipsolverSsytrf_bufferSize((a), (b), (float *)(c), (d), (e))
    183:       #define hipsolverDnXgetrf(a, b, c, d, e, f, g, h, i)                     hipsolverSgetrf((a), (b), (c), (float *)(d), (e), (float *)(f), (g), (h), (i))
    184:       #define hipsolverDnXgetrf_bufferSize(a, b, c, d, e, f)                   hipsolverSgetrf_bufferSize((a), (b), (c), (float *)(d), (e), (f))
    185:       #define hipsolverDnXgetrs(a, b, c, d, e, f, g, h, i, j, k, l)            hipsolverSgetrs((a), (b), (c), (d), (float *)(e), (f), (g), (float *)(h), (i), (float *)(j), (k), (l))
    186:       #define hipsolverDnXgeqrf_bufferSize(a, b, c, d, e, f)                   hipsolverSgeqrf_bufferSize((a), (b), (c), (float *)(d), (e), (f))
    187:       #define hipsolverDnXgeqrf(a, b, c, d, e, f, g, h, i)                     hipsolverSgeqrf((a), (b), (c), (float *)(d), (e), (float *)(f), (float *)(g), (h), (i))
    188:       #define hipsolverDnXormqr_bufferSize(a, b, c, d, e, f, g, h, i, j, k, l) hipsolverSormqr_bufferSize((a), (b), (c), (d), (e), (f), (float *)(g), (h), (float *)(i), (float *)(j), (k), (l))
    189:       #define hipsolverDnXormqr(a, b, c, d, e, f, g, h, i, j, k, l, m, n)      hipsolverSormqr((a), (b), (c), (d), (e), (f), (float *)(g), (h), (float *)(i), (float *)(j), (k), (float *)(l), (m), (n))
    190:       #define hipblasXtrsm(a, b, c, d, e, f, g, h, i, j, k, l)                 hipblasStrsm((a), (b), (c), (d), (e), (f), (g), (float *)(h), (float *)(i), (j), (float *)(k), (l))
    191:     #else /* real double */
    192:       #define hipsolverDnXpotrf(a, b, c, d, e, f, g, h)                        hipsolverDpotrf((a), (b), (c), (double *)(d), (e), (double *)(f), (g), (h))
    193:       #define hipsolverDnXpotrf_bufferSize(a, b, c, d, e, f)                   hipsolverDpotrf_bufferSize((a), (b), (c), (double *)(d), (e), (f))
    194:       #define hipsolverDnXpotrs(a, b, c, d, e, f, g, h, i, j, k)               hipsolverDpotrs((a), (b), (c), (d), (double *)(e), (f), (double *)(g), (h), (double *)(i), (j), (k))
    195:       #define hipsolverDnXpotri(a, b, c, d, e, f, g, h)                        hipsolverDpotri((a), (b), (c), (double *)(d), (e), (double *)(f), (g), (h))
    196:       #define hipsolverDnXpotri_bufferSize(a, b, c, d, e, f)                   hipsolverDpotri_bufferSize((a), (b), (c), (double *)(d), (e), (f))
    197:       #define hipsolverDnXsytrf(a, b, c, d, e, f, g, h, i)                     hipsolverDsytrf((a), (b), (c), (double *)(d), (e), (f), (double *)(g), (h), (i))
    198:       #define hipsolverDnXsytrf_bufferSize(a, b, c, d, e)                      hipsolverDsytrf_bufferSize((a), (b), (double *)(c), (d), (e))
    199:       #define hipsolverDnXgetrf(a, b, c, d, e, f, g, h, i)                     hipsolverDgetrf((a), (b), (c), (double *)(d), (e), (double *)(f), (g), (h), (i))
    200:       #define hipsolverDnXgetrf_bufferSize(a, b, c, d, e, f)                   hipsolverDgetrf_bufferSize((a), (b), (c), (double *)(d), (e), (f))
    201:       #define hipsolverDnXgetrs(a, b, c, d, e, f, g, h, i, j, k, l)            hipsolverDgetrs((a), (b), (c), (d), (double *)(e), (f), (g), (double *)(h), (i), (double *)(j), (k), (l))
    202:       #define hipsolverDnXgeqrf_bufferSize(a, b, c, d, e, f)                   hipsolverDgeqrf_bufferSize((a), (b), (c), (double *)(d), (e), (f))
    203:       #define hipsolverDnXgeqrf(a, b, c, d, e, f, g, h, i)                     hipsolverDgeqrf((a), (b), (c), (double *)(d), (e), (double *)(f), (double *)(g), (h), (i))
    204:       #define hipsolverDnXormqr_bufferSize(a, b, c, d, e, f, g, h, i, j, k, l) hipsolverDormqr_bufferSize((a), (b), (c), (d), (e), (f), (double *)(g), (h), (double *)(i), (double *)(j), (k), (l))
    205:       #define hipsolverDnXormqr(a, b, c, d, e, f, g, h, i, j, k, l, m, n)      hipsolverDormqr((a), (b), (c), (d), (e), (f), (double *)(g), (h), (double *)(i), (double *)(j), (k), (double *)(l), (m), (n))
    206:       #define hipblasXtrsm(a, b, c, d, e, f, g, h, i, j, k, l)                 hipblasDtrsm((a), (b), (c), (d), (e), (f), (g), (double *)(h), (double *)(i), (j), (double *)(k), (l))
    207:     #endif
    208:   #endif

    210:   /* complex single */
    211:   #if defined(PETSC_USE_COMPLEX)
    212:     #if defined(HIPBLAS_V2)
    213: typedef hipDoubleComplex PetscHipblasDoubleComplex;
    214: typedef hipFloatComplex  PetscHipblasFloatComplex;
    215:     #else
    216: typedef hipblasComplex       PetscHipblasFloatComplex;
    217: typedef hipblasDoubleComplex PetscHipblasDoubleComplex;
    218:     #endif

    220:     #if defined(PETSC_USE_REAL_SINGLE)
    221:       #define hipblasXaxpy(a, b, c, d, e, f, g) hipblasCaxpy((a), (b), (PetscHipblasFloatComplex *)(c), (PetscHipblasFloatComplex *)(d), (e), (PetscHipblasFloatComplex *)(f), (g))
    222:       #define hipblasXscal(a, b, c, d, e)       hipblasCscal((a), (b), (PetscHipblasFloatComplex *)(c), (PetscHipblasFloatComplex *)(d), (e))
    223:       #define hipblasXdotu(a, b, c, d, e, f, g) hipblasCdotu((a), (b), (PetscHipblasFloatComplex *)(c), (d), (PetscHipblasFloatComplex *)(e), (f), (PetscHipblasFloatComplex *)(g))
    224:       #define hipblasXdot(a, b, c, d, e, f, g)  hipblasCdotc((a), (b), (PetscHipblasFloatComplex *)(c), (d), (PetscHipblasFloatComplex *)(e), (f), (PetscHipblasFloatComplex *)(g))
    225:       #define hipblasXswap(a, b, c, d, e, f)    hipblasCswap((a), (b), (PetscHipblasFloatComplex *)(c), (d), (PetscHipblasFloatComplex *)(e), (f))
    226:       #define hipblasXnrm2(a, b, c, d, e)       hipblasScnrm2((a), (b), (PetscHipblasFloatComplex *)(c), (d), (e))
    227:       #define hipblasIXamax(a, b, c, d, e)      hipblasIcamax((a), (b), (PetscHipblasFloatComplex *)(c), (d), (e))
    228:       #define hipblasXasum(a, b, c, d, e)       hipblasScasum((a), (b), (PetscHipblasFloatComplex *)(c), (d), (e))
    229:       #define hipblasXgemv(a, b, c, d, e, f, g, h, i, j, k, l) \
    230:         hipblasCgemv((a), (b), (c), (d), (PetscHipblasFloatComplex *)(e), (PetscHipblasFloatComplex *)(f), (g), (PetscHipblasFloatComplex *)(h), (i), (PetscHipblasFloatComplex *)(j), (PetscHipblasFloatComplex *)(k), (l))
    231:       #define hipblasXgemm(a, b, c, d, e, f, g, h, i, j, k, l, m, n) \
    232:         hipblasCgemm((a), (b), (c), (d), (e), (f), (PetscHipblasFloatComplex *)(g), (PetscHipblasFloatComplex *)(h), (i), (PetscHipblasFloatComplex *)(j), (k), (PetscHipblasFloatComplex *)(l), (PetscHipblasFloatComplex *)(m), (n))
    233:       #define hipblasXgeam(a, b, c, d, e, f, g, h, i, j, k, l, m) \
    234:         hipblasCgeam((a), (b), (c), (d), (e), (PetscHipblasFloatComplex *)(f), (PetscHipblasFloatComplex *)(g), (h), (PetscHipblasFloatComplex *)(i), (PetscHipblasFloatComplex *)(j), (k), (PetscHipblasFloatComplex *)(l), (m))
    235:     #else /* complex double */
    236:       #define hipblasXaxpy(a, b, c, d, e, f, g) hipblasZaxpy((a), (b), (PetscHipblasDoubleComplex *)(c), (PetscHipblasDoubleComplex *)(d), (e), (PetscHipblasDoubleComplex *)(f), (g))
    237:       #define hipblasXscal(a, b, c, d, e)       hipblasZscal((a), (b), (PetscHipblasDoubleComplex *)(c), (PetscHipblasDoubleComplex *)(d), (e))
    238:       #define hipblasXdotu(a, b, c, d, e, f, g) hipblasZdotu((a), (b), (PetscHipblasDoubleComplex *)(c), (d), (PetscHipblasDoubleComplex *)(e), (f), (PetscHipblasDoubleComplex *)(g))
    239:       #define hipblasXdot(a, b, c, d, e, f, g)  hipblasZdotc((a), (b), (PetscHipblasDoubleComplex *)(c), (d), (PetscHipblasDoubleComplex *)(e), (f), (PetscHipblasDoubleComplex *)(g))
    240:       #define hipblasXswap(a, b, c, d, e, f)    hipblasZswap((a), (b), (PetscHipblasDoubleComplex *)(c), (d), (PetscHipblasDoubleComplex *)(e), (f))
    241:       #define hipblasXnrm2(a, b, c, d, e)       hipblasDznrm2((a), (b), (PetscHipblasDoubleComplex *)(c), (d), (e))
    242:       #define hipblasIXamax(a, b, c, d, e)      hipblasIzamax((a), (b), (PetscHipblasDoubleComplex *)(c), (d), (e))
    243:       #define hipblasXasum(a, b, c, d, e)       hipblasDzasum((a), (b), (PetscHipblasDoubleComplex *)(c), (d), (e))
    244:       #define hipblasXgemv(a, b, c, d, e, f, g, h, i, j, k, l) \
    245:         hipblasZgemv((a), (b), (c), (d), (PetscHipblasDoubleComplex *)(e), (PetscHipblasDoubleComplex *)(f), (g), (PetscHipblasDoubleComplex *)(h), (i), (PetscHipblasDoubleComplex *)(j), (PetscHipblasDoubleComplex *)(k), (l))
    246:       #define hipblasXgemm(a, b, c, d, e, f, g, h, i, j, k, l, m, n) \
    247:         hipblasZgemm((a), (b), (c), (d), (e), (f), (PetscHipblasDoubleComplex *)(g), (PetscHipblasDoubleComplex *)(h), (i), (PetscHipblasDoubleComplex *)(j), (k), (PetscHipblasDoubleComplex *)(l), (PetscHipblasDoubleComplex *)(m), (n))
    248:       #define hipblasXgeam(a, b, c, d, e, f, g, h, i, j, k, l, m) \
    249:         hipblasZgeam((a), (b), (c), (d), (e), (PetscHipblasDoubleComplex *)(f), (PetscHipblasDoubleComplex *)(g), (h), (PetscHipblasDoubleComplex *)(i), (PetscHipblasDoubleComplex *)(j), (k), (PetscHipblasDoubleComplex *)(l), (m))
    250:     #endif
    251:   #else /* real single */
    252:     #if defined(PETSC_USE_REAL_SINGLE)
    253:       #define hipblasXaxpy  hipblasSaxpy
    254:       #define hipblasXscal  hipblasSscal
    255:       #define hipblasXdotu  hipblasSdot
    256:       #define hipblasXdot   hipblasSdot
    257:       #define hipblasXswap  hipblasSswap
    258:       #define hipblasXnrm2  hipblasSnrm2
    259:       #define hipblasIXamax hipblasIsamax
    260:       #define hipblasXasum  hipblasSasum
    261:       #define hipblasXgemv  hipblasSgemv
    262:       #define hipblasXgemm  hipblasSgemm
    263:       #define hipblasXgeam  hipblasSgeam
    264:     #else /* real double */
    265:       #define hipblasXaxpy  hipblasDaxpy
    266:       #define hipblasXscal  hipblasDscal
    267:       #define hipblasXdotu  hipblasDdot
    268:       #define hipblasXdot   hipblasDdot
    269:       #define hipblasXswap  hipblasDswap
    270:       #define hipblasXnrm2  hipblasDnrm2
    271:       #define hipblasIXamax hipblasIdamax
    272:       #define hipblasXasum  hipblasDasum
    273:       #define hipblasXgemv  hipblasDgemv
    274:       #define hipblasXgemm  hipblasDgemm
    275:       #define hipblasXgeam  hipblasDgeam
    276:     #endif
    277:   #endif
    278: #endif // PETSC_HAVE_HIP