Skip to content

Commit

Permalink
Merge pull request #3605 from anagainaru/hip-specific-func
Browse files Browse the repository at this point in the history
Adding missing HIP specific functionality
  • Loading branch information
anagainaru authored and vicentebolea committed May 11, 2023
2 parents 9761193 + a17eda2 commit 6ae473b
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions source/adios2/helper/adiosKokkos.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,15 @@ bool IsGPUbuffer(const void *ptr)
{
return true;
}
#endif
#ifdef ADIOS2_HAVE_KOKKOS_HIP
hipError_t ret;
hipPointerAttribute_t attr;
ret = hipPointerGetAttributes(&attr, ptr);
if (ret == hipSuccess && attr.memoryType == hipMemoryTypeDevice)
{
return true;
}
#endif
return false;
}
Expand All @@ -102,6 +111,15 @@ void KokkosInit()
int device_id;
cudaGetDevice(&device_id);
settings.set_device_id(device_id);
#endif
#ifdef ADIOS2_HAVE_KOKKOS_HIP
int device_id;
hipError_t ret;
ret = hipGetDevice(&device_id);
if (ret == hipSuccess)
{
settings.set_device_id(device_id);
}
#endif
Kokkos::initialize(settings);
}
Expand Down

0 comments on commit 6ae473b

Please sign in to comment.