Commit 02db46b2 authored by Nickolas Davis's avatar Nickolas Davis 🥑 Committed by Kitware Robot

Merge topic 'ipx-iris-fix-warnings'

843307bc fix floating point casting warning in worklet test
18263a37 update float casting to not have warnings on iris
89cf93a6 fix OpenMP PRAGMA warnings for auto-associated looping variable types
Acked-by: Kitware Robot's avatarKitware Robot <kwrobot@kitware.com>
Merge-request: !2245
parents 06579aac 843307bc
......@@ -379,9 +379,9 @@ struct ReduceHelper
// This gives faster code for floats and non-trivial types.
template <typename ReturnType, typename IterType, typename FunctorType>
static ReturnType DoParallelReduction(IterType data,
vtkm::Id numVals,
int tid,
int numThreads,
const vtkm::Id& numVals,
const int& tid,
const int& numThreads,
FunctorType f,
std::false_type /* isIntegral */)
{
......@@ -389,18 +389,24 @@ struct ReduceHelper
ReturnType accum = f(data[2 * tid], data[2 * tid + 1]);
const vtkm::Id offset = numThreads * 2;
const vtkm::Id end = std::max(vtkm::Id(((numVals / 4) * 4) - 4), offset);
const vtkm::Id end = std::max(((numVals / 4) * 4) - 4, offset);
const vtkm::Id unrollEnd = end - ((end - offset) % 4);
vtkm::Id i = offset;
// When initializing the looping iterator to a non integral type, intel compilers will
// convert the iterator type to an unsigned value
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wsign-conversion"
VTKM_OPENMP_DIRECTIVE(for schedule(static))
for (i = offset; i < unrollEnd; i += 4)
#pragma GCC diagnostic pop
{
const auto t1 = f(data[i], data[i + 1]);
const auto t2 = f(data[i + 2], data[i + 3]);
accum = f(accum, t1);
accum = f(accum, t2);
}
// Let the last thread mop up any remaining values as it would
// have just accessed the adjacent data
if (tid == numThreads - 1)
......@@ -418,18 +424,21 @@ struct ReduceHelper
// hurt performance.
template <typename ReturnType, typename IterType, typename FunctorType>
static ReturnType DoParallelReduction(IterType data,
vtkm::Id numVals,
int tid,
int numThreads,
const vtkm::Id& numVals,
const int& tid,
const int& numThreads,
FunctorType f,
std::true_type /* isIntegral */)
{
// Use the first (numThreads*2) values for initializing:
ReturnType accum = f(data[2 * tid], data[2 * tid + 1]);
// Assign each thread chunks of the remaining values for local reduction
// Assign each thread chunks of the remaining values for local reduction
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wsign-conversion"
VTKM_OPENMP_DIRECTIVE(for schedule(static))
for (vtkm::Id i = numThreads * 2; i < numVals; i++)
#pragma GCC diagnostic pop
{
accum = f(accum, data[i]);
}
......
......@@ -308,11 +308,18 @@ struct ComputePass4X : public vtkm::worklet::WorkletVisitCellsWithPoints
{
return vtkm::Vec3f(
this->Origin[0] +
this->Spacing[0] * static_cast<vtkm::FloatDefault>(ijk0[0] + t * (ijk1[0] - ijk0[0])),
this->Spacing[0] *
(static_cast<vtkm::FloatDefault>(ijk0[0]) +
static_cast<vtkm::FloatDefault>(t) * static_cast<vtkm::FloatDefault>(ijk1[0] - ijk0[0])),
this->Origin[1] +
this->Spacing[1] * static_cast<vtkm::FloatDefault>(ijk0[1] + t * (ijk1[1] - ijk0[1])),
this->Spacing[1] *
(static_cast<vtkm::FloatDefault>(ijk0[1]) +
static_cast<vtkm::FloatDefault>(t) * static_cast<vtkm::FloatDefault>(ijk1[1] - ijk0[1])),
this->Origin[2] +
this->Spacing[2] * static_cast<vtkm::FloatDefault>(ijk0[2] + t * (ijk1[2] - ijk0[2])));
this->Spacing[2] *
(static_cast<vtkm::FloatDefault>(ijk0[2]) +
static_cast<vtkm::FloatDefault>(t) *
static_cast<vtkm::FloatDefault>(ijk1[2] - ijk0[2])));
}
};
}
......
......@@ -354,11 +354,18 @@ struct ComputePass4XWithNormals : public vtkm::worklet::WorkletVisitCellsWithPoi
{
return vtkm::Vec3f(
this->Origin[0] +
this->Spacing[0] * static_cast<vtkm::FloatDefault>(ijk0[0] + t * (ijk1[0] - ijk0[0])),
this->Spacing[0] *
(static_cast<vtkm::FloatDefault>(ijk0[0]) +
static_cast<vtkm::FloatDefault>(t) * static_cast<vtkm::FloatDefault>(ijk1[0] - ijk0[0])),
this->Origin[1] +
this->Spacing[1] * static_cast<vtkm::FloatDefault>(ijk0[1] + t * (ijk1[1] - ijk0[1])),
this->Spacing[1] *
(static_cast<vtkm::FloatDefault>(ijk0[1]) +
static_cast<vtkm::FloatDefault>(t) * static_cast<vtkm::FloatDefault>(ijk1[1] - ijk0[1])),
this->Origin[2] +
this->Spacing[2] * static_cast<vtkm::FloatDefault>(ijk0[2] + t * (ijk1[2] - ijk0[2])));
this->Spacing[2] *
(static_cast<vtkm::FloatDefault>(ijk0[2]) +
static_cast<vtkm::FloatDefault>(t) *
static_cast<vtkm::FloatDefault>(ijk1[2] - ijk0[2])));
}
//----------------------------------------------------------------------------
......
......@@ -192,7 +192,7 @@ void TestVarianceProperty()
{
condition_number_kv += vtkm::Abs(rp.Get(i) - mean_kv) * vtkm::Abs(rp.Get(i));
}
condition_number_kv *= (2.0f / ((rp.GetNumberOfValues() - 1) * var_kv));
condition_number_kv *= (2.0f / (static_cast<float>(rp.GetNumberOfValues() - 1) * var_kv));
VTKM_TEST_ASSERT(test_equal(var_kv,
4.0 * 4.0 * var_v,
condition_number_kv * std::numeric_limits<vtkm::Float32>::epsilon()));
......@@ -210,7 +210,7 @@ void TestVarianceProperty()
{
condition_number_v += vtkm::Abs(rp.Get(i) - mean_v) * vtkm::Abs(rp.Get(i));
}
condition_number_v *= (2.0f / ((rp.GetNumberOfValues() - 1) * var_v));
condition_number_v *= (2.0f / (static_cast<float>(rp.GetNumberOfValues() - 1) * var_v));
VTKM_TEST_ASSERT(
test_equal(var_v, var_px, condition_number_v * std::numeric_limits<vtkm::Float32>::epsilon()));
......
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