Device Class
2.1 Basic Information
Class:
HEaaN::Device
Purpose: Unified management of CPU and GPU devices
2.2 API Reference
2.2.1 Constructors
Function: Creates a device object
Usage Example:
device_id
is only allowed to use 0
.
2.2.2 Device Information Retrieval
Function: Retrieves device type and ID
Usage Example:
2.2.3 Device Comparison
Function: Device object comparison
Usage Example:
2.3 Utility Functions
2.3.1 Default Device
Function: Returns the default CPU device.
Return Value: Device object of CPU type
2.3.2 CUDA Device Management
Functions: Retrieves and sets the current CUDA device
Usage Example:
2.4 ScopedCudaDeviceSelector
This class is used when allocating memory for different devices in a multi-GPU environment.
Within a specific scope, it stores the previous device, sets a new device, and then reverts back to the previous device when exiting that scope.
Last updated
Was this helpful?