diff --git a/source/adios2/helper/adiosKokkos.cpp b/source/adios2/helper/adiosKokkos.cpp index 4916f079cb..7a9f53c66b 100644 --- a/source/adios2/helper/adiosKokkos.cpp +++ b/source/adios2/helper/adiosKokkos.cpp @@ -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; } @@ -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); }