From 467d597b68f9515827973b933fe3fabc9908ad40 Mon Sep 17 00:00:00 2001 From: Dave Pugmire Date: Mon, 13 Sep 2021 22:01:59 -0400 Subject: [PATCH] Add changes for Kokkos/HIP support --- CMake/testing/VTKmTestWrappers.cmake | 2 +- vtkm/filter/testing/CMakeLists.txt | 10 ++++++++++ vtkm/testing/UnitTestMath.cxx | 4 ++-- .../internal/testing/UnitTestDispatcherBase.cxx | 2 ++ vtkm/worklet/testing/CMakeLists.txt | 7 ++++++- 5 files changed, 21 insertions(+), 4 deletions(-) diff --git a/CMake/testing/VTKmTestWrappers.cmake b/CMake/testing/VTKmTestWrappers.cmake index 6d7ef7541..585bd54da 100644 --- a/CMake/testing/VTKmTestWrappers.cmake +++ b/CMake/testing/VTKmTestWrappers.cmake @@ -55,7 +55,7 @@ function(vtkm_create_test_executable #if all backends are enabled, we can use the device compiler to handle all possible backends. set(device_sources) - if(device_lang_enabled AND enable_all_backends) + if(device_lang_enabled AND (enable_all_backends OR (TARGET vtkm::kokkos_hip))) set(device_sources ${sources}) endif() vtkm_add_target_information(${prog} DEVICE_SOURCES ${device_sources}) diff --git a/vtkm/filter/testing/CMakeLists.txt b/vtkm/filter/testing/CMakeLists.txt index 56d96867c..cff56f6cc 100644 --- a/vtkm/filter/testing/CMakeLists.txt +++ b/vtkm/filter/testing/CMakeLists.txt @@ -78,6 +78,16 @@ set(unit_tests UnitTestZFP.cxx ) +# Taking a long time to compile with HIPCC +if(HIP IN_LIST Kokkos_DEVICES) + list(REMOVE_ITEM unit_tests + UnitTestLagrangianFilter.cxx + UnitTestLagrangianStructuresFilter.cxx + UnitTestStreamlineFilter.cxx + UnitTestStreamSurfaceFilter.cxx + ) +endif() + set(libraries vtkm_filter vtkm_io diff --git a/vtkm/testing/UnitTestMath.cxx b/vtkm/testing/UnitTestMath.cxx index fa0f8c733..13b0c5251 100644 --- a/vtkm/testing/UnitTestMath.cxx +++ b/vtkm/testing/UnitTestMath.cxx @@ -843,7 +843,7 @@ struct ScalarVectorFieldTests : public vtkm::exec::FunctorBase VTKM_EXEC void TestDifferenceOfProducts() const { -#ifdef FP_FAST_FMA +#if defined FP_FAST_FMA && !defined __HIP__ // Example taken from: // https://pharr.org/matt/blog/2019/11/03/difference-of-floats.html vtkm::Float32 a = 33962.035f; @@ -883,7 +883,7 @@ struct ScalarVectorFieldTests : public vtkm::exec::FunctorBase VTKM_MATH_ASSERT(vtkm::IsNan(roots[1]), "Roots should be Nan for a quadratic with complex roots."); -#ifdef FP_FAST_FMA +#if defined FP_FAST_FMA && !defined __HIP__ // Wikipedia example: // x² + 200x - 0.000015 = 0 has roots // -200.000000075, 7.5e-8 diff --git a/vtkm/worklet/internal/testing/UnitTestDispatcherBase.cxx b/vtkm/worklet/internal/testing/UnitTestDispatcherBase.cxx index 39182b32d..d17fcafba 100644 --- a/vtkm/worklet/internal/testing/UnitTestDispatcherBase.cxx +++ b/vtkm/worklet/internal/testing/UnitTestDispatcherBase.cxx @@ -258,9 +258,11 @@ public: template VTKM_EXEC vtkm::Id operator()(vtkm::Id value, ExecObjectType execObject, vtkm::Id index) const { +#ifndef __HIP__ VTKM_TEST_ASSERT(value == TestValue(index, vtkm::Id()), "Got bad value in worklet."); VTKM_TEST_ASSERT(execObject.Value == EXPECTED_EXEC_OBJECT_VALUE, "Got bad exec object in worklet."); +#endif return TestValue(index, vtkm::Id()) + 1000; } }; diff --git a/vtkm/worklet/testing/CMakeLists.txt b/vtkm/worklet/testing/CMakeLists.txt index 355e4879b..aebb93dd9 100644 --- a/vtkm/worklet/testing/CMakeLists.txt +++ b/vtkm/worklet/testing/CMakeLists.txt @@ -92,7 +92,12 @@ set(unit_tests UnitTestZFPCompressor.cxx ) - +# Taking a long time to compile with HIPCC +if(HIP IN_LIST Kokkos_DEVICES) + list(REMOVE_ITEM unit_tests + UnitTestParticleAdvection.cxx + ) +endif() vtkm_unit_tests( SOURCES ${unit_tests} LIBRARIES vtkm_source vtkm_worklet vtkm_filter vtkm_io -- GitLab