Updates will be applied - 3:30pm EDT (UTC -400). No downtime expected.

Commit 7a2ef646 authored by Kenneth Moreland's avatar Kenneth Moreland

Correct the implementation of DeviceAdapterAlgorithmGeneral::Unique

The implementation of the simplified version of
DeviceAdapterAlgorithmGeneral::Unique had two errors.

First, the implementation is such that it calls the more complex version
of Unique (which specifies a binary predicate to establish equality).
However, it was not calling the Unique method in the DerivedAlgorithm
like it should have been. Instead, it was calling its own Unique
algorithm, which might not be as efficient as the specialized Unique for
the device.

Second, it was using std::equal_to as its binary predicate. Using
functors from std can be dangerous because they are not marked with
VTKM_EXEC, so have the potential to not work in the execution
environment. Instead, use the readily available vtkm::Equal binary
parent ef6a3b82
......@@ -32,6 +32,7 @@
#include <vtkm/exec/internal/ErrorMessageBuffer.h>
#include <vtkm/exec/internal/TaskSingular.h>
#include <vtkm/BinaryPredicates.h>
#include <vtkm/TypeTraits.h>
#include <vtkm/internal/Windows.h>
......@@ -759,7 +760,7 @@ public:
template <typename T, class Storage>
VTKM_CONT static void Unique(vtkm::cont::ArrayHandle<T, Storage>& values)
Unique(values, std::equal_to<T>());
DerivedAlgorithm::Unique(values, vtkm::Equal());
template <typename T, class Storage, class BinaryCompare>
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment