Skip to content

Commit

Permalink
Fixes from Alan Dayton (#1100)
Browse files Browse the repository at this point in the history
* Fixes from Alan Dayton: guard sections on AXOM_USE_GPU as well as AXOM_GPUCC
  • Loading branch information
agcapps committed May 26, 2023
1 parent a5b9b22 commit 8cbf7b1
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 21 deletions.
20 changes: 10 additions & 10 deletions src/axom/core/ArrayBase.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -812,7 +812,7 @@ struct ArrayOpsBase<T, false>
const T* values,
MemorySpace space)
{
#if defined(AXOM_GPUCC) && defined(AXOM_USE_UMPIRE)
#if defined(AXOM_USE_GPU) && defined(AXOM_GPUCC) && defined(AXOM_USE_UMPIRE)
if(std::is_trivially_copyable<T>::value)
{
axom::copy(array + begin, values, sizeof(T) * nelems);
Expand Down Expand Up @@ -905,7 +905,7 @@ struct ArrayOpsBase<T, false>
}
};

#if defined(AXOM_GPUCC) && defined(AXOM_USE_UMPIRE)
#if defined(AXOM_USE_GPU) && defined(AXOM_GPUCC) && defined(AXOM_USE_UMPIRE)
template <typename T>
struct ArrayOpsBase<T, true>
{
Expand Down Expand Up @@ -1158,7 +1158,7 @@ template <typename T, MemorySpace SPACE>
struct ArrayOps
{
private:
#if defined(AXOM_GPUCC) && defined(AXOM_USE_UMPIRE)
#if defined(AXOM_USE_GPU) && defined(AXOM_GPUCC) && defined(AXOM_USE_UMPIRE)
constexpr static bool IsDevice = (SPACE == MemorySpace::Device);
#else
constexpr static bool IsDevice = false;
Expand Down Expand Up @@ -1231,14 +1231,14 @@ struct ArrayOps<T, MemorySpace::Dynamic>
{
private:
using Base = ArrayOpsBase<T, false>;
#if defined(AXOM_GPUCC) && defined(AXOM_USE_UMPIRE)
#if defined(AXOM_USE_GPU) && defined(AXOM_GPUCC) && defined(AXOM_USE_UMPIRE)
using BaseDevice = ArrayOpsBase<T, true>;
#endif

public:
static void init(T* array, IndexType begin, IndexType nelems, int allocId)
{
#if defined(AXOM_GPUCC) && defined(AXOM_USE_UMPIRE)
#if defined(AXOM_USE_GPU) && defined(AXOM_GPUCC) && defined(AXOM_USE_UMPIRE)
MemorySpace space = getAllocatorSpace(allocId);

if(space == MemorySpace::Device)
Expand All @@ -1258,7 +1258,7 @@ struct ArrayOps<T, MemorySpace::Dynamic>
int allocId,
const T& value)
{
#if defined(AXOM_GPUCC) && defined(AXOM_USE_UMPIRE)
#if defined(AXOM_USE_GPU) && defined(AXOM_GPUCC) && defined(AXOM_USE_UMPIRE)
MemorySpace space = getAllocatorSpace(allocId);

if(space == MemorySpace::Device)
Expand All @@ -1279,7 +1279,7 @@ struct ArrayOps<T, MemorySpace::Dynamic>
const T* values,
MemorySpace valueSpace)
{
#if defined(AXOM_GPUCC) && defined(AXOM_USE_UMPIRE)
#if defined(AXOM_USE_GPU) && defined(AXOM_GPUCC) && defined(AXOM_USE_UMPIRE)
MemorySpace space = getAllocatorSpace(allocId);

if(space == MemorySpace::Device)
Expand All @@ -1300,7 +1300,7 @@ struct ArrayOps<T, MemorySpace::Dynamic>
{
return;
}
#if defined(AXOM_GPUCC) && defined(AXOM_USE_UMPIRE)
#if defined(AXOM_USE_GPU) && defined(AXOM_GPUCC) && defined(AXOM_USE_UMPIRE)
MemorySpace space = getAllocatorSpace(allocId);

if(space == MemorySpace::Device)
Expand All @@ -1324,7 +1324,7 @@ struct ArrayOps<T, MemorySpace::Dynamic>
{
return;
}
#if defined(AXOM_GPUCC) && defined(AXOM_USE_UMPIRE)
#if defined(AXOM_USE_GPU) && defined(AXOM_GPUCC) && defined(AXOM_USE_UMPIRE)
MemorySpace space = getAllocatorSpace(allocId);

if(space == MemorySpace::Device)
Expand All @@ -1341,7 +1341,7 @@ struct ArrayOps<T, MemorySpace::Dynamic>
template <typename... Args>
static void emplace(T* array, IndexType dst, IndexType allocId, Args&&... args)
{
#if defined(AXOM_GPUCC) && defined(AXOM_USE_UMPIRE)
#if defined(AXOM_USE_GPU) && defined(AXOM_GPUCC) && defined(AXOM_USE_UMPIRE)
MemorySpace space = getAllocatorSpace(allocId);

if(space == MemorySpace::Device)
Expand Down
20 changes: 10 additions & 10 deletions src/axom/core/tests/core_array.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -751,7 +751,7 @@ void check_external_view(ArrayView<T>& v)
EXPECT_EQ(data_ptr, v.data());
}

#if defined(AXOM_GPUCC) && defined(AXOM_USE_UMPIRE)
#if defined(AXOM_USE_GPU) && defined(AXOM_GPUCC) && defined(AXOM_USE_UMPIRE)

template <typename T>
__global__ void assign_raw(T* data, int N)
Expand Down Expand Up @@ -919,7 +919,7 @@ void check_device_2D(Array<T, 2, SPACE>& v)
}
}

#endif // defined(AXOM_GPUCC) && defined(AXOM_USE_UMPIRE)
#endif // defined(AXOM_USE_GPU) && defined(AXOM_GPUCC) && defined(AXOM_USE_UMPIRE)

} /* end namespace internal */

Expand Down Expand Up @@ -957,7 +957,7 @@ TEST(core_array, checkFill)
}

