Date: 2025-03-29T05:58:52+00:00

Actual source code: sfcupm.cu

      1: #include <petscdevice_cuda.h>
      2: #include <petsc/private/sfimpl.h>
      3: #include "../sfcupm.hpp"
      4: #include "../sfcupm_impl.hpp"

      6: namespace Petsc
      7: {

      9: namespace sf
     10: {

     12: namespace cupm
     13: {

     15: namespace impl
     16: {

     18: template struct SfInterface<device::cupm::DeviceType::CUDA>;

     20: } // namespace impl

     22: } // namespace cupm

     24: } // namespace sf

     26: } // namespace Petsc

     28: using PetscSFCuda = ::Petsc::sf::cupm::impl::SfInterface<::Petsc::device::cupm::DeviceType::CUDA>;

     30: PetscErrorCode PetscSFMalloc_CUDA(PetscMemType mtype, size_t size, void **ptr)
     31: {
     32:   PetscFunctionBegin;
     33:   PetscCall(PetscSFCuda::Malloc(mtype, size, ptr));
     34:   PetscFunctionReturn(PETSC_SUCCESS);
     35: }

     37: PetscErrorCode PetscSFFree_CUDA(PetscMemType mtype, void *ptr)
     38: {
     39:   PetscFunctionBegin;
     40:   PetscCall(PetscSFCuda::Free(mtype, ptr));
     41:   PetscFunctionReturn(PETSC_SUCCESS);
     42: }

     44: PetscErrorCode PetscSFLinkSetUp_CUDA(PetscSF sf, PetscSFLink link, MPI_Datatype unit)
     45: {
     46:   PetscFunctionBegin;
     47:   PetscCall(PetscSFCuda::LinkSetUp(sf, link, unit));
     48:   PetscFunctionReturn(PETSC_SUCCESS);
     49: }