Date: 2026-05-01T06:12:06+00:00

Actual source code: cupmsolverinterface.cxx

      1: #include <petsc/private/cupmsolverinterface.hpp>
      2: #include <petsc/private/petscadvancedmacros.h>

      4: namespace Petsc
      5: {

      7: namespace device
      8: {

     10: namespace cupm
     11: {

     13: namespace impl
     14: {

     16: #define PETSC_CUPMSOLVER_STATIC_VARIABLE_DEFN(THEIRS, DEVICE, OURS) const decltype(THEIRS) SolverInterfaceImpl<DeviceType::DEVICE>::OURS;

     18: #define PETSC_CUPMSOLVER_DEFINE_STATIC_VARIABLE_EXACT(CUORIGINAL, HIPORIGINAL, OURS) \
     19:   PetscIfPetscDefined(HAVE_CUDA, PETSC_CUPMSOLVER_STATIC_VARIABLE_DEFN, PetscExpandToNothing)(CUORIGINAL, CUDA, OURS) PetscIfPetscDefined(HAVE_HIP, PETSC_CUPMSOLVER_STATIC_VARIABLE_DEFN, PetscExpandToNothing)(HIPORIGINAL, HIP, OURS)

     21: #define PETSC_CUPMSOLVER_DEFINE_STATIC_VARIABLE_MATCHING_SCHEME(SUFFIX) PETSC_CUPMSOLVER_DEFINE_STATIC_VARIABLE_EXACT(PetscConcat(CUSOLVER_, SUFFIX), PetscConcat(HIPSOLVER_, SUFFIX), PetscConcat(CUPMSOLVER_, SUFFIX))

     23: PETSC_CUPMSOLVER_DEFINE_STATIC_VARIABLE_MATCHING_SCHEME(STATUS_SUCCESS)
     24: PETSC_CUPMSOLVER_DEFINE_STATIC_VARIABLE_MATCHING_SCHEME(STATUS_NOT_INITIALIZED)
     25: PETSC_CUPMSOLVER_DEFINE_STATIC_VARIABLE_MATCHING_SCHEME(STATUS_ALLOC_FAILED)
     26: PETSC_CUPMSOLVER_DEFINE_STATIC_VARIABLE_MATCHING_SCHEME(STATUS_INTERNAL_ERROR)

     28: PETSC_CUPMSOLVER_DEFINE_STATIC_VARIABLE_EXACT(CUBLAS_OP_T, HIPSOLVER_OP_T, CUPMSOLVER_OP_T)
     29: PETSC_CUPMSOLVER_DEFINE_STATIC_VARIABLE_EXACT(CUBLAS_OP_N, HIPSOLVER_OP_N, CUPMSOLVER_OP_N)
     30: PETSC_CUPMSOLVER_DEFINE_STATIC_VARIABLE_EXACT(CUBLAS_OP_C, HIPSOLVER_OP_C, CUPMSOLVER_OP_C)

     32: PETSC_CUPMSOLVER_DEFINE_STATIC_VARIABLE_EXACT(CUBLAS_FILL_MODE_LOWER, HIPSOLVER_FILL_MODE_LOWER, CUPMSOLVER_FILL_MODE_LOWER)
     33: PETSC_CUPMSOLVER_DEFINE_STATIC_VARIABLE_EXACT(CUBLAS_FILL_MODE_UPPER, HIPSOLVER_FILL_MODE_UPPER, CUPMSOLVER_FILL_MODE_UPPER)

     35: PETSC_CUPMSOLVER_DEFINE_STATIC_VARIABLE_EXACT(CUBLAS_SIDE_LEFT, HIPSOLVER_SIDE_LEFT, CUPMSOLVER_SIDE_LEFT)
     36: PETSC_CUPMSOLVER_DEFINE_STATIC_VARIABLE_EXACT(CUBLAS_SIDE_RIGHT, HIPSOLVER_SIDE_RIGHT, CUPMSOLVER_SIDE_RIGHT)

     38: #if PetscDefined(HAVE_CUDA)
     39: template struct SolverInterface<DeviceType::CUDA>;
     40: #endif

     42: #if PetscDefined(HAVE_HIP)
     43: template struct SolverInterface<DeviceType::HIP>;
     44: #endif

     46: } // namespace impl

     48: } // namespace cupm

     50: } // namespace device

     52: } // namespace Petsc