Commit ab10ff3b authored by Allison Vacanti's avatar Allison Vacanti Committed by Kitware Robot

Merge topic 'warning_fix'

40441e78 Fix some additional warnings.
a90afa5a Clean up warnings introduced by recent benchmark modifications.
Acked-by: Kitware Robot's avatarKitware Robot <kwrobot@kitware.com>
Merge-request: !976
parents 31a518be 40441e78
......@@ -83,9 +83,8 @@ struct MeasureCopySpeed
vtkm::UInt64 actualSize =
static_cast<vtkm::UInt64>(this->Source.GetNumberOfValues() * sizeof(ValueType));
std::ostringstream out;
out << "Copying " << HumanSize(static_cast<vtkm::Float64>(this->NumBytes))
<< " (actual=" << HumanSize(static_cast<vtkm::Float64>(actualSize)) << ") of "
<< vtkm::testing::TypeName<ValueType>::Name() << "\n";
out << "Copying " << HumanSize(this->NumBytes) << " (actual=" << HumanSize(actualSize)
<< ") of " << vtkm::testing::TypeName<ValueType>::Name() << "\n";
return out.str();
}
};
......@@ -123,15 +122,15 @@ void BenchmarkValueType()
try
{
bench.GatherSamples(functor);
vtkm::Float64 speed = static_cast<vtkm::Float64>(size) / stats::Mean(bench.GetSamples());
vtkm::UInt64 speed = static_cast<vtkm::UInt64>(size / stats::Mean(bench.GetSamples()));
speedStr = HumanSize(speed) + std::string("/s");
}
catch (vtkm::cont::ErrorBadAllocation& e)
catch (vtkm::cont::ErrorBadAllocation&)
{
speedStr = "[allocation too large]";
}
PrintRow(std::cout, HumanSize(static_cast<vtkm::Float64>(size)), speedStr);
PrintRow(std::cout, HumanSize(size), speedStr);
}
std::cout << "\n";
......
......@@ -1252,7 +1252,7 @@ int main(int argc, char* argv[])
else if (arg == "typelist")
{
++i;
std::string arg = argv[i];
arg = argv[i];
std::transform(arg.begin(), arg.end(), arg.begin(), ::tolower);
if (arg == "base")
{
......@@ -1271,7 +1271,7 @@ int main(int argc, char* argv[])
else if (arg == "fixbytes")
{
++i;
std::string arg = argv[i];
arg = argv[i];
std::transform(arg.begin(), arg.end(), arg.begin(), ::tolower);
if (arg == "off")
{
......@@ -1287,7 +1287,7 @@ int main(int argc, char* argv[])
else if (arg == "fixsizes")
{
++i;
std::string arg = argv[i];
arg = argv[i];
std::transform(arg.begin(), arg.end(), arg.begin(), ::tolower);
if (arg == "off")
{
......
......@@ -168,7 +168,7 @@ inline vtkm::Vec<FloatDefault, 3> Box::Gradient(const vtkm::Vec<FloatDefault, 3>
FloatDefault dist = 0.0;
FloatDefault minDist = vtkm::Infinity32();
vtkm::Vec<vtkm::IdComponent, 3> location;
vtkm::Vec<FloatDefault, 3> normal;
vtkm::Vec<FloatDefault, 3> normal(FloatDefault(0));
vtkm::Vec<FloatDefault, 3> inside(FloatDefault(0));
vtkm::Vec<FloatDefault, 3> outside(FloatDefault(0));
vtkm::Vec<FloatDefault, 3> center((this->MaxPoint + this->MinPoint) * FloatDefault(0.5));
......
......@@ -87,34 +87,36 @@ struct TemplatedTests
using PairAllocator =
typename StorageType::AllocatorType::template rebind<std::pair<ValueType, ValueType>>::other;
std::vector<ValueType, Allocator> v;
v.push_back(ValueType());
ValueType value = vtkm::TypeTraits<ValueType>::ZeroInitialization();
v.push_back(value);
std::deque<ValueType, Allocator> d;
d.push_front(ValueType());
d.push_front(value);
std::list<ValueType, Allocator> l;
l.push_front(ValueType());
l.push_front(value);
std::set<ValueType, std::less<ValueType>, Allocator> set;
set.insert(ValueType());
set.insert(value);
std::map<ValueType, ValueType, std::less<ValueType>, PairAllocator> m;
m[ValueType()] = ValueType();
m[value] = value;
std::multiset<ValueType, std::less<ValueType>, Allocator> ms;
ms.insert(ValueType());
ms.insert(value);
std::multimap<ValueType, ValueType, std::less<ValueType>, PairAllocator> mm;
mm.insert(std::pair<ValueType, ValueType>(ValueType(), ValueType()));
mm.insert(std::pair<ValueType, ValueType>(value, value));
std::stack<ValueType, std::deque<ValueType, Allocator>> stack;
stack.push(ValueType());
stack.push(value);
std::queue<ValueType, std::deque<ValueType, Allocator>> queue;
queue.push(ValueType());
queue.push(value);
std::priority_queue<ValueType, std::vector<ValueType, Allocator>> pqueue;
pqueue.push(ValueType());
pqueue.push(value);
}
/// Returned value should later be passed to StealArray2. It is best to
......
......@@ -277,7 +277,7 @@ VTKM_EXEC vtkm::Vec<FieldType, 3> CellDerivativeFor2DCellFinish(
using FieldTraits = vtkm::VecTraits<FieldType>;
using FieldComponentType = typename FieldTraits::ComponentType;
vtkm::Vec<FieldType, 3> gradient;
vtkm::Vec<FieldType, 3> gradient(vtkm::TypeTraits<FieldType>::ZeroInitialization());
for (vtkm::IdComponent fieldComponent = 0;
fieldComponent < FieldTraits::GetNumberOfComponents(field[0]);
......@@ -484,7 +484,7 @@ VTKM_EXEC vtkm::Vec<FieldType, 3> CellDerivativeLineImpl(
using FieldComponentType = typename FieldTraits::ComponentType;
using GradientType = vtkm::Vec<FieldType, 3>;
GradientType gradient;
GradientType gradient(vtkm::TypeTraits<FieldType>::ZeroInitialization());
for (vtkm::IdComponent fieldComponent = 0;
fieldComponent < FieldTraits::GetNumberOfComponents(deltaField);
fieldComponent++)
......@@ -571,7 +571,7 @@ VTKM_EXEC vtkm::Vec<ValueType, 3> TriangleDerivativeFinish(
using FieldTraits = vtkm::VecTraits<ValueType>;
using FieldComponentType = typename FieldTraits::ComponentType;
vtkm::Vec<ValueType, 3> gradient;
vtkm::Vec<ValueType, 3> gradient(vtkm::TypeTraits<ValueType>::ZeroInitialization());
for (vtkm::IdComponent fieldComponent = 0;
fieldComponent < FieldTraits::GetNumberOfComponents(field[0]);
......@@ -872,7 +872,7 @@ VTKM_EXEC vtkm::Vec<ValueType, 3> TetraDerivativeFinish(
using FieldTraits = vtkm::VecTraits<ValueType>;
using FieldComponentType = typename FieldTraits::ComponentType;
vtkm::Vec<ValueType, 3> gradient;
vtkm::Vec<ValueType, 3> gradient(vtkm::TypeTraits<ValueType>::ZeroInitialization());
for (vtkm::IdComponent fieldComponent = 0;
fieldComponent < FieldTraits::GetNumberOfComponents(field[0]);
......
......@@ -630,43 +630,48 @@ static inline VTKM_CONT bool test_equal_portals(const PortalType1& portal1,
}
/// Convert a size in bytes to a human readable string (e.g. "64 bytes",
/// "1.44 MiB", "128 GiB", etc)
static inline VTKM_CONT std::string HumanSize(vtkm::Float64 bytes)
/// "1.44 MiB", "128 GiB", etc). @a prec controls the fixed point precision
/// of the stringified number.
static inline VTKM_CONT std::string HumanSize(vtkm::UInt64 bytes, int prec = 2)
{
std::string suffix = "bytes";
if (bytes >= 1024.)
// Might truncate, but it really doesn't matter unless the precision arg
// is obscenely huge.
vtkm::Float64 bytesf = static_cast<vtkm::Float64>(bytes);
if (bytesf >= 1024.)
{
bytes /= 1024.;
bytesf /= 1024.;
suffix = "KiB";
}
if (bytes >= 1024.)
if (bytesf >= 1024.)
{
bytes /= 1024.;
bytesf /= 1024.;
suffix = "MiB";
}
if (bytes >= 1024.)
if (bytesf >= 1024.)
{
bytes /= 1024.;
bytesf /= 1024.;
suffix = "GiB";
}
if (bytes >= 1024.)
if (bytesf >= 1024.)
{
bytes /= 1024.;
bytesf /= 1024.;
suffix = "TiB";
}
if (bytes >= 1024.)
if (bytesf >= 1024.)
{
bytes /= 1024.;
bytesf /= 1024.;
suffix = "PiB"; // Dream big...
}
std::ostringstream out;
out << std::fixed << std::setprecision(2) << bytes << " " << suffix;
out << std::fixed << std::setprecision(prec) << bytesf << " " << suffix;
return out.str();
}
......
......@@ -915,7 +915,8 @@ void ContourTree<T, StorageType, DeviceAdapter>::CollectSaddlePeak(
DeviceAlgorithm::Copy(tempArray, saddlePeak);
#ifdef DEBUG_PRINT
for (vtkm::UInt32 superarc = 0; superarc < superarcVector.size(); superarc++)
const vtkm::Id arcVecSize = static_cast<vtkm::Id>(superarcVector.size());
for (vtkm::Id superarc = 0; superarc < arcVecSize; superarc++)
{
std::cout << std::setw(PRINT_WIDTH) << saddlePeak.GetPortalControl().Get(superarc).first << " ";
std::cout << std::setw(PRINT_WIDTH) << saddlePeak.GetPortalControl().Get(superarc).second
......
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