Python API reference#
This section describes the ROCm SMI Python module API.
Functions#
- rocm_smi.driverInitialized()#
Returns true if amdgpu is found in the list of initialized modules
- rocm_smi.formatJson(device, log)#
Print out in JSON format
- Parameters:
device – DRM device identifier
log – String to parse and output into JSON format
- rocm_smi.formatCsv(deviceList)#
Print out the JSON_DATA in CSV format
- rocm_smi.formatMatrixToJSON(deviceList, matrix, metricName)#
Format symmetric matrix of GPU permutations to become JSON print-ready.
- Parameters:
deviceList – List of DRM devices (can be a single-item list)
metricName – Title of the item to print to the log
matrix – symmetric matrix full of values of every permutation of DRM devices.
Matrix example:
\[\begin{split}\begin{bmatrix} & GPU0 & GPU1 \\ GPU0 & 0 & 40 \\ GPU1 & 40 & 0 \end{bmatrix}\end{split}\]Where matrix content is: [[0, 40], [40, 0]]
- rocm_smi.getBus(device, silent=False)#
Return the bus identifier of a given device
- Parameters:
device – DRM device identifier
silent – Turn on to silence error output (you plan to handle manually). Default is off.
- rocm_smi.getFanSpeed(device, silent=True)#
Return a tuple with the fan speed (value,%) for a specified device, or (None,None) if either current fan speed or max fan speed cannot be obtained
- Parameters:
device – DRM device identifier
silent – Turn on to silence error output (you plan to handle manually). Default is on.
- rocm_smi.getGpuUse(device, silent=False)#
Return the current GPU usage as a percentage
- Parameters:
device – DRM device identifier
silent – Turn on to silence error output (you plan to handle manually). Default is off.
- rocm_smi.getDRMDeviceId(device, silent=False)#
Return the hexadecimal value of a device’s ID
- Parameters:
device – DRM device identifier
silent – Turn on to silence error output (you plan to handle manually). Default is off.
- rocm_smi.getSubsystemId(device, silent=False)#
Return the a device’s subsystem id
- Parameters:
device – DRM device identifier
silent – Turn on to silence error output (you plan to handle manually). Default is off.
- rocm_smi.getVendor(device, silent=False)#
Return the a device’s vendor id
- Parameters:
device – DRM device identifier
silent – Turn on to silence error output (you plan to handle manually). Default is off.
- rocm_smi.getGUID(device, silent=False)#
Return the uint64 value of device’s GUID, also referred as GPU ID - reported by KFD.
- Parameters:
device – DRM device identifier
silent – Turn on to silence error output (you plan to handle manually). Default is off.
- rocm_smi.getTargetGfxVersion(device, silent=False)#
Return the uint64 value of device’s target graphics version as reported by KFD
- Parameters:
device – DRM device identifier
silent – Turn on to silence error output (you plan to handle manually). Default is off.
- rocm_smi.getNodeId(device, silent=False)#
Return the uint32 value of device’s node id reported by KFD.
- Parameters:
device – DRM device identifier
silent – Turn on to silence error output (you plan to handle manually). Default is off.
- rocm_smi.getDeviceName(device, silent=False)#
- Return the uint64 value of device’s target
graphics version as reported by KFD
- Parameters:
device – DRM device identifier
silent – Turn on to silence error output (you plan to handle manually). Default is off.
- rocm_smi.getRev(device, silent=False)#
Return the hexadecimal value of a device’s Revision
- Parameters:
device – DRM device identifier
silent – Turn on to silence error output (you plan to handle manually). Default is off.
- rocm_smi.getMaxPower(device, silent=False)#
Return the maximum power cap of a given device
- Parameters:
device – DRM device identifier
silent – Turn on to silence error output (you plan to handle manually). Default is off.
- rocm_smi.getMemInfo(device, memType, silent=False)#
- Returns a tuple of (memory_used, memory_total) of
the requested memory type usage for the device specified
- Parameters:
device – DRM device identifier
type – [vram|vis_vram|gtt] Memory type to return
silent – Turn on to silence error output (you plan to handle manually). Default is off, which exposes any issue accessing the different memory types.
- rocm_smi.getProcessName(pid)#
Get the process name of a specific pid
- Parameters:
pid – Process ID of a program to be parsed
- rocm_smi.getPerfLevel(device, silent=False)#
Return the current performance level of a given device
- Parameters:
device – DRM device identifier
silent – Turn on to silence error output (you plan to handle manually). Default is off.
- rocm_smi.getPid(name)#
Get the process id of a specific application
- Parameters:
name – Process name of a program to be parsed
- rocm_smi.getPidList()#
Return a list of KFD process IDs
- rocm_smi.getPower(device)#
- Return dictionary of power responses.
Response power dictionary:
{ 'power': string wattage response or 'N/A' (for not RSMI_STATUS_SUCCESS), 'power_type': power type string - 'Current Socket' or 'Average', 'unit': W (Watt) 'ret': response of rsmi_dev_power_get(device, byref(power), byref(power_type)) }
- Parameters:
device – DRM device identifier
- rocm_smi.getRasEnablement(device, block, silent=True)#
Return RAS enablement state for a given device
- Parameters:
device – DRM device identifier
block – RAS block identifier
silent – Turn on to silence error output (you plan to handle manually). Default is on.
- rocm_smi.getTemp(device, sensor, silent=True)#
Display the current temperature from a given device’s sensor
- Parameters:
device – DRM device identifier
sensor – Temperature sensor identifier
silent – Turn on to silence error output (you plan to handle manually). Default is on.
- rocm_smi.findFirstAvailableTemp(device)#
Discovers the first available device temperature to display
Returns a tuple of (temp_type, temp_value) for the device specified
- Parameters:
device – DRM device identifier
- rocm_smi.getTemperatureLabel(deviceList)#
- Discovers the the first identified power label
Returns a string label value
- Parameters:
device – DRM device identifier
- rocm_smi.getPowerLabel(deviceList)#
Discovers the the first identified power label
Returns a string label value
- Parameters:
device – DRM device identifier
- rocm_smi.getVbiosVersion(device, silent=False)#
Returns the VBIOS version for a given device
- Parameters:
device – DRM device identifier
silent – Turn on to silence error output (you plan to handle manually). Default is off.
- rocm_smi.getVersion(deviceList, component, silent=False)#
Return the software version for the specified component
- Parameters:
deviceList – List of DRM devices (can be a single-item list)
component – Component (currently only driver)
silent – Turn on to silence error output (you plan to handle manually). Default is off.
- rocm_smi.getComputePartition(device, silent=True)#
Return the current compute partition of a given device
- Parameters:
device – DRM device identifier
silent – Turn on to silence error output (you plan to handle manually). Default is on.
- rocm_smi.getMemoryPartition(device, silent=True)#
Return the current memory partition of a given device
- Parameters:
device – DRM device identifier
silent – Turn on to silence error output (you plan to handle manually). Default is on.
- rocm_smi.print2DArray(dataArray)#
Print 2D Array with uniform spacing
- rocm_smi.printEmptyLine()#
Print out a single empty line
- rocm_smi.printErrLog(device, err, is_warning=False)#
Print out an error to the SMI log
- Parameters:
device – DRM device identifier
err – Error string to print
- rocm_smi.printInfoLog(device, metricName, value)#
Print out an info line to the SMI log
- Parameters:
device – DRM device identifier
metricName – Title of the item to print to the log
value – The item’s value to print to the log
- rocm_smi.printEventList(device, delay, eventList)#
Print out notification events for a specified device
- Parameters:
device – DRM device identifier
delay – Notification delay in ms
eventList – List of event type names (can be a single-item list)
- rocm_smi.printLog(device, metricName, value=None, extraSpace=False, useItalics=False, xcp=None)#
Print out to the SMI log
- Parameters:
device – DRM device identifier
metricName – Title of the item to print to the log
value – The item’s value to print to the log
- rocm_smi.printListLog(metricName, valuesList)#
Print out to the SMI log for the lists
- Parameters:
metricName – Title of the item to print to the log
valuesList – The item’s list of values to print to the log
- rocm_smi.printLogSpacer(displayString=None, fill='=', contentSizeToFit=0)#
Prints [name of the option]/[name of the program] in the spacer to explain data below
If no parameters are given, a default fill of the ‘=’ string is used in the spacer
- Parameters:
displayString – name of item to be displayed inside of the log spacer
fill – padding string which surrounds the given display string
contentSizeToFit – providing an integer > 0 allows ability to dynamically change output padding/fill based on this value instead of appWidth. Handy for concise info output.
- rocm_smi.printSysLog(SysComponentName, value)#
Print out to the SMI log for repeated features
- Parameters:
SysComponentName – Title of the item to print to the log
value – The item’s value to print to the log
- rocm_smi.printTableLog(column_headers, data_matrix, device=None, tableName=None, anchor='>', v_delim=' ')#
Print out to the SMI log for the lists
- Parameters:
column_headers – Header names for each column
data_matrix – Matrix of values
device – DRM device identifier
tableName – Title of the table to print to the log
anchor – Alignment direction of the print output
v_delim – Boundary String delimiter for the print output
- rocm_smi.printTableRow(space, displayString, v_delim=' ')#
Print out a line of a matrix table
- Parameters:
space – The item’s spacing to print
displayString – The item’s value to print
v_delim – Boundary String delimiter for the print output
- rocm_smi.checkIfSecondaryDie(device)#
Checks if GCD(die) is the secondary die in a MCM. MI200 device specific feature check. The secondary dies lacks power management features.
- Parameters:
device – The device to check
- rocm_smi.resetClocks(deviceList)#
Reset clocks to default
Reset clocks to default values by setting performance level to auto, as well as setting OverDrive back to 0
- Parameters:
deviceList – List of DRM devices (can be a single-item list)
- rocm_smi.resetFans(deviceList)#
Reset fans to driver control for a list of devices.
- Parameters:
deviceList – List of DRM devices (can be a single-item list)
- rocm_smi.resetPowerOverDrive(deviceList, autoRespond)#
Reset Power OverDrive to the default value
- Parameters:
deviceList – List of DRM devices (can be a single-item list)
- rocm_smi.resetProfile(deviceList)#
Reset profile for a list of a devices.
- Parameters:
deviceList – List of DRM devices (can be a single-item list)
- rocm_smi.resetXgmiErr(deviceList)#
Reset the XGMI Error value
- Parameters:
deviceList – Reset XGMI error count for these devices
- rocm_smi.resetPerfDeterminism(deviceList)#
Reset Performance Determinism
- Parameters:
deviceList – Disable Performance Determinism for these devices
- rocm_smi.setClockRange(deviceList, clkType, minvalue, maxvalue, autoRespond)#
Set the range for the specified clktype in the PowerPlay table for a list of devices.
- Parameters:
deviceList – List of DRM devices (can be a single-item list)
clktype – [sclk|mclk] Which clock type to apply the range to
minvalue – Minimum value to apply to the clock range
maxvalue – Maximum value to apply to the clock range
autoRespond – Response to automatically provide for all prompts
- rocm_smi.setClockExtremum(deviceList, level, clkType, clkValue, autoRespond)#
Set the range for the specified clktype in the PowerPlay table for a list of devices.
- Parameters:
deviceList – List of DRM devices (can be a single-item list)
level – [min|max] Minimum value or Maximum value
clktype – [sclk|mclk] Which clock type to apply the range to
clkValue – clock value to apply to the level
autoRespond – Response to automatically provide for all prompts
- rocm_smi.setVoltageCurve(deviceList, point, clk, volt, autoRespond)#
Set voltage curve for a point in the PowerPlay table for a list of devices.
- Parameters:
deviceList – List of DRM devices (can be a single-item list)
point – Point on the voltage curve to modify
clk – Clock speed specified for this curve point
volt – Voltage specified for this curve point
autoRespond – Response to automatically provide for all prompts
- rocm_smi.setPowerPlayTableLevel(deviceList, clkType, point, clk, volt, autoRespond)#
Set clock frequency and voltage for a level in the PowerPlay table for a list of devices.
- Parameters:
deviceList – List of DRM devices (can be a single-item list)
clktype – [sclk|mclk] Which clock type to apply the range to
point – Point on the voltage curve to modify
clk – Clock speed specified for this curve point
volt – Voltage specified for this curve point
autoRespond – Response to automatically provide for all prompts
- rocm_smi.setClockOverDrive(deviceList, clktype, value, autoRespond)#
Set clock speed to OverDrive for a list of devices
- Parameters:
deviceList – List of DRM devices (can be a single-item list)
type – [sclk|mclk] Clock type to set
value – [0-20] OverDrive percentage
autoRespond – Response to automatically provide for all prompts
- rocm_smi.setClocks(deviceList, clktype, clk)#
Set clock frequency levels for a list of devices.
- Parameters:
deviceList – List of DRM devices (can be a single-item list)
clktype – [validClockNames] Clock type to set
clk – Clock frequency level to set
- rocm_smi.setPerfDeterminism(deviceList, clkvalue)#
Set clock frequency level for a list of devices to enable performance determinism.
- Parameters:
deviceList – List of DRM devices (can be a single-item list)
value – Clock frequency level to set
- rocm_smi.resetGpu(device)#
Perform a GPU reset on the specified device
- Parameters:
device – DRM device identifier
- rocm_smi.isRasControlAvailable(device)#
Check if RAS control is available for a specified device.
- Parameters:
device – DRM device identifier
- rocm_smi.setRas(deviceList, rasAction, rasBlock, rasType)#
Perform a RAS action on the devices
- Parameters:
deviceList – List of DRM devices (can be a single-item list)
rasAction – [enable|disable|inject] RAS Action to perform
rasBlock – [$validRasBlocks] RAS block
rasType – [ce|ue] Error type to enable/disable
- rocm_smi.setFanSpeed(deviceList, fan)#
Set fan speed for a list of devices.
- Parameters:
deviceList – List of DRM devices (can be a single-item list)
level – [0-255] Fan speed level
- rocm_smi.setPerformanceLevel(deviceList, level)#
Set the Performance Level for a specified device.
- Parameters:
deviceList – List of DRM devices (can be a single-item list)
level – Performance Level to set
- rocm_smi.setPowerOverDrive(deviceList, value, autoRespond)#
Use Power OverDrive to change the the maximum power available power available to the GPU in Watts. May be limited by the maximum power the VBIOS is configured to allow this card to use in OverDrive mode.
- Parameters:
deviceList – List of DRM devices (can be a single-item list)
value – New maximum power to assign to the target device, in Watts
autoRespond – Response to automatically provide for all prompts
- rocm_smi.setProfile(deviceList, profile)#
Set Power Profile, or set CUSTOM Power Profile values for a list of devices.
- Parameters:
deviceList – List of DRM devices (can be a single-item list)
profile – Profile to set
- rocm_smi.setComputePartition(deviceList, computePartitionType)#
Sets compute partitioning for a list of device
- Parameters:
deviceList – List of DRM devices (can be a single-item list)
computePartition – Compute Partition type to set as
- rocm_smi.progressbar(it, prefix='', size=60, out=<_io.TextIOWrapper name='<stdout>' mode='w' encoding='utf-8'>)#
- rocm_smi.showProgressbar(title='', timeInSeconds=13)#
- rocm_smi.setMemoryPartition(deviceList, memoryPartition, autoRespond)#
Sets memory partition (memory partition) for a list of devices
- Parameters:
deviceList – List of DRM devices (can be a single-item list)
memoryPartition – Memory Partition type to set as
- rocm_smi.showVersion(isCSV=False)#
- rocm_smi.showAllConcise(deviceList)#
Display critical info for all devices in a concise format
- Parameters:
deviceList – List of DRM devices (can be a single-item list)
- rocm_smi.showAllConciseHw(deviceList)#
Display critical Hardware info
- Parameters:
deviceList – List of DRM devices (can be a single-item list)
- rocm_smi.showBus(deviceList)#
Display PCI Bus info
- Parameters:
deviceList – List of DRM devices (can be a single-item list)
- rocm_smi.showClocks(deviceList)#
Display all available clocks for a list of devices
Current clocks marked with a ‘*’ symbol
- Parameters:
deviceList – List of DRM devices (can be a single-item list)
- rocm_smi.showCurrentClocks(deviceList, clk_defined=None, concise=False)#
Display all clocks for a list of devices
- Parameters:
deviceList – List of DRM devices (can be a single-item list)
clk-type – Clock type to display
- rocm_smi.showCurrentFans(deviceList)#
Display the current fan speed for a list of devices
- Parameters:
deviceList – List of DRM devices (can be a single-item list)
- rocm_smi.showCurrentTemps(deviceList)#
Display all available temperatures for a list of devices
- Parameters:
deviceList – List of DRM devices (can be a single-item list)
- rocm_smi.showFwInfo(deviceList, fwType)#
Show the requested FW information for a list of devices
- Parameters:
deviceList – List of DRM devices (can be a single-item list)
fwType – [$validFwBlocks] FW block version to display (all if left empty)
- rocm_smi.showGpusByPid(pidList)#
Show GPUs used by a specific Process ID (pid)
Print out the GPU(s) used by a specific KFD process If pidList is empty, print all used GPUs for all KFD processes
- Parameters:
pidList – List of PIDs to check
- rocm_smi.getCoarseGrainUtil(device, typeName=None)#
- Find Coarse Grain Utilization
If typeName is not given, will return array with of all available sensors, where sensor type and value could be addressed like this:
for ut_counter in utilization_counters: printLog(device, utilization_counter_name[ut_counter.type], ut_counter.val)
- Parameters:
device – DRM device identifier
typeName – ‘GFX Activity’, ‘Memory Activity’
- rocm_smi.showGpuUse(deviceList)#
Display GPU use for a list of devices
- Parameters:
deviceList – List of DRM devices (can be a single-item list)
- rocm_smi.showEnergy(deviceList)#
Display amount of energy consumed by device until now
Default counter value is 10000b, indicating energy status unit is 15.3 micro-Joules increment. :param deviceList: List of DRM devices (can be a single-item list)
- rocm_smi.showId(deviceList)#
Display the device IDs for a list of devices
- Parameters:
deviceList – List of DRM devices (can be a single-item list)
- rocm_smi.showMaxPower(deviceList)#
Display the maximum Graphics Package Power that this GPU will attempt to consume before it begins throttling performance
- Parameters:
deviceList – List of DRM devices (can be a single-item list)
- rocm_smi.showMemInfo(deviceList, memType)#
Display Memory information for a list of devices
- Parameters:
deviceList – List of DRM devices (can be a single-item list)
memType – [$validMemTypes] Type of memory information to display
- rocm_smi.showMemUse(deviceList)#
Display GPU memory usage for a list of devices
- Parameters:
deviceList – List of DRM devices (can be a single-item list)
- rocm_smi.showMemVendor(deviceList)#
Display GPU memory vendor for a list of devices
- Parameters:
deviceList – List of DRM devices (can be a single-item list)
- rocm_smi.showOverDrive(deviceList, odtype)#
Display current OverDrive level for a list of devices
- Parameters:
deviceList – List of DRM devices (can be a single-item list)
odtype – [sclk|mclk] OverDrive type
- rocm_smi.showPcieBw(deviceList)#
Display estimated PCIe bandwidth usage for a list of devices
- Parameters:
deviceList – List of DRM devices (can be a single-item list)
- rocm_smi.showPcieReplayCount(deviceList)#
Display number of PCIe replays for a list of devices
- Parameters:
deviceList – List of DRM devices (can be a single-item list)
- rocm_smi.showPerformanceLevel(deviceList)#
Display current Performance Level for a list of devices
- Parameters:
deviceList – List of DRM devices (can be a single-item list)
- rocm_smi.showPids(verbose)#
Show Information for PIDs created in a KFD (Compute) context
- rocm_smi.showPower(deviceList)#
- Display Current (also known as instant) Socket or Average
Graphics Package Power Consumption for a list of devices
- Parameters:
deviceList – List of DRM devices (can be a single-item list)
- rocm_smi.showPowerPlayTable(deviceList)#
Display current GPU Memory clock frequencies and voltages for a list of devices
- Parameters:
deviceList – List of DRM devices (can be a single-item list)
- rocm_smi.showProduct(deviceList)#
Show the requested product information for a list of devices
- Parameters:
deviceList – List of DRM devices (can be a single-item list)
- rocm_smi.showProfile(deviceList)#
Display available Power Profiles for a list of devices.
- Parameters:
deviceList – List of DRM devices (can be a single-item list)
- rocm_smi.showRange(deviceList, rangeType)#
Show the range for either the sclk or voltage for the specified devices
- Parameters:
deviceList – List of DRM devices (can be a single-item list)
rangeType – [sclk|voltage] Type of range to return
- rocm_smi.showRasInfo(deviceList, rasType)#
Show the requested RAS information for a list of devices
- Parameters:
deviceList – List of DRM devices (can be a single-item list)
rasType – [$validRasBlocks] RAS counter to display (all if left empty)
- rocm_smi.showRetiredPages(deviceList, retiredType='all')#
Show retired pages of a specified type for a list of devices
- Parameters:
deviceList – List of DRM devices (can be a single-item list)
retiredType – Type of retired pages to show (default = all)
- rocm_smi.showSerialNumber(deviceList)#
Display the serial number for a list of devices
- Parameters:
deviceList – List of DRM devices (can be a single-item list)
- rocm_smi.showUId(deviceList)#
Display the unique device ID for a list of devices
- Parameters:
deviceList – List of DRM devices (can be a single-item list)
- rocm_smi.showVbiosVersion(deviceList)#
Display the VBIOS version for a list of devices
- Parameters:
deviceList – List of DRM devices (can be a single-item list)
- rocm_smi.showEvents(deviceList, eventTypes)#
Display a blocking list of events for a list of devices
- Parameters:
deviceList – List of DRM devices (can be a single-item list)
eventTypes – List of event type names (can be a single-item list)
- rocm_smi.showDriverVersion(deviceList, component)#
Display the software version for the specified component
- Parameters:
deviceList – List of DRM devices (can be a single-item list)
component – Component (currently only driver)
- rocm_smi.showVoltage(deviceList)#
Display the current voltage (in millivolts) for a list of devices
- Parameters:
deviceList – List of DRM devices (can be a single-item list)
- rocm_smi.showVoltageCurve(deviceList)#
Show the voltage curve points for the specified devices
- Parameters:
deviceList – List of DRM devices (can be a single-item list)
- rocm_smi.showXgmiErr(deviceList)#
Display the XGMI Error status
This reads the XGMI error file, and interprets the return value from the sysfs file
- Parameters:
deviceList – Show XGMI error state for these devices
- rocm_smi.showAccessibleTopology(deviceList)#
Display the HW Topology Information based on link accessibility
This reads the HW Topology file and displays the matrix for the nodes
- Parameters:
deviceList – List of DRM devices (can be a single-item list)
- rocm_smi.showWeightTopology(deviceList)#
Display the HW Topology Information based on weights
This reads the HW Topology file and displays the matrix for the nodes
- Parameters:
deviceList – List of DRM devices (can be a single-item list)
- rocm_smi.showHopsTopology(deviceList)#
Display the HW Topology Information based on number of hops
This reads the HW Topology file and displays the matrix for the nodes
- Parameters:
deviceList – List of DRM devices (can be a single-item list)
- rocm_smi.showTypeTopology(deviceList)#
Display the HW Topology Information based on link type
This reads the HW Topology file and displays the matrix for the nodes
- Parameters:
deviceList – List of DRM devices (can be a single-item list)
- rocm_smi.showNumaTopology(deviceList)#
Display the HW Topology Information for numa nodes
This reads the HW Topology file and display the matrix for the nodes
- Parameters:
deviceList – List of DRM devices (can be a single-item list)
- rocm_smi.showHwTopology(deviceList)#
Display the HW Topology Information based on weight/hops/type
This reads the HW Topology file and displays the matrix for the nodes
- Parameters:
deviceList – List of DRM devices (can be a single-item list)
- rocm_smi.showNodesBw(deviceList)#
Display max and min bandwidth between nodes. Currently supports XGMI only. This reads the HW Topology file and displays the matrix for the nodes :param deviceList: List of DRM devices (can be a single-item list)
- rocm_smi.showComputePartition(deviceList)#
Returns the current compute partitioning for a list of devices
- Parameters:
deviceList – List of DRM devices (can be a single-item list)
- rocm_smi.showMemoryPartition(deviceList)#
Returns the current memory partition for a list of devices
- Parameters:
deviceList – List of DRM devices (can be a single-item list)
- rocm_smi.checkAmdGpus(deviceList)#
Check if there are any AMD GPUs being queried, return False if there are none
- Parameters:
deviceList – List of DRM devices (can be a single-item list)
- rocm_smi.component_str(component)#
Returns the component String value
- Parameters:
component – Component (currently only driver)
- rocm_smi.confirmOutOfSpecWarning(autoRespond)#
Print the warning for running outside of specification and prompt user to accept the terms.
- Parameters:
autoRespond – Response to automatically provide for all prompts
- rocm_smi.doesDeviceExist(device)#
Check whether the specified device exists
- Parameters:
device – DRM device identifier
- rocm_smi.initializeRsmi()#
initializes rocmsmi if the amdgpu driver is initialized
- rocm_smi.isAmdDevice(device)#
Return whether the specified device is an AMD device or not
- Parameters:
device – DRM device identifier
- rocm_smi.listDevices()#
Returns a list of GPU devices
- rocm_smi.load(savefilepath, autoRespond)#
Load clock frequencies and fan speeds from a specified file.
- Parameters:
savefilepath – Path to the save file
autoRespond – Response to automatically provide for all prompts
- rocm_smi.padHexValue(value, length)#
Pad a hexadecimal value with a given length of zeros
- Parameters:
value – A hexadecimal value to be padded with zeros
length – Number of zeros to pad the hexadecimal value
- rocm_smi.profileString(profile)#
- rocm_smi.relaunchAsSudo()#
Relaunch the SMI as sudo
To use rocm_smi_lib functions that write to sysfs, the SMI requires root access Use execvp to relaunch the script with sudo privileges
- rocm_smi.rsmi_ret_ok(my_ret, device=None, metric=None, silent=False)#
Returns true if RSMI call status is 0 (success)
If status is not 0, error logs are written to the debug log and false is returned
- Parameters:
device – DRM device identifier
my_ret – Return of RSMI call (rocm_smi_lib API)
metric – Parameter of GPU currently being analyzed
silent – Echo verbose error response. True silences err output, False does not silence err output (default).
- rocm_smi.save(deviceList, savefilepath)#
Save clock frequencies and fan speeds for a list of devices to a specified file path.
- Parameters:
deviceList – List of DRM devices (can be a single-item list)
savefilepath – Path to use to create the save file