From f9d9b536d44e36b8f3d28cac88bc4859bd2b027d Mon Sep 17 00:00:00 2001 From: Kenneth Moreland Date: Thu, 14 May 2020 17:16:19 -0600 Subject: [PATCH] Fix conversion warnings in benchmarks and examples These are caused when using 32-bit Id's. Although there are some benchmarks that test for this, some code in benchmarking and examples is not covered by them. --- benchmarking/BenchmarkDeviceAdapter.cxx | 34 +++++++++---------- .../contour_tree_augmented/ContourTreeApp.cxx | 2 +- 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/benchmarking/BenchmarkDeviceAdapter.cxx b/benchmarking/BenchmarkDeviceAdapter.cxx index 637a91982..453ce57ff 100644 --- a/benchmarking/BenchmarkDeviceAdapter.cxx +++ b/benchmarking/BenchmarkDeviceAdapter.cxx @@ -404,7 +404,7 @@ template void BenchCopy(benchmark::State& state) { const vtkm::cont::DeviceAdapterId device = Config.Device; - const vtkm::Id numBytes = state.range(0); + const vtkm::Id numBytes = static_cast(state.range(0)); const vtkm::Id numValues = BytesToWords(numBytes); state.SetLabel(SizeAndValuesString(numBytes, numValues)); @@ -580,7 +580,7 @@ template void BenchFillArrayHandle(benchmark::State& state) { const vtkm::cont::DeviceAdapterId device = Config.Device; - const vtkm::Id numBytes = state.range(0); + const vtkm::Id numBytes = static_cast(state.range(0)); const vtkm::Id numValues = BytesToWords(numBytes); state.SetLabel(SizeAndValuesString(numBytes, numValues)); @@ -610,7 +610,7 @@ VTKM_BENCHMARK_TEMPLATES_OPTS(BenchFillArrayHandle, void BenchFillBitFieldBool(benchmark::State& state) { const vtkm::cont::DeviceAdapterId device = Config.Device; - const vtkm::Id numBytes = state.range(0); + const vtkm::Id numBytes = static_cast(state.range(0)); const vtkm::Id numBits = numBytes * CHAR_BIT; const bool value = state.range(1) != 0; @@ -640,7 +640,7 @@ template void BenchFillBitFieldMask(benchmark::State& state) { const vtkm::cont::DeviceAdapterId device = Config.Device; - const vtkm::Id numBytes = state.range(0); + const vtkm::Id numBytes = static_cast(state.range(0)); const vtkm::Id numBits = numBytes * CHAR_BIT; const WordType mask = static_cast(0x1); @@ -717,7 +717,7 @@ template void BenchReduce(benchmark::State& state) { const vtkm::cont::DeviceAdapterId device = Config.Device; - const vtkm::Id numBytes = state.range(0); + const vtkm::Id numBytes = static_cast(state.range(0)); const vtkm::Id numValues = BytesToWords(numBytes); state.SetLabel(SizeAndValuesString(numBytes, numValues)); @@ -752,10 +752,10 @@ void BenchReduceByKey(benchmark::State& state) { const vtkm::cont::DeviceAdapterId device = Config.Device; - const vtkm::Id numBytes = state.range(0); + const vtkm::Id numBytes = static_cast(state.range(0)); const vtkm::Id numValues = BytesToWords(numBytes); - const vtkm::Id percentKeys = state.range(1); + const vtkm::Id percentKeys = static_cast(state.range(1)); const vtkm::Id numKeys = std::max((numValues * percentKeys) / 100, vtkm::Id{ 1 }); { @@ -807,7 +807,7 @@ template void BenchScanExclusive(benchmark::State& state) { const vtkm::cont::DeviceAdapterId device = Config.Device; - const vtkm::Id numBytes = state.range(0); + const vtkm::Id numBytes = static_cast(state.range(0)); const vtkm::Id numValues = BytesToWords(numBytes); state.SetLabel(SizeAndValuesString(numBytes, numValues)); @@ -841,7 +841,7 @@ template void BenchScanExtended(benchmark::State& state) { const vtkm::cont::DeviceAdapterId device = Config.Device; - const vtkm::Id numBytes = state.range(0); + const vtkm::Id numBytes = static_cast(state.range(0)); const vtkm::Id numValues = BytesToWords(numBytes); state.SetLabel(SizeAndValuesString(numBytes, numValues)); @@ -875,7 +875,7 @@ template void BenchScanInclusive(benchmark::State& state) { const vtkm::cont::DeviceAdapterId device = Config.Device; - const vtkm::Id numBytes = state.range(0); + const vtkm::Id numBytes = static_cast(state.range(0)); const vtkm::Id numValues = BytesToWords(numBytes); state.SetLabel(SizeAndValuesString(numBytes, numValues)); @@ -909,7 +909,7 @@ template void BenchSort(benchmark::State& state) { const vtkm::cont::DeviceAdapterId device = Config.Device; - const vtkm::Id numBytes = state.range(0); + const vtkm::Id numBytes = static_cast(state.range(0)); const vtkm::Id numValues = BytesToWords(numBytes); state.SetLabel(SizeAndValuesString(numBytes, numValues)); @@ -950,7 +950,7 @@ void BenchSortByKey(benchmark::State& state) const vtkm::Id numBytes = static_cast(state.range(0)); const vtkm::Id numValues = BytesToWords(numBytes); - const vtkm::Id percentKeys = state.range(1); + const vtkm::Id percentKeys = static_cast(state.range(1)); const vtkm::Id numKeys = std::max((numValues * percentKeys) / 100, vtkm::Id{ 1 }); { @@ -1005,7 +1005,7 @@ template void BenchStableSortIndices(benchmark::State& state) { const vtkm::cont::DeviceAdapterId device = Config.Device; - const vtkm::Id numBytes = state.range(0); + const vtkm::Id numBytes = static_cast(state.range(0)); const vtkm::Id numValues = BytesToWords(numBytes); state.SetLabel(SizeAndValuesString(numBytes, numValues)); @@ -1042,10 +1042,10 @@ template void BenchStableSortIndicesUnique(benchmark::State& state) { const vtkm::cont::DeviceAdapterId device = Config.Device; - const vtkm::Id numBytes = state.range(0); + const vtkm::Id numBytes = static_cast(state.range(0)); const vtkm::Id numValues = BytesToWords(numBytes); - const vtkm::Id percentUnique = state.range(1); + const vtkm::Id percentUnique = static_cast(state.range(1)); const vtkm::Id numUnique = std::max((numValues * percentUnique) / 100, vtkm::Id{ 1 }); { @@ -1105,10 +1105,10 @@ template void BenchUnique(benchmark::State& state) { const vtkm::cont::DeviceAdapterId device = Config.Device; - const vtkm::Id numBytes = state.range(0); + const vtkm::Id numBytes = static_cast(state.range(0)); const vtkm::Id numValues = BytesToWords(numBytes); - const vtkm::Id percentUnique = state.range(1); + const vtkm::Id percentUnique = static_cast(state.range(1)); const vtkm::Id numUnique = std::max((numValues * percentUnique) / 100, vtkm::Id{ 1 }); { diff --git a/examples/contour_tree_augmented/ContourTreeApp.cxx b/examples/contour_tree_augmented/ContourTreeApp.cxx index a0037977e..056625c1f 100644 --- a/examples/contour_tree_augmented/ContourTreeApp.cxx +++ b/examples/contour_tree_augmented/ContourTreeApp.cxx @@ -130,7 +130,7 @@ public: } else { - return (it - this->mCLOptions.begin()); + return static_cast(it - this->mCLOptions.begin()); } }