From d3d66a331285d36a1e1e35feafa438ef5b518811 Mon Sep 17 00:00:00 2001 From: Robert Maynard Date: Wed, 17 Apr 2019 14:57:51 -0400 Subject: [PATCH 1/3] GameOfLife example always uses the proper device adapter Previously the example would only time using the serial device adapter, which wouldn't work when the user explicitly specified a device on the command line. --- examples/game_of_life/GameOfLife.cxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/game_of_life/GameOfLife.cxx b/examples/game_of_life/GameOfLife.cxx index 971d0a231..810f81eac 100644 --- a/examples/game_of_life/GameOfLife.cxx +++ b/examples/game_of_life/GameOfLife.cxx @@ -214,7 +214,7 @@ struct RenderGameOfLife vtkm::Vec spacing(0.0075f, 0.0075f, 0.0f); vtkm::cont::ArrayHandleUniformPointCoordinates coords(dimensions, origin, spacing); - vtkm::interop::TransferToOpenGL(coords, this->VBOState, vtkm::cont::DeviceAdapterTagSerial()); + vtkm::interop::TransferToOpenGL(coords, this->VBOState); } void render(vtkm::cont::DataSet& data) @@ -250,7 +250,7 @@ struct RenderGameOfLife } }; -vtkm::cont::Timer gTimer{ vtkm::cont::DeviceAdapterTagSerial() }; +vtkm::cont::Timer gTimer; vtkm::cont::DataSet* gData = nullptr; GameOfLife* gFilter = nullptr; RenderGameOfLife* gRenderer = nullptr; From 671c1df5c982f9073716dbdcd010dec816c79b5b Mon Sep 17 00:00:00 2001 From: Robert Maynard Date: Wed, 17 Apr 2019 16:01:15 -0400 Subject: [PATCH 2/3] Timer logs the proper device name when called with an invalid device --- vtkm/cont/Timer.cxx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/vtkm/cont/Timer.cxx b/vtkm/cont/Timer.cxx index 89685de21..b1470395c 100644 --- a/vtkm/cont/Timer.cxx +++ b/vtkm/cont/Timer.cxx @@ -328,11 +328,11 @@ vtkm::Float64 Timer::GetElapsedTime(vtkm::cont::DeviceAdapterId device) const // If we have specified a specific device, make sure we can run on it. auto& tracker = vtkm::cont::GetRuntimeDeviceTracker(); - if ((deviceToTime != vtkm::cont::DeviceAdapterTagAny()) && !tracker.CanRunOn(deviceToTime)) + if (deviceToTime != vtkm::cont::DeviceAdapterTagAny() && !tracker.CanRunOn(deviceToTime)) { VTKM_LOG_S(vtkm::cont::LogLevel::Error, - "Device '" << device.GetName() << "' can not run on current Device." - "Thus timer is not usable"); + "Device '" << deviceToTime.GetName() << "' can not run on current Device." + " Thus timer is not usable"); return 0.0; } From 9c292007231e8f6fd34f0c08207c0fd0490f8067 Mon Sep 17 00:00:00 2001 From: Robert Maynard Date: Wed, 17 Apr 2019 16:16:08 -0400 Subject: [PATCH 3/3] UnitTestBoundingIntervalHierarchy handles systems under load better The UnitTestBoundingIntervalHierarchy has historically had problems when the machine is already under-load when the algorithm is executed. By limiting the number of openMP threads the test uses we can reduce the amount of CPU time slicing that this test causes. --- vtkm/worklet/testing/UnitTestBoundingIntervalHierarchy.cxx | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/vtkm/worklet/testing/UnitTestBoundingIntervalHierarchy.cxx b/vtkm/worklet/testing/UnitTestBoundingIntervalHierarchy.cxx index 9510e7a78..4229a7408 100644 --- a/vtkm/worklet/testing/UnitTestBoundingIntervalHierarchy.cxx +++ b/vtkm/worklet/testing/UnitTestBoundingIntervalHierarchy.cxx @@ -116,6 +116,13 @@ void TestBoundingIntervalHierarchy(vtkm::cont::DataSet dataSet, vtkm::IdComponen void RunTest() { +//If this test is run on a machine that already has heavy +//cpu usage it will fail, so we limit the number of threads +//to avoid the test timing out +#ifdef VTKM_ENABLE_OPENMP + omp_set_num_threads(std::min(4, omp_get_max_threads())); +#endif + TestBoundingIntervalHierarchy(ConstructDataSet(16), 3); TestBoundingIntervalHierarchy(ConstructDataSet(16), 4); TestBoundingIntervalHierarchy(ConstructDataSet(16), 6);