Commit 32f3fa6d authored by Chun-Ming Chen's avatar Chun-Ming Chen
Browse files

Fix unmerged codes from the previous merge. Use multiply in customed operator ReduceByKey test

parent 4d9c25de
......@@ -583,11 +583,15 @@ private:
//need too handle how we are going to add two numbers together
//based on the keyStates that they have
//need to optimize this logic, we can use a bit mask to determine
//the secondary value.
#if 1 // Make it work for parallel inclusive scan. Will end up with all start bits = 1
if (!b.second.fStart) // is b is not START, then it's safe to add. Propagate a's start flag to b
return ReturnType(a.first + b.first, ReduceKeySeriesStates(a.second.fStart, b.second.fEnd));
// the following logic should change if you use a different parallel scan algorithm.
if (!b.second.fStart) {
// if b is not START, then it's safe to sum a & b.
// Propagate a's start flag to b
// so that later when b's START bit is set, it means there must exists a START between a and b
return ReturnType(this->BinaryFunctor(a.first , b.first),
ReduceKeySeriesStates(a.second.fStart, b.second.fEnd));
}
return b;
#else // Works only for sequencial scan
if(a.second == States::START && b.second == States::END)
......
......@@ -1090,7 +1090,7 @@ private:
vtkm::Id expectedKeys[expectedLength] = { 0};
vtkm::Vec<vtkm::Float64, 3> expectedValues[expectedLength];
expectedValues[0] = vtkm::make_Vec(16.2, 16.6, 15.);
expectedValues[0] = vtkm::make_Vec(27.51, 30.59, -33.75);
IdArrayHandle keys = MakeArrayHandle(inputKeys, inputLength);
vtkm::cont::ArrayHandle<vtkm::Vec<vtkm::Float64, 3>, StorageTag> values = MakeArrayHandle(inputValues, inputLength);
......@@ -1101,7 +1101,7 @@ private:
values,
keysOut,
valuesOut,
vtkm::internal::Subtract() );
vtkm::internal::Multiply() );
VTKM_TEST_ASSERT(keysOut.GetNumberOfValues() == expectedLength,
"Got wrong number of output keys");
......@@ -1174,8 +1174,6 @@ private:
VTKM_TEST_ASSERT( expectedKeys[i] == k, "Incorrect reduced key");
VTKM_TEST_ASSERT( expectedValues1[i] == v.first, "Incorrect reduced value1");
VTKM_TEST_ASSERT( expectedValues2[i] == v.second, "Incorrect reduced value2");
VTKM_TEST_ASSERT( expectedValues1[i] == v.first, "Incorrect reduced vale");
VTKM_TEST_ASSERT( expectedValues2[i] == v.second, "Incorrect reduced vale");
}
}
......
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