//------------------------------------------------------------------------------
#if defined(AXOM_GPUCC) && defined(AXOM_USE_UMPIRE)
#if defined(AXOM_USE_GPU) && defined(AXOM_GPUCC) && defined(AXOM_USE_UMPIRE)
TEST(core_array, checkFillDevice)
{
for(IndexType capacity = 2; capacity < 512; capacity *= 2)
Expand Down Expand Up @@ -1279,7 +1279,7 @@ TEST(core_array, checkIterator)
}

//------------------------------------------------------------------------------
#if defined(AXOM_GPUCC) && defined(AXOM_USE_UMPIRE)
#if defined(AXOM_USE_GPU) && defined(AXOM_GPUCC) && defined(AXOM_USE_UMPIRE)
void checkIteratorDeviceImpl()
{
constexpr int SIZE = 1000;
Expand Down Expand Up @@ -1696,8 +1696,8 @@ TEST(core_array, check_multidimensional_view_spacing)
//------------------------------------------------------------------------------
TEST(core_array, checkDevice)
{
#if !defined(AXOM_GPUCC) || !defined(AXOM_USE_UMPIRE) || \
!defined(UMPIRE_ENABLE_DEVICE)
#if !defined(AXOM_USE_GPU) || !defined(AXOM_GPUCC) || \
!defined(AXOM_USE_UMPIRE) || !defined(UMPIRE_ENABLE_DEVICE)
GTEST_SKIP() << "CUDA or HIP is not available, skipping tests that use Array "
"in device code";
#else
Expand Down Expand Up @@ -1732,8 +1732,8 @@ TEST(core_array, checkDevice)
//------------------------------------------------------------------------------
TEST(core_array, checkDevice2D)
{
#if !defined(AXOM_GPUCC) || !defined(AXOM_USE_UMPIRE) || \
!defined(UMPIRE_ENABLE_DEVICE)
#if !defined(AXOM_USE_GPU) || !defined(AXOM_GPUCC) || \
!defined(AXOM_USE_UMPIRE) || !defined(UMPIRE_ENABLE_DEVICE)
GTEST_SKIP() << "CUDA or HIP is not available, skipping tests that use Array "
"in device code";
#else
Expand Down Expand Up @@ -1796,8 +1796,8 @@ TEST(core_array, checkDefaultInitialization)
//------------------------------------------------------------------------------
TEST(core_array, checkDefaultInitializationDevice)
{
#if !defined(AXOM_GPUCC) || !defined(AXOM_USE_UMPIRE) || \
!defined(UMPIRE_ENABLE_DEVICE)
#if !defined(AXOM_USE_GPU) || !defined(AXOM_GPUCC) || \
!defined(AXOM_USE_UMPIRE) || !defined(UMPIRE_ENABLE_DEVICE)
GTEST_SKIP() << "CUDA or HIP is not available, skipping tests that use Array "
"in device code";
#else
Expand Down
2 changes: 1 addition & 1 deletion src/axom/core/tests/core_stack_array.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ TEST(core_stack_array, less_than)
// The following would produce a compiler error since Tensor does not have an operator<() !
//internal::test_less_than<Tensor, N>([](int i) { return Tensor(i + 1); });

#if !defined(AXOM_GPUCC)
#if !defined(AXOM_USE_GPU) || !defined(AXOM_GPUCC)
internal::test_less_than<std::string, N>(
[](int i) { return std::to_string(i + 1); });
#endif
Expand Down

0 comments on commit 8cbf7b1

Please sign in to comment.