VTK-m  1.8
Public Member Functions | Private Member Functions | Private Attributes | Friends | List of all members
vtkm::cont::RuntimeDeviceTracker Class Reference

RuntimeDeviceTracker is the central location for determining which device adapter will be active for algorithm execution. More...

#include <RuntimeDeviceTracker.h>

Inheritance diagram for vtkm::cont::RuntimeDeviceTracker:
vtkm::cont::ScopedRuntimeDeviceTracker

Public Member Functions

VTKM_CONT ~RuntimeDeviceTracker ()
 
VTKM_CONT bool CanRunOn (DeviceAdapterId deviceId) const
 Returns true if the given device adapter is supported on the current machine. More...
 
VTKM_CONT void ReportAllocationFailure (vtkm::cont::DeviceAdapterId deviceId, const vtkm::cont::ErrorBadAllocation &)
 Report a failure to allocate memory on a device, this will flag the device as being unusable for all future invocations. More...
 
VTKM_CONT void ReportBadDeviceFailure (vtkm::cont::DeviceAdapterId deviceId, const vtkm::cont::ErrorBadDevice &)
 Report a ErrorBadDevice failure and flag the device as unusable. More...
 
VTKM_CONT void ResetDevice (vtkm::cont::DeviceAdapterId deviceId)
 Reset the tracker for the given device. More...
 
VTKM_CONT void Reset ()
 Reset the tracker to its default state for default devices. More...
 
VTKM_CONT void DisableDevice (DeviceAdapterId deviceId)
 Disable the given device. More...
 
VTKM_CONT void ForceDevice (DeviceAdapterId deviceId)
 Disable all devices except the specified one. More...
 
VTKM_CONT void CopyStateFrom (const vtkm::cont::RuntimeDeviceTracker &tracker)
 Copyies the state from the given device. More...
 
VTKM_CONT void PrintSummary (std::ostream &out) const
 

Private Member Functions

VTKM_CONT RuntimeDeviceTracker (detail::RuntimeDeviceTrackerInternals *details, bool reset)
 
VTKM_CONT RuntimeDeviceTracker (const RuntimeDeviceTracker &)=delete
 
VTKM_CONT RuntimeDeviceTrackeroperator= (const RuntimeDeviceTracker &)=delete
 
VTKM_CONT void CheckDevice (vtkm::cont::DeviceAdapterId deviceId) const
 
VTKM_CONT void SetDeviceState (vtkm::cont::DeviceAdapterId deviceId, bool state)
 
VTKM_CONT void LogEnabledDevices () const
 

Private Attributes

detail::RuntimeDeviceTrackerInternals * Internals
 

Friends

struct ScopedRuntimeDeviceTracker
 
VTKM_CONT_EXPORT vtkm::cont::RuntimeDeviceTrackerGetRuntimeDeviceTracker ()
 Get the RuntimeDeviceTracker for the current thread. More...
 

Detailed Description

RuntimeDeviceTracker is the central location for determining which device adapter will be active for algorithm execution.

Many features in VTK-m will attempt to run algorithms on the "best available device." This generally is determined at runtime as some backends require specific hardware, or failures in one device are recorded and that device is disabled.

While vtkm::cont::RunimeDeviceInformation reports on the existence of a device being supported, this tracks on a per-thread basis when worklets fail, why the fail, and will update the list of valid runtime devices based on that information.

Constructor & Destructor Documentation

◆ ~RuntimeDeviceTracker()

VTKM_CONT vtkm::cont::RuntimeDeviceTracker::~RuntimeDeviceTracker ( )

◆ RuntimeDeviceTracker() [1/2]

VTKM_CONT vtkm::cont::RuntimeDeviceTracker::RuntimeDeviceTracker ( detail::RuntimeDeviceTrackerInternals *  details,
bool  reset 
)
private

◆ RuntimeDeviceTracker() [2/2]

VTKM_CONT vtkm::cont::RuntimeDeviceTracker::RuntimeDeviceTracker ( const RuntimeDeviceTracker )
privatedelete

Member Function Documentation

◆ CanRunOn()

VTKM_CONT bool vtkm::cont::RuntimeDeviceTracker::CanRunOn ( DeviceAdapterId  deviceId) const

Returns true if the given device adapter is supported on the current machine.

◆ CheckDevice()

