mirror of
https://gitlab.kitware.com/vtk/vtk-m
synced 2024-09-16 17:22:55 +00:00
Suppress CUDA warning about device calling host
The destructors of some control side objects (such as CellSet and ArrayHandle) are defined. These destructors are obviously only compiled for the control environment (i.e. for CUDA only for the host). However, not all of the subclasses implemented their own destructors. In CUDA, when a default destructor is used, it is compiled for both host and device. This caused a problem as the superclass's destructor was only compiled for the host and therefore caused a warning. Fixed the problem by defining an empty destructor to any subclasses that needed one. It's weird that I ran into this problem while chaning the List TMP class, but the solution seems fine.
This commit is contained in:
parent
851864d0b5
commit
aec75ab1a2
@ -412,6 +412,13 @@ public:
|
|||||||
: Superclass(StorageType(firstArray, secondArray, thirdArray))
|
: Superclass(StorageType(firstArray, secondArray, thirdArray))
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Implemented so that it is defined exclusively in the control environment.
|
||||||
|
/// If there is a separate device for the execution environment (for example,
|
||||||
|
/// with CUDA), then the automatically generated destructor could be
|
||||||
|
/// created for all devices, and it would not be valid for all devices.
|
||||||
|
///
|
||||||
|
~ArrayHandleCartesianProduct() {}
|
||||||
};
|
};
|
||||||
|
|
||||||
/// A convenience function for creating an ArrayHandleCartesianProduct. It takes the two
|
/// A convenience function for creating an ArrayHandleCartesianProduct. It takes the two
|
||||||
|
@ -62,6 +62,13 @@ public:
|
|||||||
this->ValidateTypeCast<typename ArrayHandleType::ValueType>();
|
this->ValidateTypeCast<typename ArrayHandleType::ValueType>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Implemented so that it is defined exclusively in the control environment.
|
||||||
|
/// If there is a separate device for the execution environment (for example,
|
||||||
|
/// with CUDA), then the automatically generated destructor could be
|
||||||
|
/// created for all devices, and it would not be valid for all devices.
|
||||||
|
///
|
||||||
|
~ArrayHandleCast() {}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// Log warnings if type cast is valid but lossy:
|
// Log warnings if type cast is valid but lossy:
|
||||||
template <typename SrcValueType>
|
template <typename SrcValueType>
|
||||||
|
@ -703,6 +703,13 @@ public:
|
|||||||
: Superclass(StorageType(handle, functor, inverseFunctor))
|
: Superclass(StorageType(handle, functor, inverseFunctor))
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Implemented so that it is defined exclusively in the control environment.
|
||||||
|
/// If there is a separate device for the execution environment (for example,
|
||||||
|
/// with CUDA), then the automatically generated destructor could be
|
||||||
|
/// created for all devices, and it would not be valid for all devices.
|
||||||
|
///
|
||||||
|
~ArrayHandleTransform() {}
|
||||||
};
|
};
|
||||||
|
|
||||||
template <typename HandleType, typename FunctorType, typename InverseFunctorType>
|
template <typename HandleType, typename FunctorType, typename InverseFunctorType>
|
||||||
|
@ -48,6 +48,13 @@ public:
|
|||||||
vtkm::internal::ArrayPortalUniformPointCoordinates(dimensions, origin, spacing)))
|
vtkm::internal::ArrayPortalUniformPointCoordinates(dimensions, origin, spacing)))
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Implemented so that it is defined exclusively in the control environment.
|
||||||
|
/// If there is a separate device for the execution environment (for example,
|
||||||
|
/// with CUDA), then the automatically generated destructor could be
|
||||||
|
/// created for all devices, and it would not be valid for all devices.
|
||||||
|
///
|
||||||
|
~ArrayHandleUniformPointCoordinates() {}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
} // namespace vtkm::cont
|
} // namespace vtkm::cont
|
||||||
|
@ -119,6 +119,11 @@ public:
|
|||||||
|
|
||||||
void PrintSummary(std::ostream& out) const override;
|
void PrintSummary(std::ostream& out) const override;
|
||||||
|
|
||||||
|
// Cannot use the default implementation of the destructure because the CUDA compiler
|
||||||
|
// will attempt to create it for device, and then it will fail when it tries to call
|
||||||
|
// the destructor of the superclass.
|
||||||
|
~CellSetStructured() override {}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
InternalsType Structure;
|
InternalsType Structure;
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user