Skip to content

Commit

Permalink
Allowing to build with Kokkos with any backend
Browse files Browse the repository at this point in the history
  • Loading branch information
anagainaru committed Jan 29, 2023
1 parent d6e03a1 commit 9648e12
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion bindings/CXX11/adios2/cxx11/KokkosView.h
Expand Up @@ -17,7 +17,7 @@ struct memspace_kokkos_to_adios2<Kokkos::HostSpace>
static constexpr adios2::MemorySpace value = adios2::MemorySpace::Host;
};

#if define(KOKKOS_ENABLE_CUDA) || define(ADIOS2_HAVE_CUDA)
#if defined(KOKKOS_ENABLE_CUDA) || defined(ADIOS2_HAVE_CUDA)

template <>
struct memspace_kokkos_to_adios2<Kokkos::CudaSpace>
Expand Down
2 changes: 1 addition & 1 deletion source/adios2/core/VariableBase.cpp
Expand Up @@ -48,12 +48,12 @@ size_t VariableBase::TotalSize() const noexcept

MemorySpace VariableBase::GetMemorySpace(const void *ptr)
{
#ifdef ADIOS2_HAVE_GPU_SUPPORT
if (m_MemSpace != MemorySpace::Detect)
{
return m_MemSpace;
}

#ifdef ADIOS2_HAVE_GPU_SUPPORT
if (helper::IsGPUbuffer(ptr))
{
return MemorySpace::GPU;
Expand Down
2 changes: 2 additions & 0 deletions source/adios2/helper/adiosKokkos.cpp
Expand Up @@ -81,12 +81,14 @@ void MemcpyBufferToGPU(char *GPUbuffer, const char *src, size_t byteCount)

bool IsGPUbuffer(const void *ptr)
{
#ifdef KOKKOS_ENABLE_CUDA
cudaPointerAttributes attr;
cudaPointerGetAttributes(&attr, ptr);
if (attr.type == cudaMemoryTypeDevice)
{
return true;
}
#endif
return false;
}

Expand Down
2 changes: 2 additions & 0 deletions source/adios2/helper/adiosKokkos.h
Expand Up @@ -6,6 +6,8 @@
#ifndef ADIOS2_HELPER_ADIOSKOKKOS_H_
#define ADIOS2_HELPER_ADIOSKOKKOS_H_

#include <cstddef>

namespace adios2
{
namespace helper
Expand Down

0 comments on commit 9648e12

Please sign in to comment.