Add rsmi_compute_process_gpus_get()
Given a process ID, give the device indices that process is
currently using.
Also:
* made corrections to how RSMI, amdgpu (ie, "card#") and
KFD indicies translate from one another
* add a few missing error codes to rsmi_status_string()
* fix some formatting
Change-Id: Icd2cae66bb4fec768da96af7cf9cf8b8b66ec7f9
[ROCm/rocm_smi_lib commit: 2d6e15190c]
Cette révision appartient à :
@@ -96,7 +96,8 @@ void TestIdInfoRead::Run(void) {
|
||||
|
||||
for (uint32_t i = 0; i < num_monitor_devs(); ++i) {
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "\t**Device index: " << id << std::endl;
|
||||
std::cout << "\t*************************" << std::endl;
|
||||
std::cout << "\t**Device index: " << i << std::endl;
|
||||
}
|
||||
|
||||
// Get the device ID, name, vendor ID and vendor name for the device
|
||||
|
||||
@@ -98,6 +98,10 @@ void TestProcInfoRead::Run(void) {
|
||||
|
||||
TestBase::Run();
|
||||
|
||||
uint32_t num_devices;
|
||||
err = rsmi_num_monitor_devices(&num_devices);
|
||||
CHK_ERR_ASRT(err)
|
||||
|
||||
err = rsmi_compute_process_info_get(nullptr, &num_proc_found);
|
||||
if (err != RSMI_STATUS_SUCCESS) {
|
||||
if (err == RSMI_STATUS_NOT_SUPPORTED) {
|
||||
@@ -119,6 +123,7 @@ void TestProcInfoRead::Run(void) {
|
||||
if (num_proc_found == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
procs = new rsmi_process_info_t[num_proc_found];
|
||||
|
||||
val_ui32 = num_proc_found;
|
||||
@@ -150,8 +155,32 @@ void TestProcInfoRead::Run(void) {
|
||||
// Reset to the number we actually read
|
||||
num_proc_found = val_ui32;
|
||||
if (num_proc_found) {
|
||||
rsmi_process_info_t proc_info;
|
||||
// Allocate the max we expect to get
|
||||
uint32_t *dev_inds = new uint32_t[num_devices];
|
||||
uint32_t amt_allocd = num_devices;
|
||||
|
||||
for (uint32_t j = 0; j < num_proc_found; j++) {
|
||||
err = rsmi_compute_process_gpus_get(procs[j].process_id, dev_inds,
|
||||
&amt_allocd);
|
||||
CHK_ERR_ASRT(err)
|
||||
ASSERT_LE(amt_allocd, num_devices);
|
||||
|
||||
std::cout << "\t**Process " << procs[j].process_id <<
|
||||
" is using devices with indices: ";
|
||||
uint32_t i;
|
||||
if (amt_allocd > 0) {
|
||||
for (i = 0; i < amt_allocd - 1; ++i) {
|
||||
std::cout << dev_inds[i] << ", ";
|
||||
}
|
||||
std::cout << dev_inds[i] << std::endl;
|
||||
}
|
||||
// Reset amt_allocd back to the amount acutally allocated
|
||||
amt_allocd = num_devices;
|
||||
}
|
||||
|
||||
delete []dev_inds;
|
||||
|
||||
rsmi_process_info_t proc_info;
|
||||
err = rsmi_compute_process_info_by_pid_get(procs[0].process_id,
|
||||
&proc_info);
|
||||
if (err == RSMI_STATUS_NOT_FOUND) {
|
||||
|
||||
Référencer dans un nouveau ticket
Bloquer un utilisateur