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() {
validate_ = 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_blocking_run_ = getenv("ROCR_BW_RUN_BLOCKING");
skip_fine_grain_ = getenv("ROCM_SKIP_FINE_GRAINED_POOL");
......@@ -533,3 +539,12 @@ RocmBandwidthTest::RocmBandwidthTest(int argc, char** argv) : BaseTest() {
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 {
friend hsa_status_t AgentInfo(hsa_agent_t agent, 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
// vector<transaction> tran_;
......
......@@ -82,6 +82,7 @@ void RocmBandwidthTest::ParseArguments() {
bool print_help = false;
bool copy_all_bi = false;
bool copy_all_uni = false;
bool print_version = false;
bool print_topology = false;
// This will suppress prints from getopt implementation
......@@ -91,7 +92,7 @@ void RocmBandwidthTest::ParseArguments() {
int opt;
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) {
// Print help screen
......@@ -99,6 +100,11 @@ void RocmBandwidthTest::ParseArguments() {
print_help = true;
break;
// Print version of the test
case 'q':
print_version = true;
break;
// Print Cpu time
case 'c':
print_cpu_time_ = true;
......@@ -205,6 +211,12 @@ void RocmBandwidthTest::ParseArguments() {
exit(0);
}
// Print version of the test
if (print_version) {
PrintVersion();
exit(0);
}
// Initialize Roc Runtime
err_ = hsa_init();
ErrorCheck(err_);
......
......@@ -50,6 +50,7 @@ void RocmBandwidthTest::PrintHelpScreen() {
std::cout << "Supported arguments:" << std::endl;
std::cout << 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 -c Time the operation using CPU Timers" << std::endl;
std::cout << "\t -t Prints system topology and allocatable memory info" << std::endl;
......@@ -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
void RocmBandwidthTest::PrintTopology() {
......
......@@ -146,8 +146,9 @@ void RocmBandwidthTest::Display() const {
std::cout << std::endl;
return;
}
if (validate_) {
PrintVersion();
DisplayDevInfo();
PrintAccessMatrix();
DisplayValidationMatrix();
......@@ -155,6 +156,7 @@ void RocmBandwidthTest::Display() const {
}
if (req_copy_all_unidir_ == REQ_COPY_ALL_UNIDIR) {
PrintVersion();
DisplayDevInfo();
PrintAccessMatrix();
PrintLinkMatrix();
......@@ -164,8 +166,10 @@ void RocmBandwidthTest::Display() const {
if (req_copy_all_bidir_ == REQ_COPY_ALL_BIDIR) {
if (bw_default_run_ == NULL) {
PrintVersion();
DisplayDevInfo();
PrintAccessMatrix();
PrintLinkMatrix();
}
DisplayCopyTimeMatrix(true);
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