VTKM_CONT void vtkm::cont::RuntimeDeviceTracker::CheckDevice ( vtkm::cont::DeviceAdapterId  deviceId) const
private

◆ CopyStateFrom()

VTKM_CONT void vtkm::cont::RuntimeDeviceTracker::CopyStateFrom ( const vtkm::cont::RuntimeDeviceTracker tracker)

Copyies the state from the given device.

This is a convenient way to allow the RuntimeDeviceTracker on one thread copy the behavior from another thread.

◆ DisableDevice()

VTKM_CONT void vtkm::cont::RuntimeDeviceTracker::DisableDevice ( DeviceAdapterId  deviceId)

Disable the given device.

The main intention of RuntimeDeviceTracker is to keep track of what devices are working for VTK-m. However, it can also be used to turn devices on and off. Use this method to disable (turn off) a given device. Use ResetDevice to turn the device back on (if it is supported).

Passing DeviceAdapterTagAny to this will disable all devices.

◆ ForceDevice()

VTKM_CONT void vtkm::cont::RuntimeDeviceTracker::ForceDevice ( DeviceAdapterId  deviceId)

Disable all devices except the specified one.

The main intention of RuntimeDeviceTracker is to keep track of what devices are working for VTK-m. However, it can also be used to turn devices on and off. Use this method to disable all devices except one to effectively force VTK-m to use that device. Either pass the DeviceAdapterTagAny to this function or call Reset to restore all devices to their default state.

This method will throw a ErrorBadValue if the given device does not exist on the system.

◆ LogEnabledDevices()

VTKM_CONT void vtkm::cont::RuntimeDeviceTracker::LogEnabledDevices ( ) const
private

◆ operator=()

VTKM_CONT RuntimeDeviceTracker& vtkm::cont::RuntimeDeviceTracker::operator= ( const RuntimeDeviceTracker )
privatedelete

◆ PrintSummary()

VTKM_CONT void vtkm::cont::RuntimeDeviceTracker::PrintSummary ( std::ostream &  out) const

◆ ReportAllocationFailure()

VTKM_CONT void vtkm::cont::RuntimeDeviceTracker::ReportAllocationFailure ( vtkm::cont::DeviceAdapterId  deviceId,
const vtkm::cont::ErrorBadAllocation  
)
inline

Report a failure to allocate memory on a device, this will flag the device as being unusable for all future invocations.

◆ ReportBadDeviceFailure()

VTKM_CONT void vtkm::cont::RuntimeDeviceTracker::ReportBadDeviceFailure ( vtkm::cont::DeviceAdapterId  deviceId,
const vtkm::cont::ErrorBadDevice  
)
inline

Report a ErrorBadDevice failure and flag the device as unusable.

◆ Reset()

VTKM_CONT void vtkm::cont::RuntimeDeviceTracker::Reset ( )

Reset the tracker to its default state for default devices.

Will discard any updates caused by reported failures.

◆ ResetDevice()

VTKM_CONT void vtkm::cont::RuntimeDeviceTracker::ResetDevice ( vtkm::cont::DeviceAdapterId  deviceId)

Reset the tracker for the given device.

This will discard any updates caused by reported failures. Passing DeviceAdapterTagAny to this will reset all devices ( same as Reset ).

◆ SetDeviceState()

VTKM_CONT void vtkm::cont::RuntimeDeviceTracker::SetDeviceState ( vtkm::cont::DeviceAdapterId  deviceId,
bool  state 
)
private

Friends And Related Function Documentation

◆ GetRuntimeDeviceTracker

VTKM_CONT_EXPORT vtkm::cont::RuntimeDeviceTracker& GetRuntimeDeviceTracker ( )
friend

Get the RuntimeDeviceTracker for the current thread.

Many features in VTK-m will attempt to run algorithms on the "best available device." This often is determined at runtime as failures in one device are recorded and that device is disabled. To prevent having to check over and over again, VTK-m uses per thread runtime device tracker so that these choices are marked and shared.

◆ ScopedRuntimeDeviceTracker

friend struct ScopedRuntimeDeviceTracker
friend

Member Data Documentation

◆ Internals

detail::RuntimeDeviceTrackerInternals* vtkm::cont::RuntimeDeviceTracker::Internals
private

The documentation for this class was generated from the following file: