VTK-m  1.8
Public Member Functions | Private Attributes | List of all members
vtkm::cont::ScopedRuntimeDeviceTracker Struct Reference

A class that can be used to determine or modify which device adapter VTK-m algorithms should be run on. More...

#include <RuntimeDeviceTracker.h>

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

Public Member Functions

VTKM_CONT ScopedRuntimeDeviceTracker (vtkm::cont::DeviceAdapterId device, RuntimeDeviceTrackerMode mode=RuntimeDeviceTrackerMode::Force)
 Construct a ScopedRuntimeDeviceTracker where the state of the active devices for the current thread are determined by the parameters to the constructor. More...
 
VTKM_CONT ScopedRuntimeDeviceTracker (vtkm::cont::DeviceAdapterId device, RuntimeDeviceTrackerMode mode, const vtkm::cont::RuntimeDeviceTracker &tracker)
 Construct a ScopedRuntimeDeviceTracker associated with the thread associated with the provided tracker. More...
 
VTKM_CONT ScopedRuntimeDeviceTracker (const vtkm::cont::RuntimeDeviceTracker &tracker)
 Construct a ScopedRuntimeDeviceTracker associated with the thread associated with the provided tracker. More...
 
VTKM_CONT ~ScopedRuntimeDeviceTracker ()
 Destructor is not thread safe. More...
 
- Public Member Functions inherited from vtkm::cont::RuntimeDeviceTracker
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 Attributes

std::unique_ptr< detail::RuntimeDeviceTrackerInternals > SavedState
 

Detailed Description

A class that can be used to determine or modify which device adapter VTK-m algorithms should be run on.

This class captures the state of the per-thread device adapter and will revert any changes applied during its lifetime on destruction.

Constructor & Destructor Documentation

◆ ScopedRuntimeDeviceTracker() [1/3]

VTKM_CONT vtkm::cont::ScopedRuntimeDeviceTracker::ScopedRuntimeDeviceTracker ( vtkm::cont::DeviceAdapterId  device,
RuntimeDeviceTrackerMode  mode = RuntimeDeviceTrackerMode::Force 
)

Construct a ScopedRuntimeDeviceTracker where the state of the active devices for the current thread are determined by the parameters to the constructor.

'Force'

  • Force-Enable the provided single device adapter
  • Force-Enable all device adapters when using vtkm::cont::DeviceAdaterTagAny 'Enable'
  • Enable the provided single device adapter if it was previously disabled
  • Enable all device adapters that are currently disabled when using vtkm::cont::DeviceAdaterTagAny 'Disable'
  • Disable the provided single device adapter
  • Disable all device adapters when using vtkm::cont::DeviceAdaterTagAny

Constructor is not thread safe

◆ ScopedRuntimeDeviceTracker() [2/3]

VTKM_CONT vtkm::cont::ScopedRuntimeDeviceTracker::ScopedRuntimeDeviceTracker ( vtkm::cont::DeviceAdapterId  device,
RuntimeDeviceTrackerMode  mode,
const vtkm::cont::RuntimeDeviceTracker tracker 
)

Construct a ScopedRuntimeDeviceTracker associated with the thread associated with the provided tracker.

The active devices for the current thread are determined by the parameters to the constructor.

'Force'

  • Force-Enable the provided single device adapter
  • Force-Enable all device adapters when using vtkm::cont::DeviceAdaterTagAny 'Enable'
  • Enable the provided single device adapter if it was previously disabled
  • Enable all device adapters that are currently disabled when using vtkm::cont::DeviceAdaterTagAny 'Disable'
  • Disable the provided single device adapter
  • Disable all device adapters when using vtkm::cont::DeviceAdaterTagAny

Any modifications to the ScopedRuntimeDeviceTracker will effect what ever thread the tracker is associated with, which might not be the thread which ScopedRuntimeDeviceTracker was constructed on.

Constructor is not thread safe

◆ ScopedRuntimeDeviceTracker() [3/3]

VTKM_CONT vtkm::cont::ScopedRuntimeDeviceTracker::ScopedRuntimeDeviceTracker ( const vtkm::cont::RuntimeDeviceTracker tracker)

Construct a ScopedRuntimeDeviceTracker associated with the thread associated with the provided tracker.

Any modifications to the ScopedRuntimeDeviceTracker will effect what ever thread the tracker is associated with, which might not be the thread which ScopedRuntimeDeviceTracker was constructed on.

Constructor is not thread safe

◆ ~ScopedRuntimeDeviceTracker()

VTKM_CONT vtkm::cont::ScopedRuntimeDeviceTracker::~ScopedRuntimeDeviceTracker ( )

Destructor is not thread safe.

Member Data Documentation

◆ SavedState

std::unique_ptr<detail::RuntimeDeviceTrackerInternals> vtkm::cont::ScopedRuntimeDeviceTracker::SavedState
private

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