Date: 2026-06-01T23:13:33+00:00

Actual source code: matdiagonalcuda.cu

      1: #include <petsc/private/matimpl.h>

      3: #include "../matdiagonalcupm.hpp"
      4: #include "../src/vec/vec/impls/seq/cupm/vecseqcupm.hpp"
      5: #include "../src/vec/vec/impls/seq/cupm/vecseqcupm_impl.hpp"

      7: using namespace Petsc::device::cupm;
      8: using Petsc::device::cupm::DeviceType;

     10: static constexpr impl::MatDiagonal_CUPM<DeviceType::CUDA, ::Petsc::vec::cupm::impl::VecSeq_CUPM<DeviceType::CUDA>> cupm_mat{};

     12: PETSC_INTERN PetscErrorCode MatADot_Diagonal_SeqCUDA(Mat A, Vec x, Vec y, PetscScalar *val)
     13: {
     14:   PetscFunctionBegin;
     15:   PetscCall(cupm_mat.ADot(A, x, y, val));
     16:   PetscFunctionReturn(PETSC_SUCCESS);
     17: }

     19: PETSC_INTERN PetscErrorCode MatANormSq_Diagonal_SeqCUDA(Mat A, Vec x, PetscReal *val)
     20: {
     21:   PetscFunctionBegin;
     22:   PetscCall(cupm_mat.ANormSq(A, x, val));
     23:   PetscFunctionReturn(PETSC_SUCCESS);
     24: }