Commit 996dc34c authored by Robert Maynard's avatar Robert Maynard

The benchmark executables now force device adapters

To make sure we always use the correct device adapter force only
a single device adapter to be on.
parent f02f5ca8
...@@ -561,6 +561,10 @@ int main(int argc, char* argv[]) ...@@ -561,6 +561,10 @@ int main(int argc, char* argv[])
using DeviceAdapter = VTKM_DEFAULT_DEVICE_ADAPTER_TAG; using DeviceAdapter = VTKM_DEFAULT_DEVICE_ADAPTER_TAG;
using Benchmarks = vtkm::benchmarking::BenchmarkArrayTransfer<DeviceAdapter>; using Benchmarks = vtkm::benchmarking::BenchmarkArrayTransfer<DeviceAdapter>;
auto tracker = vtkm::cont::GetGlobalRuntimeDeviceTracker();
tracker.ForceDevice(DeviceAdapter{});
bool result = Benchmarks::Run(); bool result = Benchmarks::Run();
return result ? EXIT_SUCCESS : EXIT_FAILURE; return result ? EXIT_SUCCESS : EXIT_FAILURE;
} }
...@@ -167,6 +167,11 @@ int main(int argc, char* argv[]) ...@@ -167,6 +167,11 @@ int main(int argc, char* argv[])
tbb::task_scheduler_init init(numThreads); tbb::task_scheduler_init init(numThreads);
#endif // TBB #endif // TBB
using Device = VTKM_DEFAULT_DEVICE_ADAPTER_TAG;
auto tracker = vtkm::cont::GetGlobalRuntimeDeviceTracker();
tracker.ForceDevice(Device{});
BenchmarkValueType<vtkm::UInt8>(); BenchmarkValueType<vtkm::UInt8>();
BenchmarkValueType<vtkm::Vec<vtkm::UInt8, 2>>(); BenchmarkValueType<vtkm::Vec<vtkm::UInt8, 2>>();
BenchmarkValueType<vtkm::Vec<vtkm::UInt8, 3>>(); BenchmarkValueType<vtkm::Vec<vtkm::UInt8, 3>>();
......
...@@ -29,6 +29,7 @@ ...@@ -29,6 +29,7 @@
#include <vtkm/worklet/DispatcherMapField.h> #include <vtkm/worklet/DispatcherMapField.h>
#include <vtkm/worklet/DispatcherMapTopology.h> #include <vtkm/worklet/DispatcherMapTopology.h>
#include <vtkm/worklet/Invoker.h>
#include <vtkm/worklet/WorkletMapField.h> #include <vtkm/worklet/WorkletMapField.h>
#include <vtkm/worklet/WorkletMapTopology.h> #include <vtkm/worklet/WorkletMapTopology.h>
...@@ -305,10 +306,7 @@ struct ValueTypes : vtkm::ListTagBase<vtkm::Float32, vtkm::Float64> ...@@ -305,10 +306,7 @@ struct ValueTypes : vtkm::ListTagBase<vtkm::Float32, vtkm::Float64>
{ {
}; };
struct InterpValueTypes : vtkm::ListTagBase<vtkm::Float32, struct InterpValueTypes : vtkm::ListTagBase<vtkm::Float32, vtkm::Vec<vtkm::Float32, 3>>
vtkm::Float64,
vtkm::Vec<vtkm::Float32, 3>,
vtkm::Vec<vtkm::Float64, 3>>
{ {
}; };
using StorageListTag = ::vtkm::cont::StorageListTagBasic; using StorageListTag = ::vtkm::cont::StorageListTagBasic;
...@@ -376,6 +374,7 @@ private: ...@@ -376,6 +374,7 @@ private:
Timer timer; Timer timer;
BlackScholes<Value> worklet(RISKFREE, VOLATILITY); BlackScholes<Value> worklet(RISKFREE, VOLATILITY);
vtkm::worklet::DispatcherMapField<BlackScholes<Value>> dispatcher(worklet); vtkm::worklet::DispatcherMapField<BlackScholes<Value>> dispatcher(worklet);
dispatcher.SetDevice(DeviceAdapterTag());
dispatcher.Invoke( dispatcher.Invoke(
this->StockPrice, this->OptionStrike, this->OptionYears, callResultHandle, putResultHandle); this->StockPrice, this->OptionStrike, this->OptionYears, callResultHandle, putResultHandle);
...@@ -414,6 +413,7 @@ private: ...@@ -414,6 +413,7 @@ private:
Timer timer; Timer timer;
BlackScholes<Value> worklet(RISKFREE, VOLATILITY); BlackScholes<Value> worklet(RISKFREE, VOLATILITY);
vtkm::worklet::DispatcherMapField<BlackScholes<Value>> dispatcher(worklet); vtkm::worklet::DispatcherMapField<BlackScholes<Value>> dispatcher(worklet);
dispatcher.SetDevice(DeviceAdapterTag());
dispatcher.Invoke(dstocks, dstrikes, doptions, callResultHandle, putResultHandle); dispatcher.Invoke(dstocks, dstrikes, doptions, callResultHandle, putResultHandle);
...@@ -455,10 +455,11 @@ private: ...@@ -455,10 +455,11 @@ private:
Timer timer; Timer timer;
vtkm::worklet::DispatcherMapField<Mag>().Invoke(InputHandle, tempHandle1); vtkm::worklet::Invoker invoke(DeviceAdapterTag{});
vtkm::worklet::DispatcherMapField<Sin>().Invoke(tempHandle1, tempHandle2); invoke(Mag{}, this->InputHandle, tempHandle1);
vtkm::worklet::DispatcherMapField<Square>().Invoke(tempHandle2, tempHandle1); invoke(Sin{}, tempHandle1, tempHandle2);
vtkm::worklet::DispatcherMapField<Cos>().Invoke(tempHandle1, tempHandle2); invoke(Square{}, tempHandle2, tempHandle1);
invoke(Cos{}, tempHandle1, tempHandle2);
return timer.GetElapsedTime(); return timer.GetElapsedTime();
} }
...@@ -493,10 +494,11 @@ private: ...@@ -493,10 +494,11 @@ private:
Timer timer; Timer timer;
vtkm::worklet::DispatcherMapField<Mag>().Invoke(dinput, dtemp1); vtkm::worklet::Invoker invoke(DeviceAdapterTag{});
vtkm::worklet::DispatcherMapField<Sin>().Invoke(dtemp1, dtemp2); invoke(Mag{}, dinput, dtemp1);
vtkm::worklet::DispatcherMapField<Square>().Invoke(dtemp2, dtemp1); invoke(Sin{}, dtemp1, dtemp2);
vtkm::worklet::DispatcherMapField<Cos>().Invoke(dtemp1, dtemp2); invoke(Square{}, dtemp2, dtemp1);
invoke(Cos{}, dtemp1, dtemp2);
return timer.GetElapsedTime(); return timer.GetElapsedTime();
} }
...@@ -534,7 +536,9 @@ private: ...@@ -534,7 +536,9 @@ private:
vtkm::cont::ArrayHandle<Value> result; vtkm::cont::ArrayHandle<Value> result;
Timer timer; Timer timer;
vtkm::worklet::DispatcherMapField<FusedMath>().Invoke(this->InputHandle, result); vtkm::worklet::DispatcherMapField<FusedMath> dispatcher;
dispatcher.SetDevice(DeviceAdapterTag());
dispatcher.Invoke(this->InputHandle, result);
return timer.GetElapsedTime(); return timer.GetElapsedTime();
} }
...@@ -565,7 +569,9 @@ private: ...@@ -565,7 +569,9 @@ private:
vtkm::cont::ArrayHandle<Value, StorageTag> result; vtkm::cont::ArrayHandle<Value, StorageTag> result;
Timer timer; Timer timer;
vtkm::worklet::DispatcherMapField<FusedMath>().Invoke(dinput, result); vtkm::worklet::DispatcherMapField<FusedMath> dispatcher;
dispatcher.SetDevice(DeviceAdapterTag());
dispatcher.Invoke(dinput, result);
return timer.GetElapsedTime(); return timer.GetElapsedTime();
} }
...@@ -607,7 +613,9 @@ private: ...@@ -607,7 +613,9 @@ private:
const std::size_t psize = static_cast<std::size_t>(cellSet.GetNumberOfPoints()); const std::size_t psize = static_cast<std::size_t>(cellSet.GetNumberOfPoints());
this->EdgePairHandle.Allocate(numberOfEdges); this->EdgePairHandle.Allocate(numberOfEdges);
vtkm::worklet::DispatcherMapTopology<GenerateEdges>().Invoke(cellSet, this->EdgePairHandle); vtkm::worklet::DispatcherMapTopology<GenerateEdges> dispatcher;
dispatcher.SetDevice(DeviceAdapterTag());
dispatcher.Invoke(cellSet, this->EdgePairHandle);
this->weight.resize(esize); this->weight.resize(esize);
for (std::size_t i = 0; i < esize; ++i) for (std::size_t i = 0; i < esize; ++i)
...@@ -964,6 +972,9 @@ int main(int argc, char* argv[]) ...@@ -964,6 +972,9 @@ int main(int argc, char* argv[])
} }
//now actually execute the benchmarks //now actually execute the benchmarks
return vtkm::benchmarking::BenchmarkFieldAlgorithms<VTKM_DEFAULT_DEVICE_ADAPTER_TAG>::Run( using Device = VTKM_DEFAULT_DEVICE_ADAPTER_TAG;
benchmarks); auto tracker = vtkm::cont::GetGlobalRuntimeDeviceTracker();
tracker.ForceDevice(Device{});
return vtkm::benchmarking::BenchmarkFieldAlgorithms<Device>::Run(benchmarks);
} }
...@@ -1285,6 +1285,9 @@ int main(int argc, char* argv[]) ...@@ -1285,6 +1285,9 @@ int main(int argc, char* argv[])
{ {
vtkm::cont::Initialize(argc, argv); vtkm::cont::Initialize(argc, argv);
auto tracker = vtkm::cont::GetGlobalRuntimeDeviceTracker();
tracker.ForceDevice(Device{});
int retval = 1; int retval = 1;
try try
{ {
......
...@@ -134,6 +134,10 @@ int main(int argc, char* argv[]) ...@@ -134,6 +134,10 @@ int main(int argc, char* argv[])
{ {
vtkm::cont::InitLogging(argc, argv); vtkm::cont::InitLogging(argc, argv);
using Device = VTKM_DEFAULT_DEVICE_ADAPTER_TAG;
auto tracker = vtkm::cont::GetGlobalRuntimeDeviceTracker();
tracker.ForceDevice(Device{});
VTKM_RUN_BENCHMARK(RayTracing, vtkm::ListTagBase<vtkm::Float32>()); VTKM_RUN_BENCHMARK(RayTracing, vtkm::ListTagBase<vtkm::Float32>());
return 0; return 0;
} }
...@@ -215,8 +215,8 @@ private: ...@@ -215,8 +215,8 @@ private:
Timer timer; Timer timer;
vtkm::worklet::DispatcherMapTopology<AverageCellToPoint> dispatcher; vtkm::worklet::DispatcherMapTopology<AverageCellToPoint> dispatcher;
dispatcher.SetDevice(DeviceAdapterTag());
dispatcher.Invoke(this->InputHandle, cellSet, result); dispatcher.Invoke(this->InputHandle, cellSet, result);
//result.SyncControlArray();
return timer.GetElapsedTime(); return timer.GetElapsedTime();
} }
...@@ -251,9 +251,8 @@ private: ...@@ -251,9 +251,8 @@ private:
Timer timer; Timer timer;
vtkm::worklet::DispatcherMapTopology<AverageCellToPoint> dispatcher; vtkm::worklet::DispatcherMapTopology<AverageCellToPoint> dispatcher;
dispatcher.SetDevice(DeviceAdapterTag());
dispatcher.Invoke(dinput, cellSet, result); dispatcher.Invoke(dinput, cellSet, result);
//result.SyncControlArray();
return timer.GetElapsedTime(); return timer.GetElapsedTime();
} }
...@@ -295,8 +294,8 @@ private: ...@@ -295,8 +294,8 @@ private:
Timer timer; Timer timer;
vtkm::worklet::DispatcherMapTopology<AveragePointToCell> dispatcher; vtkm::worklet::DispatcherMapTopology<AveragePointToCell> dispatcher;
dispatcher.SetDevice(DeviceAdapterTag());
dispatcher.Invoke(this->InputHandle, cellSet, result); dispatcher.Invoke(this->InputHandle, cellSet, result);
//result.SyncControlArray();
return timer.GetElapsedTime(); return timer.GetElapsedTime();
} }
...@@ -331,8 +330,8 @@ private: ...@@ -331,8 +330,8 @@ private:
Timer timer; Timer timer;
vtkm::worklet::DispatcherMapTopology<AveragePointToCell> dispatcher; vtkm::worklet::DispatcherMapTopology<AveragePointToCell> dispatcher;
dispatcher.SetDevice(DeviceAdapterTag());
dispatcher.Invoke(dinput, cellSet, result); dispatcher.Invoke(dinput, cellSet, result);
//result.SyncControlArray();
return timer.GetElapsedTime(); return timer.GetElapsedTime();
} }
...@@ -379,8 +378,8 @@ private: ...@@ -379,8 +378,8 @@ private:
Classification<Value> worklet(this->IsoValue); Classification<Value> worklet(this->IsoValue);
vtkm::worklet::DispatcherMapTopology<Classification<Value>> dispatcher(worklet); vtkm::worklet::DispatcherMapTopology<Classification<Value>> dispatcher(worklet);
dispatcher.SetDevice(DeviceAdapterTag());
dispatcher.Invoke(dinput, cellSet, result); dispatcher.Invoke(dinput, cellSet, result);
//result.SyncControlArray();
return timer.GetElapsedTime(); return timer.GetElapsedTime();
} }
...@@ -413,8 +412,8 @@ private: ...@@ -413,8 +412,8 @@ private:
Classification<Value> worklet(this->IsoValue); Classification<Value> worklet(this->IsoValue);
vtkm::worklet::DispatcherMapTopology<Classification<Value>> dispatcher(worklet); vtkm::worklet::DispatcherMapTopology<Classification<Value>> dispatcher(worklet);
dispatcher.SetDevice(DeviceAdapterTag());
dispatcher.Invoke(this->InputHandle, cellSet, result); dispatcher.Invoke(this->InputHandle, cellSet, result);
//result.SyncControlArray();
return timer.GetElapsedTime(); return timer.GetElapsedTime();
} }
...@@ -497,6 +496,9 @@ int main(int argc, char* argv[]) ...@@ -497,6 +496,9 @@ int main(int argc, char* argv[])
} }
//now actually execute the benchmarks //now actually execute the benchmarks
return vtkm::benchmarking::BenchmarkTopologyAlgorithms<VTKM_DEFAULT_DEVICE_ADAPTER_TAG>::Run( using Device = VTKM_DEFAULT_DEVICE_ADAPTER_TAG;
benchmarks); auto tracker = vtkm::cont::GetGlobalRuntimeDeviceTracker();
tracker.ForceDevice(Device{});
return vtkm::benchmarking::BenchmarkTopologyAlgorithms<Device>::Run(benchmarks);
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment