Actual source code: sfcupm.hip.cpp

      1: #include <../src/vec/is/sf/impls/basic/sfpack.h>
      2: #include <petscpkg_version.h>

      4: #include <petscdevice_hip.h>
      5: #include <petsc/private/sfimpl.h>
      6: #include "../sfcupm.hpp"
      7: #include "../sfcupm_impl.hpp"

      9: namespace Petsc
     10: {

     12: namespace sf
     13: {

     15: namespace cupm
     16: {

     18: namespace impl
     19: {

     21: template struct SfInterface<device::cupm::DeviceType::HIP>;

     23: } // namespace impl

     25: } // namespace cupm

     27: } // namespace sf

     29: } // namespace Petsc

     31: using PetscSFHIP = ::Petsc::sf::cupm::impl::SfInterface<::Petsc::device::cupm::DeviceType::HIP>;

     33: PetscErrorCode PetscSFMalloc_HIP(PetscMemType mtype, size_t size, void **ptr)
     34: {
     35:   PetscFunctionBegin;
     36:   PetscCall(PetscSFHIP::Malloc(mtype, size, ptr));
     37:   PetscFunctionReturn(PETSC_SUCCESS);
     38: }

     40: PetscErrorCode PetscSFFree_HIP(PetscMemType mtype, void *ptr)
     41: {
     42:   PetscFunctionBegin;
     43:   PetscCall(PetscSFHIP::Free(mtype, ptr));
     44:   PetscFunctionReturn(PETSC_SUCCESS);
     45: }

     47: PetscErrorCode PetscSFLinkSetUp_HIP(PetscSF sf, PetscSFLink link, MPI_Datatype unit)
     48: {
     49:   PetscFunctionBegin;
     50:   PetscCall(PetscSFHIP::LinkSetUp(sf, link, unit));
     51:   PetscFunctionReturn(PETSC_SUCCESS);
     52: }