Commit da9e8b50 authored by Ramesh Errabolu's avatar Ramesh Errabolu
Browse files

Add version info for the test

parent 8232c294
...@@ -524,6 +524,12 @@ RocmBandwidthTest::RocmBandwidthTest(int argc, char** argv) : BaseTest() { ...@@ -524,6 +524,12 @@ RocmBandwidthTest::RocmBandwidthTest(int argc, char** argv) : BaseTest() {
validate_ = false; validate_ = false;
print_cpu_time_ = false; print_cpu_time_ = false;
// Initialize version of the test
version_.major_id = 1;
version_.minor_id = 0;
version_.step_id = 0;
version_.reserved = 0;
bw_default_run_ = getenv("ROCM_BW_DEFAULT_RUN"); bw_default_run_ = getenv("ROCM_BW_DEFAULT_RUN");
bw_blocking_run_ = getenv("ROCR_BW_RUN_BLOCKING"); bw_blocking_run_ = getenv("ROCR_BW_RUN_BLOCKING");
skip_fine_grain_ = getenv("ROCM_SKIP_FINE_GRAINED_POOL"); skip_fine_grain_ = getenv("ROCM_SKIP_FINE_GRAINED_POOL");
...@@ -533,3 +539,12 @@ RocmBandwidthTest::RocmBandwidthTest(int argc, char** argv) : BaseTest() { ...@@ -533,3 +539,12 @@ RocmBandwidthTest::RocmBandwidthTest(int argc, char** argv) : BaseTest() {
RocmBandwidthTest::~RocmBandwidthTest() { } RocmBandwidthTest::~RocmBandwidthTest() { }
std::string RocmBandwidthTest::GetVersion() const {
std::stringstream stream;
stream << version_.major_id << ".";
stream << version_.minor_id << ".";
stream << version_.step_id;
return stream.str();
}
...@@ -323,8 +323,29 @@ class RocmBandwidthTest : public BaseTest { ...@@ -323,8 +323,29 @@ class RocmBandwidthTest : public BaseTest {
friend hsa_status_t AgentInfo(hsa_agent_t agent, void* data); friend hsa_status_t AgentInfo(hsa_agent_t agent, void* data);
friend hsa_status_t MemPoolInfo(hsa_amd_memory_pool_t pool, void* data); friend hsa_status_t MemPoolInfo(hsa_amd_memory_pool_t pool, void* data);
protected: // Structure of Version used to identify an instance of RocmBandwidthTest
struct RocmBandwidthVersion {
// Tracks changes such as re-design
// re-factor, re-write, extend with
// new major functionality, etc
uint32_t major_id;
// Tracks changes that affect Apis
// being added, removed, modified
uint32_t minor_id;
// Tracks changes that affect Apis
// being added, removed, modified
uint32_t step_id;
// Used to pack space for structure alignment
uint32_t reserved;
};
RocmBandwidthVersion version_;
void PrintVersion() const;
std::string GetVersion() const;
// More variables declared for testing // More variables declared for testing
// vector<transaction> tran_; // vector<transaction> tran_;
......
...@@ -82,6 +82,7 @@ void RocmBandwidthTest::ParseArguments() { ...@@ -82,6 +82,7 @@ void RocmBandwidthTest::ParseArguments() {
bool print_help = false; bool print_help = false;
bool copy_all_bi = false; bool copy_all_bi = false;
bool copy_all_uni = false; bool copy_all_uni = false;
bool print_version = false;
bool print_topology = false; bool print_topology = false;
// This will suppress prints from getopt implementation // This will suppress prints from getopt implementation
...@@ -91,7 +92,7 @@ void RocmBandwidthTest::ParseArguments() { ...@@ -91,7 +92,7 @@ void RocmBandwidthTest::ParseArguments() {
int opt; int opt;
bool status; bool status;
while ((opt = getopt(usr_argc_, usr_argv_, "hvctaAb:s:d:r:w:m:")) != -1) { while ((opt = getopt(usr_argc_, usr_argv_, "hqvctaAb:s:d:r:w:m:")) != -1) {
switch (opt) { switch (opt) {
// Print help screen // Print help screen
...@@ -99,6 +100,11 @@ void RocmBandwidthTest::ParseArguments() { ...@@ -99,6 +100,11 @@ void RocmBandwidthTest::ParseArguments() {
print_help = true; print_help = true;
break; break;
// Print version of the test
case 'q':
print_version = true;
break;
// Print Cpu time // Print Cpu time
case 'c': case 'c':
print_cpu_time_ = true; print_cpu_time_ = true;
...@@ -205,6 +211,12 @@ void RocmBandwidthTest::ParseArguments() { ...@@ -205,6 +211,12 @@ void RocmBandwidthTest::ParseArguments() {
exit(0); exit(0);
} }
// Print version of the test
if (print_version) {
PrintVersion();
exit(0);
}
// Initialize Roc Runtime // Initialize Roc Runtime
err_ = hsa_init(); err_ = hsa_init();
ErrorCheck(err_); ErrorCheck(err_);
......
...@@ -50,6 +50,7 @@ void RocmBandwidthTest::PrintHelpScreen() { ...@@ -50,6 +50,7 @@ void RocmBandwidthTest::PrintHelpScreen() {
std::cout << "Supported arguments:" << std::endl; std::cout << "Supported arguments:" << std::endl;
std::cout << std::endl; std::cout << std::endl;
std::cout << "\t -h Prints the help screen" << std::endl; std::cout << "\t -h Prints the help screen" << std::endl;
std::cout << "\t -q Query version of the test" << std::endl;
std::cout << "\t -v Run the test in validation mode" << std::endl; std::cout << "\t -v Run the test in validation mode" << std::endl;
std::cout << "\t -c Time the operation using CPU Timers" << std::endl; std::cout << "\t -c Time the operation using CPU Timers" << std::endl;
std::cout << "\t -t Prints system topology and allocatable memory info" << std::endl; std::cout << "\t -t Prints system topology and allocatable memory info" << std::endl;
...@@ -65,6 +66,18 @@ void RocmBandwidthTest::PrintHelpScreen() { ...@@ -65,6 +66,18 @@ void RocmBandwidthTest::PrintHelpScreen() {
} }
// @brief: Print the version of the test
void RocmBandwidthTest::PrintVersion() const {
uint32_t format = 10;
std::cout.setf(ios::left);
std::cout << std::endl;
std::cout.width(format);
std::cout << "";
std::cout << "RocmBandwidthTest Version: " << GetVersion() << std::endl;
}
// @brief: Print the topology of Memory Pools and Devices present in system // @brief: Print the topology of Memory Pools and Devices present in system
void RocmBandwidthTest::PrintTopology() { void RocmBandwidthTest::PrintTopology() {
......
...@@ -146,8 +146,9 @@ void RocmBandwidthTest::Display() const { ...@@ -146,8 +146,9 @@ void RocmBandwidthTest::Display() const {
std::cout << std::endl; std::cout << std::endl;
return; return;
} }
if (validate_) { if (validate_) {
PrintVersion();
DisplayDevInfo(); DisplayDevInfo();
PrintAccessMatrix(); PrintAccessMatrix();
DisplayValidationMatrix(); DisplayValidationMatrix();
...@@ -155,6 +156,7 @@ void RocmBandwidthTest::Display() const { ...@@ -155,6 +156,7 @@ void RocmBandwidthTest::Display() const {
} }
if (req_copy_all_unidir_ == REQ_COPY_ALL_UNIDIR) { if (req_copy_all_unidir_ == REQ_COPY_ALL_UNIDIR) {
PrintVersion();
DisplayDevInfo(); DisplayDevInfo();
PrintAccessMatrix(); PrintAccessMatrix();
PrintLinkMatrix(); PrintLinkMatrix();
...@@ -164,8 +166,10 @@ void RocmBandwidthTest::Display() const { ...@@ -164,8 +166,10 @@ void RocmBandwidthTest::Display() const {
if (req_copy_all_bidir_ == REQ_COPY_ALL_BIDIR) { if (req_copy_all_bidir_ == REQ_COPY_ALL_BIDIR) {
if (bw_default_run_ == NULL) { if (bw_default_run_ == NULL) {
PrintVersion();
DisplayDevInfo(); DisplayDevInfo();
PrintAccessMatrix(); PrintAccessMatrix();
PrintLinkMatrix();
} }
DisplayCopyTimeMatrix(true); DisplayCopyTimeMatrix(true);
return; return;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment