Make verbosity level 0 completely quiet
Also, support --iterations flag for certain functions that will
likely be repeated frequently.
Change-Id: I7ed76835001b5cbca30042d6bf26484258c7b9a6
[ROCm/amdsmi commit: efc9b7658c]
This commit is contained in:
@@ -90,88 +90,99 @@ void TestAPISupportRead::Run(void) {
|
||||
|
||||
TestBase::Run();
|
||||
if (setup_failed_) {
|
||||
std::cout << "** SetUp Failed for this test. Skipping.**" << std::endl;
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "** SetUp Failed for this test. Skipping.**" << std::endl;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
rsmi_func_id_iter_handle_t iter_handle, var_iter, sub_var_iter;
|
||||
rsmi_func_id_value_t value;
|
||||
|
||||
for (uint32_t i = 0; i < num_monitor_devs(); ++i) {
|
||||
PrintDeviceHeader(i);
|
||||
|
||||
std::cout << "Supported RSMI Functions:" << std::endl;
|
||||
std::cout << "\tVariants (Monitors)" << std::endl;
|
||||
|
||||
err = rsmi_dev_supported_func_iterator_open(i, &iter_handle);
|
||||
CHK_ERR_ASRT(err)
|
||||
|
||||
while (1) {
|
||||
err = rsmi_func_iter_value_get(iter_handle, &value);
|
||||
for (uint32_t x = 0; x < num_iterations(); ++x) {
|
||||
for (uint32_t i = 0; i < num_monitor_devs(); ++i) {
|
||||
IF_VERB(STANDARD) {
|
||||
PrintDeviceHeader(i);
|
||||
std::cout << "Supported RSMI Functions:" << std::endl;
|
||||
std::cout << "\tVariants (Monitors)" << std::endl;
|
||||
}
|
||||
err = rsmi_dev_supported_func_iterator_open(i, &iter_handle);
|
||||
CHK_ERR_ASRT(err)
|
||||
std::cout << "Function Name: " << value.name << std::endl;
|
||||
|
||||
err = rsmi_dev_supported_variant_iterator_open(iter_handle, &var_iter);
|
||||
if (err != RSMI_STATUS_NO_DATA) {
|
||||
while (1) {
|
||||
err = rsmi_func_iter_value_get(iter_handle, &value);
|
||||
CHK_ERR_ASRT(err)
|
||||
std::cout << "\tVariants/Monitors: ";
|
||||
while (1) {
|
||||
err = rsmi_func_iter_value_get(var_iter, &value);
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "Function Name: " << value.name << std::endl;
|
||||
}
|
||||
err = rsmi_dev_supported_variant_iterator_open(iter_handle, &var_iter);
|
||||
if (err != RSMI_STATUS_NO_DATA) {
|
||||
CHK_ERR_ASRT(err)
|
||||
if (value.id == RSMI_DEFAULT_VARIANT) {
|
||||
std::cout << "Default Variant ";
|
||||
} else {
|
||||
std::cout << value.id;
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "\tVariants/Monitors: ";
|
||||
}
|
||||
std::cout << " (";
|
||||
|
||||
err =
|
||||
rsmi_dev_supported_variant_iterator_open(var_iter, &sub_var_iter);
|
||||
if (err != RSMI_STATUS_NO_DATA) {
|
||||
while (1) {
|
||||
err = rsmi_func_iter_value_get(var_iter, &value);
|
||||
CHK_ERR_ASRT(err)
|
||||
|
||||
while (1) {
|
||||
err = rsmi_func_iter_value_get(sub_var_iter, &value);
|
||||
CHK_ERR_ASRT(err)
|
||||
std::cout << value.id << ", ";
|
||||
|
||||
err = rsmi_func_iter_next(sub_var_iter);
|
||||
|
||||
if (err == RSMI_STATUS_NO_DATA) {
|
||||
break;
|
||||
IF_VERB(STANDARD) {
|
||||
if (value.id == RSMI_DEFAULT_VARIANT) {
|
||||
std::cout << "Default Variant ";
|
||||
} else {
|
||||
std::cout << value.id;
|
||||
}
|
||||
std::cout << " (";
|
||||
}
|
||||
err =
|
||||
rsmi_dev_supported_variant_iterator_open(var_iter, &sub_var_iter);
|
||||
if (err != RSMI_STATUS_NO_DATA) {
|
||||
CHK_ERR_ASRT(err)
|
||||
|
||||
while (1) {
|
||||
err = rsmi_func_iter_value_get(sub_var_iter, &value);
|
||||
CHK_ERR_ASRT(err)
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << value.id << ", ";
|
||||
}
|
||||
err = rsmi_func_iter_next(sub_var_iter);
|
||||
|
||||
if (err == RSMI_STATUS_NO_DATA) {
|
||||
break;
|
||||
}
|
||||
CHK_ERR_ASRT(err)
|
||||
}
|
||||
err = rsmi_dev_supported_func_iterator_close(&sub_var_iter);
|
||||
CHK_ERR_ASRT(err)
|
||||
}
|
||||
err = rsmi_dev_supported_func_iterator_close(&sub_var_iter);
|
||||
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "), ";
|
||||
}
|
||||
err = rsmi_func_iter_next(var_iter);
|
||||
|
||||
if (err == RSMI_STATUS_NO_DATA) {
|
||||
break;
|
||||
}
|
||||
CHK_ERR_ASRT(err)
|
||||
}
|
||||
|
||||
std::cout << "), ";
|
||||
|
||||
err = rsmi_func_iter_next(var_iter);
|
||||
|
||||
if (err == RSMI_STATUS_NO_DATA) {
|
||||
break;
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << std::endl;
|
||||
}
|
||||
err = rsmi_dev_supported_func_iterator_close(&var_iter);
|
||||
CHK_ERR_ASRT(err)
|
||||
}
|
||||
std::cout << std::endl;
|
||||
|
||||
err = rsmi_dev_supported_func_iterator_close(&var_iter);
|
||||
err = rsmi_func_iter_next(iter_handle);
|
||||
|
||||
if (err == RSMI_STATUS_NO_DATA) {
|
||||
break;
|
||||
}
|
||||
CHK_ERR_ASRT(err)
|
||||
}
|
||||
|
||||
err = rsmi_func_iter_next(iter_handle);
|
||||
|
||||
if (err == RSMI_STATUS_NO_DATA) {
|
||||
break;
|
||||
// err = rsmi_dev_supported_variant_iterator_open(iter_handle, &var_iter);
|
||||
//
|
||||
}
|
||||
err = rsmi_dev_supported_func_iterator_close(&iter_handle);
|
||||
CHK_ERR_ASRT(err)
|
||||
|
||||
// err = rsmi_dev_supported_variant_iterator_open(iter_handle, &var_iter);
|
||||
//
|
||||
}
|
||||
err = rsmi_dev_supported_func_iterator_close(&iter_handle);
|
||||
CHK_ERR_ASRT(err)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -90,77 +90,84 @@ void TestErrCntRead::Run(void) {
|
||||
|
||||
TestBase::Run();
|
||||
if (setup_failed_) {
|
||||
std::cout << "** SetUp Failed for this test. Skipping.**" << std::endl;
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "** SetUp Failed for this test. Skipping.**" << std::endl;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
for (uint32_t i = 0; i < num_monitor_devs(); ++i) {
|
||||
PrintDeviceHeader(i);
|
||||
|
||||
err = rsmi_dev_ecc_enabled_get(i, &enabled_mask);
|
||||
if (err == RSMI_STATUS_NOT_SUPPORTED) {
|
||||
std::cout <<
|
||||
"\t**Error Count Enabled Mask get is not supported on this machine"
|
||||
<< std::endl;
|
||||
// Verify api support checking functionality is working
|
||||
err = rsmi_dev_ecc_enabled_get(i, nullptr);
|
||||
ASSERT_EQ(err, RSMI_STATUS_NOT_SUPPORTED);
|
||||
|
||||
continue;
|
||||
} else {
|
||||
CHK_ERR_ASRT(err)
|
||||
|
||||
// Verify api support checking functionality is working
|
||||
err = rsmi_dev_ecc_enabled_get(i, nullptr);
|
||||
ASSERT_EQ(err, RSMI_STATUS_INVALID_ARGS);
|
||||
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "Block Error Mask: 0x" << std::hex << enabled_mask <<
|
||||
std::endl;
|
||||
}
|
||||
}
|
||||
for (uint32_t b = RSMI_GPU_BLOCK_FIRST;
|
||||
b <= RSMI_GPU_BLOCK_LAST; b = b*2) {
|
||||
err = rsmi_dev_ecc_status_get(i, static_cast<rsmi_gpu_block_t>(b),
|
||||
&err_state);
|
||||
CHK_ERR_ASRT(err)
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "\t**Error Count status for " <<
|
||||
GetBlockNameStr(static_cast<rsmi_gpu_block_t>(b)) <<
|
||||
" block: " << GetErrStateNameStr(err_state) << std::endl;
|
||||
}
|
||||
// Verify api support checking functionality is working
|
||||
err = rsmi_dev_ecc_status_get(i, static_cast<rsmi_gpu_block_t>(b),
|
||||
nullptr);
|
||||
ASSERT_EQ(err, RSMI_STATUS_INVALID_ARGS);
|
||||
|
||||
err = rsmi_dev_ecc_count_get(i, static_cast<rsmi_gpu_block_t>(b), &ec);
|
||||
for (uint32_t x = 0; x < num_iterations(); ++x) {
|
||||
for (uint32_t i = 0; i < num_monitor_devs(); ++i) {
|
||||
PrintDeviceHeader(i);
|
||||
|
||||
err = rsmi_dev_ecc_enabled_get(i, &enabled_mask);
|
||||
if (err == RSMI_STATUS_NOT_SUPPORTED) {
|
||||
std::cout << "\t**Error Count for " <<
|
||||
GetBlockNameStr(static_cast<rsmi_gpu_block_t>(b)) <<
|
||||
": Not supported for this device" << std::endl;
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout <<
|
||||
"\t**Error Count Enabled Mask get is not supported on this machine"
|
||||
<< std::endl;
|
||||
}
|
||||
// Verify api support checking functionality is working
|
||||
err = rsmi_dev_ecc_count_get(i, static_cast<rsmi_gpu_block_t>(b),
|
||||
nullptr);
|
||||
err = rsmi_dev_ecc_enabled_get(i, nullptr);
|
||||
ASSERT_EQ(err, RSMI_STATUS_NOT_SUPPORTED);
|
||||
|
||||
continue;
|
||||
} else {
|
||||
CHK_ERR_ASRT(err)
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "\t**Error counts for " <<
|
||||
GetBlockNameStr(static_cast<rsmi_gpu_block_t>(b)) << " block: "
|
||||
<< std::endl;
|
||||
std::cout << "\t\tCorrectable errors: " << ec.correctable_err
|
||||
<< std::endl;
|
||||
std::cout << "\t\tUncorrectable errors: " << ec.uncorrectable_err
|
||||
<< std::endl;
|
||||
CHK_ERR_ASRT(err)
|
||||
|
||||
// Verify api support checking functionality is working
|
||||
err = rsmi_dev_ecc_enabled_get(i, nullptr);
|
||||
ASSERT_EQ(err, RSMI_STATUS_INVALID_ARGS);
|
||||
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "Block Error Mask: 0x" << std::hex << enabled_mask <<
|
||||
std::endl;
|
||||
}
|
||||
}
|
||||
for (uint32_t b = RSMI_GPU_BLOCK_FIRST;
|
||||
b <= RSMI_GPU_BLOCK_LAST; b = b*2) {
|
||||
err = rsmi_dev_ecc_status_get(i, static_cast<rsmi_gpu_block_t>(b),
|
||||
&err_state);
|
||||
CHK_ERR_ASRT(err)
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "\t**Error Count status for " <<
|
||||
GetBlockNameStr(static_cast<rsmi_gpu_block_t>(b)) <<
|
||||
" block: " << GetErrStateNameStr(err_state) << std::endl;
|
||||
}
|
||||
// Verify api support checking functionality is working
|
||||
err = rsmi_dev_ecc_status_get(i, static_cast<rsmi_gpu_block_t>(b),
|
||||
nullptr);
|
||||
ASSERT_EQ(err, RSMI_STATUS_INVALID_ARGS);
|
||||
|
||||
err = rsmi_dev_ecc_count_get(i, static_cast<rsmi_gpu_block_t>(b), &ec);
|
||||
|
||||
if (err == RSMI_STATUS_NOT_SUPPORTED) {
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "\t**Error Count for " <<
|
||||
GetBlockNameStr(static_cast<rsmi_gpu_block_t>(b)) <<
|
||||
": Not supported for this device" << std::endl;
|
||||
}
|
||||
// Verify api support checking functionality is working
|
||||
err = rsmi_dev_ecc_count_get(i, static_cast<rsmi_gpu_block_t>(b),
|
||||
nullptr);
|
||||
ASSERT_EQ(err, RSMI_STATUS_NOT_SUPPORTED);
|
||||
|
||||
} else {
|
||||
CHK_ERR_ASRT(err)
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "\t**Error counts for " <<
|
||||
GetBlockNameStr(static_cast<rsmi_gpu_block_t>(b)) << " block: "
|
||||
<< std::endl;
|
||||
std::cout << "\t\tCorrectable errors: " << ec.correctable_err
|
||||
<< std::endl;
|
||||
std::cout << "\t\tUncorrectable errors: " << ec.uncorrectable_err
|
||||
<< std::endl;
|
||||
}
|
||||
// Verify api support checking functionality is working
|
||||
err = rsmi_dev_ecc_count_get(i, static_cast<rsmi_gpu_block_t>(b),
|
||||
nullptr);
|
||||
nullptr);
|
||||
ASSERT_EQ(err, RSMI_STATUS_INVALID_ARGS);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -89,7 +89,10 @@ void TestEvtNotifReadWrite::Run(void) {
|
||||
|
||||
TestBase::Run();
|
||||
if (setup_failed_) {
|
||||
std::cout << "** SetUp Failed for this test. Skipping.**" << std::endl;
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "** SetUp Failed for this test. Skipping.**" <<
|
||||
std::endl;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -104,9 +107,11 @@ void TestEvtNotifReadWrite::Run(void) {
|
||||
for (dv_ind = 0; dv_ind < num_monitor_devs(); ++dv_ind) {
|
||||
ret = rsmi_event_notification_init(dv_ind);
|
||||
if (ret == RSMI_STATUS_NOT_SUPPORTED) {
|
||||
std::cout <<
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout <<
|
||||
"Event notification is not supported for this driver version." <<
|
||||
std::endl;
|
||||
}
|
||||
return;
|
||||
}
|
||||
ASSERT_EQ(ret, RSMI_STATUS_SUCCESS);
|
||||
@@ -121,18 +126,24 @@ void TestEvtNotifReadWrite::Run(void) {
|
||||
if (ret == RSMI_STATUS_SUCCESS || ret == RSMI_STATUS_INSUFFICIENT_SIZE) {
|
||||
EXPECT_LE(num_elem, 10) <<
|
||||
"Expected the number of elements found to be <= buffer size (10)";
|
||||
for (uint32_t i = 0; i < num_elem; ++i) {
|
||||
std::cout << "\tdv_ind=" << data[i].dv_ind <<
|
||||
IF_VERB(STANDARD) {
|
||||
for (uint32_t i = 0; i < num_elem; ++i) {
|
||||
std::cout << "\tdv_ind=" << data[i].dv_ind <<
|
||||
" Type: " << NameFromEvtNotifType(data[i].event) <<
|
||||
" Mesg: " << data[i].message << std::endl;
|
||||
}
|
||||
}
|
||||
if (ret == RSMI_STATUS_INSUFFICIENT_SIZE) {
|
||||
IF_VERB(STANDARD) {
|
||||
if (ret == RSMI_STATUS_INSUFFICIENT_SIZE) {
|
||||
std::cout <<
|
||||
"\t\tBuffer size is 10, but more than 10 events are available." <<
|
||||
std::endl;
|
||||
}
|
||||
}
|
||||
} else if (ret == RSMI_STATUS_NO_DATA) {
|
||||
std::cout << "\tNo events were collected." << std::endl;
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "\tNo events were collected." << std::endl;
|
||||
}
|
||||
} else {
|
||||
// This should always fail. We want to print out the return code.
|
||||
EXPECT_EQ(ret, RSMI_STATUS_SUCCESS) <<
|
||||
|
||||
@@ -94,40 +94,42 @@ void TestFanRead::Run(void) {
|
||||
std::cout << "** SetUp Failed for this test. Skipping.**" << std::endl;
|
||||
return;
|
||||
}
|
||||
for (uint32_t i = 0; i < num_monitor_devs(); ++i) {
|
||||
PrintDeviceHeader(i);
|
||||
for (uint32_t x = 0; x < num_iterations(); ++x) {
|
||||
for (uint32_t i = 0; i < num_monitor_devs(); ++i) {
|
||||
PrintDeviceHeader(i);
|
||||
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "\t**Current Fan Speed: ";
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "\t**Current Fan Speed: ";
|
||||
}
|
||||
err = rsmi_dev_fan_speed_get(i, 0, &val_i64);
|
||||
CHK_ERR_ASRT(err)
|
||||
|
||||
// Verify api support checking functionality is working
|
||||
err = rsmi_dev_fan_speed_get(i, 0, nullptr);
|
||||
ASSERT_EQ(err, RSMI_STATUS_INVALID_ARGS);
|
||||
|
||||
err = rsmi_dev_fan_speed_max_get(i, 0, &val_ui64);
|
||||
CHK_ERR_ASRT(err)
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << val_i64/static_cast<float>(val_ui64)*100;
|
||||
std::cout << "% ("<< val_i64 << "/" << val_ui64 << ")" << std::endl;
|
||||
}
|
||||
// Verify api support checking functionality is working
|
||||
err = rsmi_dev_fan_speed_max_get(i, 0, nullptr);
|
||||
ASSERT_EQ(err, RSMI_STATUS_INVALID_ARGS);
|
||||
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "\t**Current fan RPMs: ";
|
||||
}
|
||||
err = rsmi_dev_fan_rpms_get(i, 0, &val_i64);
|
||||
CHK_ERR_ASRT(err)
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << val_i64 << std::endl;
|
||||
}
|
||||
|
||||
// Verify api support checking functionality is working
|
||||
err = rsmi_dev_fan_rpms_get(i, 0, nullptr);
|
||||
ASSERT_EQ(err, RSMI_STATUS_INVALID_ARGS);
|
||||
}
|
||||
err = rsmi_dev_fan_speed_get(i, 0, &val_i64);
|
||||
CHK_ERR_ASRT(err)
|
||||
|
||||
// Verify api support checking functionality is working
|
||||
err = rsmi_dev_fan_speed_get(i, 0, nullptr);
|
||||
ASSERT_EQ(err, RSMI_STATUS_INVALID_ARGS);
|
||||
|
||||
err = rsmi_dev_fan_speed_max_get(i, 0, &val_ui64);
|
||||
CHK_ERR_ASRT(err)
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << val_i64/static_cast<float>(val_ui64)*100;
|
||||
std::cout << "% ("<< val_i64 << "/" << val_ui64 << ")" << std::endl;
|
||||
}
|
||||
// Verify api support checking functionality is working
|
||||
err = rsmi_dev_fan_speed_max_get(i, 0, nullptr);
|
||||
ASSERT_EQ(err, RSMI_STATUS_INVALID_ARGS);
|
||||
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "\t**Current fan RPMs: ";
|
||||
}
|
||||
err = rsmi_dev_fan_rpms_get(i, 0, &val_i64);
|
||||
CHK_ERR_ASRT(err)
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << val_i64 << std::endl;
|
||||
}
|
||||
|
||||
// Verify api support checking functionality is working
|
||||
err = rsmi_dev_fan_rpms_get(i, 0, nullptr);
|
||||
ASSERT_EQ(err, RSMI_STATUS_INVALID_ARGS);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -143,10 +143,12 @@ void TestFanReadWrite::Run(void) {
|
||||
// EXPECT_TRUE((cur_speed > 0.95 * new_speed &&
|
||||
// cur_speed < 1.1 * new_speed) ||
|
||||
// cur_speed > 0.95 * RSMI_MAX_FAN_SPEED);
|
||||
if (!((cur_speed > 0.95 * new_speed && cur_speed < 1.1 * new_speed) ||
|
||||
IF_VERB(STANDARD) {
|
||||
if (!((cur_speed > 0.95 * new_speed && cur_speed < 1.1 * new_speed) ||
|
||||
(cur_speed > 0.95 * RSMI_MAX_FAN_SPEED))) {
|
||||
std::cout << "WARNING: Fan speed is not within the expected range!" <<
|
||||
std::cout << "WARNING: Fan speed is not within the expected range!" <<
|
||||
std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
IF_VERB(STANDARD) {
|
||||
|
||||
@@ -113,53 +113,55 @@ void TestFrequenciesRead::Run(void) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (uint32_t i = 0; i < num_monitor_devs(); ++i) {
|
||||
auto freq_output = [&](rsmi_clk_type_t t, const char *name) {
|
||||
err = rsmi_dev_gpu_clk_freq_get(i, t, &f);
|
||||
for (uint32_t x = 0; x < num_iterations(); ++x) {
|
||||
for (uint32_t i = 0; i < num_monitor_devs(); ++i) {
|
||||
auto freq_output = [&](rsmi_clk_type_t t, const char *name) {
|
||||
err = rsmi_dev_gpu_clk_freq_get(i, t, &f);
|
||||
if (err == RSMI_STATUS_NOT_SUPPORTED) {
|
||||
std::cout << "\t**Get " << name <<
|
||||
": Not supported on this machine" << std::endl;
|
||||
// Verify api support checking functionality is working
|
||||
err = rsmi_dev_gpu_clk_freq_get(i, t, nullptr);
|
||||
ASSERT_EQ(err, RSMI_STATUS_NOT_SUPPORTED);
|
||||
} else {
|
||||
CHK_ERR_ASRT(err)
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "\t**Supported " << name << " clock frequencies: ";
|
||||
std::cout << f.num_supported << std::endl;
|
||||
print_frequencies(&f);
|
||||
// Verify api support checking functionality is working
|
||||
err = rsmi_dev_gpu_clk_freq_get(i, t, nullptr);
|
||||
ASSERT_EQ(err, RSMI_STATUS_INVALID_ARGS);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
PrintDeviceHeader(i);
|
||||
|
||||
freq_output(RSMI_CLK_TYPE_MEM, "Supported GPU Memory");
|
||||
freq_output(RSMI_CLK_TYPE_SYS, "Supported GPU");
|
||||
freq_output(RSMI_CLK_TYPE_DF, "Data Fabric Clock");
|
||||
freq_output(RSMI_CLK_TYPE_DCEF, "Display Controller Engine Clock");
|
||||
freq_output(RSMI_CLK_TYPE_SOC, "SOC Clock");
|
||||
|
||||
err = rsmi_dev_pci_bandwidth_get(i, &b);
|
||||
if (err == RSMI_STATUS_NOT_SUPPORTED) {
|
||||
std::cout << "\t**Get " << name << ": Not supported on this machine"
|
||||
<< std::endl;
|
||||
std::cout << "\t**Get PCIE Bandwidth: Not supported on this machine"
|
||||
<< std::endl;
|
||||
// Verify api support checking functionality is working
|
||||
err = rsmi_dev_gpu_clk_freq_get(i, t, nullptr);
|
||||
err = rsmi_dev_pci_bandwidth_get(i, nullptr);
|
||||
ASSERT_EQ(err, RSMI_STATUS_NOT_SUPPORTED);
|
||||
} else {
|
||||
CHK_ERR_ASRT(err)
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "\t**Supported " << name << " clock frequencies: ";
|
||||
std::cout << f.num_supported << std::endl;
|
||||
print_frequencies(&f);
|
||||
std::cout << "\t**Supported PCIe bandwidths: ";
|
||||
std::cout << b.transfer_rate.num_supported << std::endl;
|
||||
print_frequencies(&b.transfer_rate, b.lanes);
|
||||
// Verify api support checking functionality is working
|
||||
err = rsmi_dev_gpu_clk_freq_get(i, t, nullptr);
|
||||
err = rsmi_dev_pci_bandwidth_get(i, nullptr);
|
||||
ASSERT_EQ(err, RSMI_STATUS_INVALID_ARGS);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
PrintDeviceHeader(i);
|
||||
|
||||
freq_output(RSMI_CLK_TYPE_MEM, "Supported GPU Memory");
|
||||
freq_output(RSMI_CLK_TYPE_SYS, "Supported GPU");
|
||||
freq_output(RSMI_CLK_TYPE_DF, "Data Fabric Clock");
|
||||
freq_output(RSMI_CLK_TYPE_DCEF, "Display Controller Engine Clock");
|
||||
freq_output(RSMI_CLK_TYPE_SOC, "SOC Clock");
|
||||
|
||||
err = rsmi_dev_pci_bandwidth_get(i, &b);
|
||||
if (err == RSMI_STATUS_NOT_SUPPORTED) {
|
||||
std::cout << "\t**Get PCIE Bandwidth: Not supported on this machine"
|
||||
<< std::endl;
|
||||
// Verify api support checking functionality is working
|
||||
err = rsmi_dev_pci_bandwidth_get(i, nullptr);
|
||||
ASSERT_EQ(err, RSMI_STATUS_NOT_SUPPORTED);
|
||||
} else {
|
||||
CHK_ERR_ASRT(err)
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "\t**Supported PCIe bandwidths: ";
|
||||
std::cout << b.transfer_rate.num_supported << std::endl;
|
||||
print_frequencies(&b.transfer_rate, b.lanes);
|
||||
// Verify api support checking functionality is working
|
||||
err = rsmi_dev_pci_bandwidth_get(i, nullptr);
|
||||
ASSERT_EQ(err, RSMI_STATUS_INVALID_ARGS);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -95,23 +95,25 @@ void TestGPUBusyRead::Run(void) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (uint32_t i = 0; i < num_monitor_devs(); ++i) {
|
||||
PrintDeviceHeader(i);
|
||||
for (uint32_t x = 0; x < num_iterations(); ++x) {
|
||||
for (uint32_t i = 0; i < num_monitor_devs(); ++i) {
|
||||
PrintDeviceHeader(i);
|
||||
|
||||
err = rsmi_dev_busy_percent_get(i, &val_ui32);
|
||||
if (err != RSMI_STATUS_SUCCESS) {
|
||||
if (err == RSMI_STATUS_FILE_ERROR) {
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "\t**GPU Busy Percent: Not supported on this machine"
|
||||
<< std::endl;
|
||||
err = rsmi_dev_busy_percent_get(i, &val_ui32);
|
||||
if (err != RSMI_STATUS_SUCCESS) {
|
||||
if (err == RSMI_STATUS_FILE_ERROR) {
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "\t**GPU Busy Percent: Not supported on this machine"
|
||||
<< std::endl;
|
||||
}
|
||||
} else {
|
||||
CHK_ERR_ASRT(err)
|
||||
}
|
||||
} else {
|
||||
CHK_ERR_ASRT(err)
|
||||
}
|
||||
} else {
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "\t**GPU Busy Percent (Percent Idle):" << std::dec <<
|
||||
val_ui32 << " (" << 100 - val_ui32 << ")" << std::endl;
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "\t**GPU Busy Percent (Percent Idle):" << std::dec <<
|
||||
val_ui32 << " (" << 100 - val_ui32 << ")" << std::endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -97,7 +97,9 @@ void TestHWTopologyRead::Run(void) {
|
||||
|
||||
TestBase::Run();
|
||||
if (setup_failed_) {
|
||||
std::cout << "** SetUp Failed for this test. Skipping.**" << std::endl;
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "** SetUp Failed for this test. Skipping.**" << std::endl;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -160,8 +162,10 @@ void TestHWTopologyRead::Run(void) {
|
||||
|
||||
default:
|
||||
gpu_links[dv_ind_src][dv_ind_dst].type = "XXXX";
|
||||
std::cout << "\t**Invalid IO LINK type. type=" << type <<
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "\t**Invalid IO LINK type. type=" << type <<
|
||||
std::endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
err = rsmi_topo_get_link_weight(dv_ind_src, dv_ind_dst,
|
||||
@@ -182,6 +186,10 @@ void TestHWTopologyRead::Run(void) {
|
||||
}
|
||||
}
|
||||
|
||||
IF_NVERB(STANDARD) {
|
||||
return;
|
||||
}
|
||||
|
||||
std::cout << "**NUMA node number of GPUs**" << std::endl;
|
||||
std::cout << std::setw(12) << std::left <<"GPU#";
|
||||
std::cout <<"NUMA node number";
|
||||
|
||||
@@ -123,11 +123,16 @@ void TestConcurrentInit::SetUp(void) {
|
||||
// Compare required profile for this test case with what we're actually
|
||||
// running on
|
||||
void TestConcurrentInit::DisplayTestInfo(void) {
|
||||
TestBase::DisplayTestInfo();
|
||||
IF_VERB(STANDARD) {
|
||||
TestBase::DisplayTestInfo();
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
void TestConcurrentInit::DisplayResults(void) const {
|
||||
TestBase::DisplayResults();
|
||||
IF_VERB(STANDARD) {
|
||||
TestBase::DisplayResults();
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -141,7 +146,9 @@ void TestConcurrentInit::Close() {
|
||||
// running on
|
||||
void TestConcurrentInit::Run(void) {
|
||||
if (setup_failed_) {
|
||||
std::cout << "** SetUp Failed for this test. Skipping.**" << std::endl;
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "** SetUp Failed for this test. Skipping.**" << std::endl;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -150,7 +157,9 @@ void TestConcurrentInit::Run(void) {
|
||||
pthread_attr_init(&attr);
|
||||
pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_JOINABLE);
|
||||
|
||||
std::cout << "Testing concurrent rsmi_init()..." << std::endl;
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "Testing concurrent rsmi_init()..." << std::endl;
|
||||
}
|
||||
for (int Id = 0; Id < NumOfThreads; ++Id) {
|
||||
int ThreadStatus = pthread_create(&ThreadId[Id], &attr,
|
||||
RSMIInitFunction, nullptr);
|
||||
@@ -176,9 +185,11 @@ void TestConcurrentInit::Run(void) {
|
||||
int32_t refcnt = rsmi_test_refcount(0);
|
||||
ASSERT_EQ(0, refcnt);
|
||||
|
||||
std::cout << "Concurrent rsmi_init() test passed." << std::endl << std::endl;
|
||||
std::cout << "Testing concurrent rsmi_shut_down()..." << std::endl;
|
||||
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "Concurrent rsmi_init() test passed." <<
|
||||
std::endl << std::endl;
|
||||
std::cout << "Testing concurrent rsmi_shut_down()..." << std::endl;
|
||||
}
|
||||
// Invoke hsa_shut_down and verify that all the hsa_init's were counted.
|
||||
// HSA should be exactly closed after NumOfThreads calls.
|
||||
for (int Id = 0; Id < NumOfThreads; ++Id) {
|
||||
@@ -200,12 +211,12 @@ void TestConcurrentInit::Run(void) {
|
||||
refcnt = rsmi_test_refcount(0);
|
||||
ASSERT_EQ(0, refcnt);
|
||||
|
||||
std::cout << "Concurrent rsmi_shut_down() passed." << std::endl;
|
||||
|
||||
std::cout <<
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "Concurrent rsmi_shut_down() passed." << std::endl;
|
||||
std::cout <<
|
||||
"Testing concurrent rsmi_init() followed by rsmi_shut_down()..." <<
|
||||
std::endl;
|
||||
|
||||
}
|
||||
for (int Id = 0; Id < NumOfThreads; ++Id) {
|
||||
int ThreadStatus =
|
||||
pthread_create(&ThreadId[Id], &attr, RSMIInitShutDownFunction, nullptr);
|
||||
@@ -220,7 +231,9 @@ void TestConcurrentInit::Run(void) {
|
||||
refcnt = rsmi_test_refcount(0);
|
||||
ASSERT_EQ(0, refcnt);
|
||||
|
||||
std::cout <<
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout <<
|
||||
"Concurrent rsmi_init() followed by rsmi_shut_down() passed." <<
|
||||
std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -114,41 +114,44 @@ void TestMemUtilRead::Run(void) {
|
||||
}
|
||||
};
|
||||
|
||||
for (uint32_t i = 0; i < num_monitor_devs(); ++i) {
|
||||
PrintDeviceHeader(i);
|
||||
for (uint32_t x = 0; x < num_iterations(); ++x) {
|
||||
for (uint32_t i = 0; i < num_monitor_devs(); ++i) {
|
||||
PrintDeviceHeader(i);
|
||||
|
||||
#if 0
|
||||
err = rsmi_dev_memory_busy_percent_get(i, &mem_busy_percent);
|
||||
err_chk("rsmi_dev_memory_busy_percent_get()");
|
||||
if (err != RSMI_STATUS_SUCCESS) {
|
||||
return;
|
||||
}
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "\t**" << "GPU Memory Busy %: " << mem_busy_percent <<
|
||||
std::endl;
|
||||
}
|
||||
#endif
|
||||
for (uint32_t mem_type = RSMI_MEM_TYPE_FIRST;
|
||||
mem_type <= RSMI_MEM_TYPE_LAST; ++mem_type) {
|
||||
err = rsmi_dev_memory_total_get(i,
|
||||
static_cast<rsmi_memory_type_t>(mem_type), &total);
|
||||
err_chk("rsmi_dev_memory_total_get()");
|
||||
err = rsmi_dev_memory_busy_percent_get(i, &mem_busy_percent);
|
||||
err_chk("rsmi_dev_memory_busy_percent_get()");
|
||||
if (err != RSMI_STATUS_SUCCESS) {
|
||||
return;
|
||||
}
|
||||
|
||||
err = rsmi_dev_memory_usage_get(i,
|
||||
static_cast<rsmi_memory_type_t>(mem_type), &usage);
|
||||
err_chk("rsmi_dev_memory_usage_get()");
|
||||
if (err != RSMI_STATUS_SUCCESS) {
|
||||
return;
|
||||
}
|
||||
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "\t**" <<
|
||||
kDevMemoryTypeNameMap.at(static_cast<rsmi_memory_type_t>(mem_type)) <<
|
||||
" Calculated Utilization: " << (static_cast<float>(usage)*100)/total
|
||||
<< "% ("<< usage << "/" << total << ")" << std::endl;
|
||||
std::cout << "\t**" << "GPU Memory Busy %: " << mem_busy_percent <<
|
||||
std::endl;
|
||||
}
|
||||
#endif
|
||||
for (uint32_t mem_type = RSMI_MEM_TYPE_FIRST;
|
||||
mem_type <= RSMI_MEM_TYPE_LAST; ++mem_type) {
|
||||
err = rsmi_dev_memory_total_get(i,
|
||||
static_cast<rsmi_memory_type_t>(mem_type), &total);
|
||||
err_chk("rsmi_dev_memory_total_get()");
|
||||
if (err != RSMI_STATUS_SUCCESS) {
|
||||
return;
|
||||
}
|
||||
|
||||
err = rsmi_dev_memory_usage_get(i,
|
||||
static_cast<rsmi_memory_type_t>(mem_type), &usage);
|
||||
err_chk("rsmi_dev_memory_usage_get()");
|
||||
if (err != RSMI_STATUS_SUCCESS) {
|
||||
return;
|
||||
}
|
||||
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "\t**" <<
|
||||
kDevMemoryTypeNameMap.at(static_cast<rsmi_memory_type_t>(mem_type))
|
||||
<< " Calculated Utilization: " <<
|
||||
(static_cast<float>(usage)*100)/total << "% ("<< usage <<
|
||||
"/" << total << ")" << std::endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -76,8 +76,10 @@ void TestMutualExclusion::SetUp(void) {
|
||||
rsmi_status_t ret;
|
||||
|
||||
// TestBase::SetUp(RSMI_INIT_FLAG_RESRV_TEST1);
|
||||
MakeHeaderStr(kSetupLabel, &label);
|
||||
printf("\n\t%s\n", label.c_str());
|
||||
IF_VERB(STANDARD) {
|
||||
MakeHeaderStr(kSetupLabel, &label);
|
||||
printf("\n\t%s\n", label.c_str());
|
||||
}
|
||||
|
||||
sleeper_process_ = false;
|
||||
child_ = 0;
|
||||
@@ -104,11 +106,15 @@ void TestMutualExclusion::SetUp(void) {
|
||||
}
|
||||
|
||||
void TestMutualExclusion::DisplayTestInfo(void) {
|
||||
TestBase::DisplayTestInfo();
|
||||
IF_VERB(STANDARD) {
|
||||
TestBase::DisplayTestInfo();
|
||||
}
|
||||
}
|
||||
|
||||
void TestMutualExclusion::DisplayResults(void) const {
|
||||
TestBase::DisplayResults();
|
||||
IF_VERB(STANDARD) {
|
||||
TestBase::DisplayResults();
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -125,11 +131,15 @@ void TestMutualExclusion::Run(void) {
|
||||
rsmi_status_t ret;
|
||||
|
||||
if (sleeper_process_) {
|
||||
std::cout << "MUTEX_HOLDER process: started sleeping for 10 seconds..." <<
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "MUTEX_HOLDER process: started sleeping for 10 seconds..." <<
|
||||
std::endl;
|
||||
}
|
||||
ret = rsmi_test_sleep(0, 10);
|
||||
ASSERT_EQ(ret, RSMI_STATUS_SUCCESS);
|
||||
std::cout << "MUTEX_HOLDER process: Sleep process woke up." << std::endl;
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "MUTEX_HOLDER process: Sleep process woke up." << std::endl;
|
||||
}
|
||||
pid_t cpid = wait(nullptr);
|
||||
ASSERT_EQ(cpid, child_);
|
||||
} else {
|
||||
@@ -137,9 +147,11 @@ void TestMutualExclusion::Run(void) {
|
||||
// let the other process get started on rsmi_test_sleep().
|
||||
sleep(2);
|
||||
TestBase::Run();
|
||||
std::cout << "TESTER process: verifing that all rsmi_dev_* functions "
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "TESTER process: verifing that all rsmi_dev_* functions "
|
||||
"return RSMI_STATUS_BUSY because MUTEX_HOLDER process "
|
||||
"holds the mutex" << std::endl;
|
||||
}
|
||||
// Try all the device related rsmi calls. They should all fail with
|
||||
// RSMI_STATUS_BUSY
|
||||
// Set dummy values should to working, deterministic values.
|
||||
@@ -217,8 +229,10 @@ void TestMutualExclusion::Run(void) {
|
||||
ret = rsmi_dev_ecc_status_get(0, RSMI_GPU_BLOCK_UMC, &dmy_ras_err_st);
|
||||
ASSERT_EQ(ret, RSMI_STATUS_BUSY);
|
||||
|
||||
std::cout << "TESTER process: Finished verifying that all "
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "TESTER process: Finished verifying that all "
|
||||
"rsmi_dev_* functions returned RSMI_STATUS_BUSY" << std::endl;
|
||||
}
|
||||
exit(0);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -137,7 +137,7 @@ void TestPerfCntrReadWrite::CountEvents(uint32_t dv_ind,
|
||||
std::cout << "\t\t\tTime Enabled: " << val->time_enabled << std::endl;
|
||||
std::cout << "\t\t\tTime Running: " << val->time_running << std::endl;
|
||||
std::cout << "\t\t\tEvents/Second Running: " <<
|
||||
val->value/(float)val->time_running << std::endl;
|
||||
val->value/static_cast<float>(val->time_running) << std::endl;
|
||||
}
|
||||
ret = rsmi_dev_counter_destroy(evt_handle);
|
||||
CHK_ERR_ASRT(ret)
|
||||
@@ -155,13 +155,14 @@ TestPerfCntrReadWrite::testEventsIndividually(uint32_t dv_ind) {
|
||||
uint64_t throughput;
|
||||
|
||||
auto utiliz = [&](rsmi_event_type_t evt, uint32_t chan) {
|
||||
std::cout << "****************************" << std::endl;
|
||||
std::cout << "Test XGMI Link Utilization (channel " <<
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "****************************" << std::endl;
|
||||
std::cout << "Test XGMI Link Utilization (channel " <<
|
||||
chan << ")" << std::endl;
|
||||
std::cout << "****************************" << std::endl;
|
||||
std::cout << "Assumed Level 1 Bandwidth: " <<
|
||||
std::cout << "****************************" << std::endl;
|
||||
std::cout << "Assumed Level 1 Bandwidth: " <<
|
||||
kVg20Level1Bandwidth << "GB/sec" << std::endl;
|
||||
|
||||
}
|
||||
uint32_t tmp_verbosity = verbosity();
|
||||
set_verbosity(0);
|
||||
for (int i = 0; i < 5; ++i) {
|
||||
@@ -176,7 +177,7 @@ TestPerfCntrReadWrite::testEventsIndividually(uint32_t dv_ind) {
|
||||
std::cout << "\t\t\tXGMI throughput: " << throughput <<
|
||||
" bytes/second" << std::endl;
|
||||
std::cout << "\t\t\tXGMI Channel Utilization: " <<
|
||||
100*throughput/ (float)(kVg20Level1Bandwidth*kGig) <<
|
||||
100*throughput/static_cast<float>(kVg20Level1Bandwidth*kGig) <<
|
||||
"%" << std::endl;
|
||||
std::cout << "\t\t\t****" << std::endl;
|
||||
}
|
||||
@@ -186,10 +187,11 @@ TestPerfCntrReadWrite::testEventsIndividually(uint32_t dv_ind) {
|
||||
utiliz(RSMI_EVNT_XGMI_1_BEATS_TX, 1);
|
||||
utiliz(RSMI_EVNT_XGMI_0_BEATS_TX, 0);
|
||||
|
||||
std::cout << "****************************" << std::endl;
|
||||
std::cout << "Test each event individually" << std::endl;
|
||||
std::cout << "****************************" << std::endl;
|
||||
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "****************************" << std::endl;
|
||||
std::cout << "Test each event individually" << std::endl;
|
||||
std::cout << "****************************" << std::endl;
|
||||
}
|
||||
for (PerfCntrEvtGrp grp : s_event_groups) {
|
||||
ret = rsmi_dev_counter_group_supported(dv_ind, grp.group());
|
||||
if (ret == RSMI_STATUS_NOT_SUPPORTED) {
|
||||
@@ -217,15 +219,18 @@ TestPerfCntrReadWrite::testEventsSimultaneously(uint32_t dv_ind) {
|
||||
rsmi_counter_value_t val;
|
||||
uint32_t avail_counters;
|
||||
|
||||
std::cout << "****************************" << std::endl;
|
||||
std::cout << "Test events simultaneously" << std::endl;
|
||||
std::cout << "****************************" << std::endl;
|
||||
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "****************************" << std::endl;
|
||||
std::cout << "Test events simultaneously" << std::endl;
|
||||
std::cout << "****************************" << std::endl;
|
||||
}
|
||||
for (PerfCntrEvtGrp grp : s_event_groups) {
|
||||
ret = rsmi_dev_counter_group_supported(dv_ind, grp.group());
|
||||
if (ret == RSMI_STATUS_NOT_SUPPORTED) {
|
||||
std::cout << "\tEvent Group " << grp.name() <<
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "\tEvent Group " << grp.name() <<
|
||||
" is not supported. Skipping." << std::endl;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -235,8 +240,9 @@ TestPerfCntrReadWrite::testEventsSimultaneously(uint32_t dv_ind) {
|
||||
|
||||
ret = rsmi_counter_available_counters_get(dv_ind, grp.group(),
|
||||
&avail_counters);
|
||||
std::cout << "Available Counters: " << avail_counters << std::endl;
|
||||
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "Available Counters: " << avail_counters << std::endl;
|
||||
}
|
||||
CHK_ERR_ASRT(ret)
|
||||
|
||||
uint32_t tmp;
|
||||
|
||||
@@ -107,7 +107,9 @@ void TestPerfLevelReadWrite::Run(void) {
|
||||
|
||||
TestBase::Run();
|
||||
if (setup_failed_) {
|
||||
std::cout << "** SetUp Failed for this test. Skipping.**" << std::endl;
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "** SetUp Failed for this test. Skipping.**" << std::endl;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -143,8 +145,10 @@ void TestPerfLevelReadWrite::Run(void) {
|
||||
std::endl;
|
||||
}
|
||||
}
|
||||
std::cout << "Reset Perf level to " << kDevPerfLvlNameMap.at(orig_pfl) <<
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "Reset Perf level to " << kDevPerfLvlNameMap.at(orig_pfl) <<
|
||||
" ..." << std::endl;
|
||||
}
|
||||
ret = rsmi_dev_perf_level_set(dv_ind, orig_pfl);
|
||||
CHK_ERR_ASRT(ret)
|
||||
ret = rsmi_dev_perf_level_get(dv_ind, &pfl);
|
||||
|
||||
@@ -95,31 +95,33 @@ void TestPowerRead::Run(void) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (uint32_t i = 0; i < num_monitor_devs(); ++i) {
|
||||
PrintDeviceHeader(i);
|
||||
for (uint32_t x = 0; x < num_iterations(); ++x) {
|
||||
for (uint32_t i = 0; i < num_monitor_devs(); ++i) {
|
||||
PrintDeviceHeader(i);
|
||||
|
||||
err = rsmi_dev_power_cap_get(i, 0, &val_ui64);
|
||||
CHK_ERR_ASRT(err)
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "\t**Current Power Cap: " << val_ui64 << "uW" <<std::endl;
|
||||
}
|
||||
err = rsmi_dev_power_cap_range_get(i, 0, &val_ui64, &val2_ui64);
|
||||
CHK_ERR_ASRT(err)
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "\t**Power Cap Range: " << val2_ui64 << " to " <<
|
||||
val_ui64 << " uW" << std::endl;
|
||||
}
|
||||
|
||||
err = rsmi_dev_power_ave_get(i, 0, &val_ui64);
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "\t**Averge Power Usage: ";
|
||||
CHK_RSMI_PERM_ERR(err)
|
||||
if (err == RSMI_STATUS_SUCCESS) {
|
||||
std::cout << static_cast<float>(val_ui64)/1000 << " mW" << std::endl;
|
||||
err = rsmi_dev_power_cap_get(i, 0, &val_ui64);
|
||||
CHK_ERR_ASRT(err)
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "\t**Current Power Cap: " << val_ui64 << "uW" <<std::endl;
|
||||
}
|
||||
err = rsmi_dev_power_cap_range_get(i, 0, &val_ui64, &val2_ui64);
|
||||
CHK_ERR_ASRT(err)
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "\t**Power Cap Range: " << val2_ui64 << " to " <<
|
||||
val_ui64 << " uW" << std::endl;
|
||||
}
|
||||
|
||||
err = rsmi_dev_power_ave_get(i, 0, &val_ui64);
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "\t**Averge Power Usage: ";
|
||||
CHK_RSMI_PERM_ERR(err)
|
||||
if (err == RSMI_STATUS_SUCCESS) {
|
||||
std::cout << static_cast<float>(val_ui64)/1000 << " mW" << std::endl;
|
||||
}
|
||||
// Verify api support checking functionality is working
|
||||
err = rsmi_dev_power_ave_get(i, 0, nullptr);
|
||||
ASSERT_EQ(err, RSMI_STATUS_INVALID_ARGS);
|
||||
}
|
||||
// Verify api support checking functionality is working
|
||||
err = rsmi_dev_power_ave_get(i, 0, nullptr);
|
||||
ASSERT_EQ(err, RSMI_STATUS_INVALID_ARGS);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -205,8 +205,9 @@ void TestProcInfoRead::Run(void) {
|
||||
CHK_ERR_ASRT(err)
|
||||
ASSERT_EQ(proc_info.process_id, procs[j].process_id);
|
||||
ASSERT_EQ(proc_info.pasid, procs[j].pasid);
|
||||
std::cout << "\t** Process ID: " << procs[j].process_id << " VRAM Usage: " <<
|
||||
proc_info.vram_usage << std::endl;
|
||||
std::cout << "\t** Process ID: " <<
|
||||
procs[j].process_id << " VRAM Usage: " <<
|
||||
proc_info.vram_usage << std::endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -164,7 +164,8 @@ void TestSysInfoRead::Run(void) {
|
||||
err = rsmi_dev_unique_id_get(i, nullptr);
|
||||
ASSERT_EQ(err, RSMI_STATUS_INVALID_ARGS);
|
||||
} else {
|
||||
std::cout << "rsmi_dev_unique_id_get() failed with error " << err << std::endl;
|
||||
std::cout << "rsmi_dev_unique_id_get() failed with error " <<
|
||||
err << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -103,63 +103,64 @@ void TestTempRead::Run(void) {
|
||||
}
|
||||
|
||||
uint32_t type;
|
||||
for (uint32_t x = 0; x < num_iterations(); ++x) {
|
||||
for (uint32_t i = 0; i < num_monitor_devs(); ++i) {
|
||||
PrintDeviceHeader(i);
|
||||
|
||||
for (uint32_t i = 0; i < num_monitor_devs(); ++i) {
|
||||
PrintDeviceHeader(i);
|
||||
auto print_temp_metric = [&](rsmi_temperature_metric_t met,
|
||||
std::string label) {
|
||||
err = rsmi_dev_temp_metric_get(i, type, met, &val_i64);
|
||||
|
||||
auto print_temp_metric = [&](rsmi_temperature_metric_t met,
|
||||
std::string label) {
|
||||
err = rsmi_dev_temp_metric_get(i, type, met, &val_i64);
|
||||
|
||||
if (err != RSMI_STATUS_SUCCESS) {
|
||||
if (err == RSMI_STATUS_NOT_SUPPORTED) {
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "\t**" << label << ": " <<
|
||||
"Not supported on this machine" << std::endl;
|
||||
if (err != RSMI_STATUS_SUCCESS) {
|
||||
if (err == RSMI_STATUS_NOT_SUPPORTED) {
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "\t**" << label << ": " <<
|
||||
"Not supported on this machine" << std::endl;
|
||||
}
|
||||
|
||||
// Verify api support checking functionality is working
|
||||
err = rsmi_dev_temp_metric_get(i, type, met, nullptr);
|
||||
ASSERT_EQ(err, RSMI_STATUS_NOT_SUPPORTED);
|
||||
return;
|
||||
} else {
|
||||
CHK_ERR_ASRT(err)
|
||||
}
|
||||
} else {
|
||||
CHK_ERR_ASRT(err)
|
||||
}
|
||||
}
|
||||
// Verify api support checking functionality is working
|
||||
err = rsmi_dev_temp_metric_get(i, type, met, nullptr);
|
||||
ASSERT_EQ(err, RSMI_STATUS_INVALID_ARGS);
|
||||
// Verify api support checking functionality is working
|
||||
err = rsmi_dev_temp_metric_get(i, type, met, nullptr);
|
||||
ASSERT_EQ(err, RSMI_STATUS_INVALID_ARGS);
|
||||
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "\t**" << label << ": " << val_i64/1000 <<
|
||||
"C" << std::endl;
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "\t**" << label << ": " << val_i64/1000 <<
|
||||
"C" << std::endl;
|
||||
}
|
||||
};
|
||||
for (type = RSMI_TEMP_TYPE_FIRST; type <= RSMI_TEMP_TYPE_LAST; ++type) {
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "\t** **********" << kTempSensorNameMap.at(type) <<
|
||||
" Temperatures **********" << std::endl;
|
||||
}
|
||||
print_temp_metric(RSMI_TEMP_CURRENT, "Current Temp.");
|
||||
print_temp_metric(RSMI_TEMP_MAX, "Temperature max value");
|
||||
print_temp_metric(RSMI_TEMP_MIN, "Temperature min value");
|
||||
print_temp_metric(RSMI_TEMP_MAX_HYST,
|
||||
"Temperature hysteresis value for max limit");
|
||||
print_temp_metric(RSMI_TEMP_MIN_HYST,
|
||||
"Temperature hysteresis value for min limit");
|
||||
print_temp_metric(RSMI_TEMP_CRITICAL, "Temperature critical max value");
|
||||
print_temp_metric(RSMI_TEMP_CRITICAL_HYST,
|
||||
"Temperature hysteresis value for critical limit");
|
||||
print_temp_metric(RSMI_TEMP_EMERGENCY,
|
||||
"Temperature emergency max value");
|
||||
print_temp_metric(RSMI_TEMP_EMERGENCY_HYST,
|
||||
"Temperature hysteresis value for emergency limit");
|
||||
print_temp_metric(RSMI_TEMP_CRIT_MIN, "Temperature critical min value");
|
||||
print_temp_metric(RSMI_TEMP_CRIT_MIN_HYST,
|
||||
"Temperature hysteresis value for critical min value");
|
||||
print_temp_metric(RSMI_TEMP_OFFSET, "Temperature offset");
|
||||
print_temp_metric(RSMI_TEMP_LOWEST, "Historical minimum temperature");
|
||||
print_temp_metric(RSMI_TEMP_HIGHEST, "Historical maximum temperature");
|
||||
}
|
||||
};
|
||||
for (type = RSMI_TEMP_TYPE_FIRST; type <= RSMI_TEMP_TYPE_LAST; ++type) {
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "\t** **********" << kTempSensorNameMap.at(type) <<
|
||||
" Temperatures **********" << std::endl;
|
||||
}
|
||||
print_temp_metric(RSMI_TEMP_CURRENT, "Current Temp.");
|
||||
print_temp_metric(RSMI_TEMP_MAX, "Temperature max value");
|
||||
print_temp_metric(RSMI_TEMP_MIN, "Temperature min value");
|
||||
print_temp_metric(RSMI_TEMP_MAX_HYST,
|
||||
"Temperature hysteresis value for max limit");
|
||||
print_temp_metric(RSMI_TEMP_MIN_HYST,
|
||||
"Temperature hysteresis value for min limit");
|
||||
print_temp_metric(RSMI_TEMP_CRITICAL, "Temperature critical max value");
|
||||
print_temp_metric(RSMI_TEMP_CRITICAL_HYST,
|
||||
"Temperature hysteresis value for critical limit");
|
||||
print_temp_metric(RSMI_TEMP_EMERGENCY,
|
||||
"Temperature emergency max value");
|
||||
print_temp_metric(RSMI_TEMP_EMERGENCY_HYST,
|
||||
"Temperature hysteresis value for emergency limit");
|
||||
print_temp_metric(RSMI_TEMP_CRIT_MIN, "Temperature critical min value");
|
||||
print_temp_metric(RSMI_TEMP_CRIT_MIN_HYST,
|
||||
"Temperature hysteresis value for critical min value");
|
||||
print_temp_metric(RSMI_TEMP_OFFSET, "Temperature offset");
|
||||
print_temp_metric(RSMI_TEMP_LOWEST, "Historical minimum temperature");
|
||||
print_temp_metric(RSMI_TEMP_HIGHEST, "Historical maximum temperature");
|
||||
}
|
||||
}
|
||||
} // x
|
||||
}
|
||||
|
||||
@@ -90,7 +90,9 @@ void TestXGMIReadWrite::Run(void) {
|
||||
|
||||
TestBase::Run();
|
||||
if (setup_failed_) {
|
||||
std::cout << "** SetUp Failed for this test. Skipping.**" << std::endl;
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "** SetUp Failed for this test. Skipping.**" << std::endl;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -91,20 +91,24 @@ static void SetFlags(TestBase *test) {
|
||||
test->set_verbosity(sRSMIGlvalues->verbosity);
|
||||
test->set_dont_fail(sRSMIGlvalues->dont_fail);
|
||||
test->set_init_options(sRSMIGlvalues->init_options);
|
||||
test->set_num_iterations(sRSMIGlvalues->num_iterations);
|
||||
}
|
||||
|
||||
|
||||
static void RunCustomTestProlog(TestBase *test) {
|
||||
SetFlags(test);
|
||||
|
||||
test->DisplayTestInfo();
|
||||
if (sRSMIGlvalues->verbosity >= TestBase::VERBOSE_STANDARD) {
|
||||
test->DisplayTestInfo();
|
||||
}
|
||||
test->SetUp();
|
||||
test->Run();
|
||||
return;
|
||||
}
|
||||
static void RunCustomTestEpilog(TestBase *test) {
|
||||
test->DisplayResults();
|
||||
test->Close();
|
||||
static void RunCustomTestEpilog(TestBase *tst) {
|
||||
if (sRSMIGlvalues->verbosity >= TestBase::VERBOSE_STANDARD) {
|
||||
tst->DisplayResults();
|
||||
}
|
||||
tst->Close();
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -238,7 +242,7 @@ TEST(rsmitstReadOnly, TestAPISupportRead) {
|
||||
}
|
||||
TEST(rsmitstReadOnly, TestMutualExclusion) {
|
||||
TestMutualExclusion tst;
|
||||
|
||||
SetFlags(&tst);
|
||||
tst.DisplayTestInfo();
|
||||
tst.SetUp();
|
||||
tst.Run();
|
||||
@@ -250,6 +254,7 @@ TEST(rsmitstReadWrite, TestEvtNotifReadWrite) {
|
||||
}
|
||||
TEST(rsmitstReadOnly, TestConcurrentInit) {
|
||||
TestConcurrentInit tst;
|
||||
SetFlags(&tst);
|
||||
tst.DisplayTestInfo();
|
||||
// tst.SetUp(); // Avoid extra rsmi_init
|
||||
tst.Run();
|
||||
|
||||
@@ -66,24 +66,28 @@ TestBase::TestBase() : setup_failed_(false), description_("") {
|
||||
TestBase::~TestBase() {
|
||||
}
|
||||
|
||||
void MakeHeaderStr(const char *inStr, std::string *outStr) {
|
||||
void TestBase::MakeHeaderStr(const char *inStr,
|
||||
std::string *outStr) const {
|
||||
assert(outStr != nullptr);
|
||||
assert(inStr != nullptr);
|
||||
|
||||
outStr->clear();
|
||||
*outStr = kLabelDelimiter;
|
||||
*outStr += " ";
|
||||
*outStr += inStr;
|
||||
*outStr += " ";
|
||||
*outStr += kLabelDelimiter;
|
||||
IF_VERB(STANDARD) {
|
||||
*outStr = kLabelDelimiter;
|
||||
*outStr += " ";
|
||||
*outStr += inStr;
|
||||
*outStr += " ";
|
||||
*outStr += kLabelDelimiter;
|
||||
}
|
||||
}
|
||||
|
||||
void TestBase::SetUp(uint64_t init_flags) {
|
||||
std::string label;
|
||||
rsmi_status_t err;
|
||||
|
||||
MakeHeaderStr(kSetupLabel, &label);
|
||||
printf("\n\t%s\n", label.c_str());
|
||||
IF_VERB(STANDARD) {
|
||||
MakeHeaderStr(kSetupLabel, &label);
|
||||
printf("\n\t%s\n", label.c_str());
|
||||
}
|
||||
|
||||
if (init_flags) {
|
||||
err = rsmi_init(init_flags);
|
||||
@@ -103,8 +107,10 @@ void TestBase::SetUp(uint64_t init_flags) {
|
||||
ASSERT_EQ(err, RSMI_STATUS_SUCCESS);
|
||||
|
||||
if (num_monitor_devs_ == 0) {
|
||||
std::cout << "No monitor devices found on this machine." << std::endl;
|
||||
std::cout << "No ROCm SMI tests can be run." << std::endl;
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "No monitor devices found on this machine." << std::endl;
|
||||
std::cout << "No ROCm SMI tests can be run." << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
return;
|
||||
@@ -149,37 +155,44 @@ void TestBase::PrintDeviceHeader(uint32_t dv_ind) {
|
||||
}
|
||||
void TestBase::Run(void) {
|
||||
std::string label;
|
||||
MakeHeaderStr(kRunLabel, &label);
|
||||
printf("\n\t%s\n", label.c_str());
|
||||
IF_VERB(STANDARD) {
|
||||
MakeHeaderStr(kRunLabel, &label);
|
||||
printf("\n\t%s\n", label.c_str());
|
||||
}
|
||||
ASSERT_TRUE(!setup_failed_);
|
||||
}
|
||||
|
||||
void TestBase::Close(void) {
|
||||
std::string label;
|
||||
MakeHeaderStr(kCloseLabel, &label);
|
||||
printf("\n\t%s\n", label.c_str());
|
||||
|
||||
IF_VERB(STANDARD) {
|
||||
MakeHeaderStr(kCloseLabel, &label);
|
||||
printf("\n\t%s\n", label.c_str());
|
||||
}
|
||||
rsmi_status_t err = rsmi_shut_down();
|
||||
ASSERT_EQ(err, RSMI_STATUS_SUCCESS);
|
||||
}
|
||||
|
||||
void TestBase::DisplayResults(void) const {
|
||||
std::string label;
|
||||
MakeHeaderStr(kResultsLabel, &label);
|
||||
printf("\n\t%s\n", label.c_str());
|
||||
IF_VERB(STANDARD) {
|
||||
MakeHeaderStr(kResultsLabel, &label);
|
||||
printf("\n\t%s\n", label.c_str());
|
||||
}
|
||||
}
|
||||
|
||||
void TestBase::DisplayTestInfo(void) {
|
||||
printf("#########################################"
|
||||
IF_VERB(STANDARD) {
|
||||
printf("#########################################"
|
||||
"######################################\n");
|
||||
|
||||
std::string label;
|
||||
MakeHeaderStr(kTitleLabel, &label);
|
||||
printf("\n\t%s\n%s\n", label.c_str(), title().c_str());
|
||||
std::string label;
|
||||
MakeHeaderStr(kTitleLabel, &label);
|
||||
printf("\n\t%s\n%s\n", label.c_str(), title().c_str());
|
||||
|
||||
if (verbosity() >= VERBOSE_STANDARD) {
|
||||
MakeHeaderStr(kDescriptionLabel, &label);
|
||||
printf("\n\t%s\n%s\n", label.c_str(), description().c_str());
|
||||
if (verbosity() >= VERBOSE_STANDARD) {
|
||||
MakeHeaderStr(kDescriptionLabel, &label);
|
||||
printf("\n\t%s\n%s\n", label.c_str(), description().c_str());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -107,8 +107,15 @@ class TestBase {
|
||||
uint64_t init_options(void) const {
|
||||
return init_options_;
|
||||
}
|
||||
void set_num_iterations(uint32_t x) {
|
||||
num_iterations_ = x;
|
||||
}
|
||||
uint32_t num_iterations(void) const {
|
||||
return num_iterations_;
|
||||
}
|
||||
|
||||
protected:
|
||||
void MakeHeaderStr(const char *inStr, std::string *outStr) const;
|
||||
void PrintDeviceHeader(uint32_t dv_ind);
|
||||
bool setup_failed_; ///< Record that setup failed to return ierr in Run
|
||||
|
||||
@@ -119,9 +126,11 @@ class TestBase {
|
||||
uint32_t verbosity_; ///< How much additional output to produce
|
||||
bool dont_fail_; ///< Don't quit test on individual failure if true
|
||||
uint64_t init_options_; ///< rsmi initialization options
|
||||
uint32_t num_iterations_;
|
||||
};
|
||||
|
||||
#define IF_VERB(VB) if (verbosity() && verbosity() >= (TestBase::VERBOSE_##VB))
|
||||
#define IF_NVERB(VB) if (verbosity() < (TestBase::VERBOSE_##VB))
|
||||
|
||||
// Macros to be used within TestBase classes
|
||||
#define CHK_ERR_ASRT(RET) { \
|
||||
|
||||
@@ -77,7 +77,8 @@ NameFromFWEnum(rsmi_fw_block_t blk) {
|
||||
return kDevFWNameMap.at(blk);
|
||||
}
|
||||
|
||||
static const std::map<rsmi_evt_notification_type_t, const char *> kEvtNotifEvntNameMap = {
|
||||
static const std::map<rsmi_evt_notification_type_t, const char *>
|
||||
kEvtNotifEvntNameMap = {
|
||||
{RSMI_EVT_NOTIF_VMFAULT, "RSMI_EVT_NOTIF_VMFAULT"},
|
||||
};
|
||||
const char *
|
||||
|
||||
Fai riferimento in un nuovo problema
Block a user