Visible to Intel only — GUID: GUID-18E3B4B0-322B-4346-AC3F-68F6E28458F3
Visible to Intel only — GUID: GUID-18E3B4B0-322B-4346-AC3F-68F6E28458F3
Providing a Callback for the Host Application
oneDAL provides a possibility for the host application to register a callback interface to be called by the library, e.g. for the purposes of computation interruption. It is done by means of an abstract interface for the host application of the library HostAppIface. In order to use it, the application should define an instance of the class derived from the abstract interface and set its pointer to an instance of Algorithm class.
Following methods of the Algorithm class are used:
Name |
Description |
---|---|
setHostApp(const services::HostAppIfacePtr& pHost) |
Set pHost as the callback interface |
hostApp() |
Get current value of the callback interface set on the Algorithm |
HostAppIface class includes following methods:
Name |
Description |
---|---|
isCancelled() |
Enables computation cancelling. The method is called by the owning algorithm when computation is in progress. If the method returns true then computation stops and returns ErrorUserCancelled status. Since the method can be called from parallel threads when running with oneDAL threaded version, it is application responsibility to make its implementation thread-safe. It is not recommended for this method to throw exceptions. |
Currently HostAppIface is supported in C++ only, cancelling is available with limited number of algorithms as follows: decision forest, gradient boosted trees.