mirror of
https://gitlab.kitware.com/vtk/vtk-m
synced 2024-09-16 17:22:55 +00:00
Fixed an issue with copying array from a disabled device
The internal array copy has an optimization to use the device the array exists on to do the copy. However, if that device is disabled the copy would fail. This problem has been fixed.
This commit is contained in:
parent
61f123be22
commit
b6e61f9447
5
docs/changelog/copy-from-disabled-device.md
Normal file
5
docs/changelog/copy-from-disabled-device.md
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
# Fix an issue with copying array from a disabled device
|
||||||
|
|
||||||
|
The internal array copy has an optimization to use the device the array
|
||||||
|
exists on to do the copy. However, if that device is disabled the copy
|
||||||
|
would fail. This problem has been fixed.
|
@ -52,7 +52,8 @@ struct UnknownCopyOnDevice
|
|||||||
// by pulling out one of the component arrays and querying that.
|
// by pulling out one of the component arrays and querying that.
|
||||||
if (!this->Called &&
|
if (!this->Called &&
|
||||||
((device == vtkm::cont::DeviceAdapterTagAny{}) ||
|
((device == vtkm::cont::DeviceAdapterTagAny{}) ||
|
||||||
(in.GetComponentArray(0).IsOnDevice(device))))
|
(in.GetComponentArray(0).IsOnDevice(device) &&
|
||||||
|
vtkm::cont::GetRuntimeDeviceTracker().CanRunOn(device))))
|
||||||
{
|
{
|
||||||
vtkm::cont::Invoker invoke(device);
|
vtkm::cont::Invoker invoke(device);
|
||||||
invoke(CopyWorklet{}, in, out);
|
invoke(CopyWorklet{}, in, out);
|
||||||
|
@ -199,6 +199,24 @@ void TryCopy()
|
|||||||
TestValues(input, output);
|
TestValues(input, output);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
std::cout << "unknown -> basic (different type, unsupported device)" << std::endl;
|
||||||
|
// Force the source to be on the Serial device. If the --vtkm-device argument was
|
||||||
|
// given with a different device (which is how ctest is set up if compiled with
|
||||||
|
// any device), then Serial will be turned off.
|
||||||
|
using SourceType = typename VTraits::template ReplaceComponentType<vtkm::UInt8>;
|
||||||
|
auto rawInput = MakeInputArray<SourceType>();
|
||||||
|
{
|
||||||
|
// Force moving the data to the Serial device.
|
||||||
|
vtkm::cont::Token token;
|
||||||
|
rawInput.PrepareForInput(vtkm::cont::DeviceAdapterTagSerial{}, token);
|
||||||
|
}
|
||||||
|
vtkm::cont::UnknownArrayHandle input = rawInput;
|
||||||
|
vtkm::cont::ArrayHandle<ValueType> output;
|
||||||
|
vtkm::cont::ArrayCopy(input, output);
|
||||||
|
TestValues(input, output);
|
||||||
|
}
|
||||||
|
|
||||||
// Test the copy methods in UnknownArrayHandle. Although this would be appropriate in
|
// Test the copy methods in UnknownArrayHandle. Although this would be appropriate in
|
||||||
// UnitTestUnknownArrayHandle, it is easier to test copies here.
|
// UnitTestUnknownArrayHandle, it is easier to test copies here.
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user