From a356fed9590e8dbd2e4a91444b8644fb14ce10a0 Mon Sep 17 00:00:00 2001 From: Manoj S K Date: Mon, 2 Dec 2024 02:54:07 -0800 Subject: [PATCH 1/8] pbqt pass fail criteria and enable custom json location --- include/rvsliblogger.h | 5 +++-- pbqt.so/src/action.cpp | 4 ++-- pbqt.so/src/action_run.cpp | 6 ++++-- pebb.so/src/action_run.cpp | 2 +- rvs/src/rvsexec.cpp | 7 +++++++ src/rvsliblogger.cpp | 40 ++++++++++++++++++++++++++++++++++---- 6 files changed, 53 insertions(+), 11 deletions(-) diff --git a/include/rvsliblogger.h b/include/rvsliblogger.h index a1d7e4e3..64269f2f 100644 --- a/include/rvsliblogger.h +++ b/include/rvsliblogger.h @@ -28,7 +28,8 @@ #include #include #include "include/rvsliblog.h" - +bool isPathedFile(const std::string &fname); +bool doesFolderExist(const std::string &fname); namespace rvs { @@ -54,7 +55,7 @@ class logger { static void quiet() { b_quiet = true; } //! set logging file static void set_log_file(const std::string& fname); - + static void set_json_log_file(const std::string& fname); static bool get_ticks(uint32_t* psecs, uint32_t* pusecs); static int init_log_file(); diff --git a/pbqt.so/src/action.cpp b/pbqt.so/src/action.cpp index 6f0090d5..4bd5c37a 100644 --- a/pbqt.so/src/action.cpp +++ b/pbqt.so/src/action.cpp @@ -1,6 +1,6 @@ /******************************************************************************** * - * Copyright (c) 2018-2022 Advanced Micro Devices, Inc. All rights reserved. + * Copyright (c) 2018-2024 Advanced Micro Devices, Inc. All rights reserved. * * MIT LICENSE: * Permission is hereby granted, free of charge, to any person obtaining a copy of @@ -276,7 +276,7 @@ void pbqt_action::log_json_data(std::string srcnode, std::string dstnode, default: break; } - + json_add_kv(json_node, "pass", "true"); json_to_file(json_node, log_level); } } diff --git a/pbqt.so/src/action_run.cpp b/pbqt.so/src/action_run.cpp index fde262bb..a1898e64 100644 --- a/pbqt.so/src/action_run.cpp +++ b/pbqt.so/src/action_run.cpp @@ -1,6 +1,6 @@ /******************************************************************************** * - * Copyright (c) 2018-2022 Advanced Micro Devices, Inc. All rights reserved. + * Copyright (c) 2018-2024 Advanced Micro Devices, Inc. All rights reserved. * * MIT LICENSE: * Permission is hereby granted, free of charge, to any person obtaining a copy of @@ -156,7 +156,9 @@ int pbqt_action::run() { action_result.status = rvs::actionstatus::ACTION_FAILED; action_result.output = "Parameters not valid. Nothing to execute !!!"; action_callback(&action_result); - + if(bjson){ + rvs::lp::JsonActionEndNodeCreate(); + } return 0; } diff --git a/pebb.so/src/action_run.cpp b/pebb.so/src/action_run.cpp index a467131b..c73339d3 100644 --- a/pebb.so/src/action_run.cpp +++ b/pebb.so/src/action_run.cpp @@ -1,6 +1,6 @@ /******************************************************************************** * - * Copyright (c) 2018-2022 Advanced Micro Devices, Inc. All rights reserved. + * Copyright (c) 2018-2024 Advanced Micro Devices, Inc. All rights reserved. * * MIT LICENSE: * Permission is hereby granted, free of charge, to any person obtaining a copy of diff --git a/rvs/src/rvsexec.cpp b/rvs/src/rvsexec.cpp index 58b9ed1f..57122219 100644 --- a/rvs/src/rvsexec.cpp +++ b/rvs/src/rvsexec.cpp @@ -127,6 +127,13 @@ int rvs::exec::run() { logger::to_json(true); } + // check -x option + std::string s_json_log_file; + if (rvs::options::has_option("-x", &s_json_log_file)) { + logger::set_json_log_file(s_json_log_file); + } + + // check -c option string config_file; if (rvs::options::has_option("-c", &val)) { diff --git a/src/rvsliblogger.cpp b/src/rvsliblogger.cpp index 37ed3050..57c7cfd5 100644 --- a/src/rvsliblogger.cpp +++ b/src/rvsliblogger.cpp @@ -23,6 +23,9 @@ * *******************************************************************************/ #include "include/rvsliblogger.h" +#include +#include +#include #include #include @@ -71,6 +74,24 @@ const std::string list_start{"["}; const std::string list_end{"]"}; const std::string newline{"\n"}; const std::string json_folder{"/var/tmp/"}; + +bool isPathedFile(const std::string &fname){ + return fname.find('/') != std::string::npos ; +} + +bool doesFolderExist(const std::string &fname){ + auto loc = fname.find_last_of('/'); + auto dirName = fname.substr(0,loc); + DIR* dir = opendir(dirName.c_str()); + if (dir == NULL) { + // try creating directory, this doesnt exist + int ret = mkdir(dirName.c_str(), S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH ); + return ret == 0; + } else + return true; +} + + /** * @brief Set 'append' flag * @@ -95,6 +116,17 @@ void rvs::logger::set_log_file(const std::string& fname) { strncpy(log_file, fname.c_str(), sizeof(log_file)); } + +void rvs::logger::set_json_log_file(const std::string& fname) { + json_log_file = fname; + if (isPathedFile(json_log_file)){ + if (!doesFolderExist(json_log_file)){ + std::cout << "Unable to create json log file, check path."; + } + } + +} + /** * @brief Set logging level * @@ -340,8 +372,6 @@ int rvs::logger::JsonStartNodeCreate(const char* Module, const char* Action) { } std::string row{node_start}; row += std::string("\"") + Module + std::string("\"") + kv_delimit + node_start + newline; - //row += RVSINDENT; - //row += std::string("\"") + Action + std::string("\"") + kv_delimit + list_start + newline; std::lock_guard lk(json_log_mutex); return ToFile(row, true); } @@ -491,10 +521,12 @@ int rvs::logger::ToFile(const std::string& Row, bool json_rec) { logfile.assign(log_file); if (logfile == "") return -1; - + // check if folder, and if it exists/can be created. std::fstream fs; - fs.open(logfile, std::fstream::out | std::fstream::app); + fs.open(logfile, std::fstream::out | std::fstream::app); + if (fs.fail()) + return -1; fs << Row; fs.close(); From 145e4885413fe5aee95818d0e0235fad06e1f494 Mon Sep 17 00:00:00 2001 From: Manoj S K Date: Mon, 2 Dec 2024 03:07:28 -0800 Subject: [PATCH 2/8] add json location option to docs and CLI output --- docs/cli.md | 2 ++ docs/ug1main.md | 3 +++ rvs/src/rvscli.cpp | 4 ++++ rvs/src/rvsexec.cpp | 2 ++ src/rvsliblogger.cpp | 6 ++++++ 5 files changed, 17 insertions(+) diff --git a/docs/cli.md b/docs/cli.md index bd2f6645..3c645bd0 100644 --- a/docs/cli.md +++ b/docs/cli.md @@ -30,6 +30,8 @@ -l --debugLogFile Generate log file with output and debug information. +-x --jsonLogFile Specify json log file location. + -t --listTests List the test modules present in RVS. -v --verbose Enable verbose reporting. Equivalent to specifying -d 5 option. diff --git a/docs/ug1main.md b/docs/ug1main.md index cb233b88..1699860c 100644 --- a/docs/ug1main.md +++ b/docs/ug1main.md @@ -266,6 +266,9 @@ configuration file, including the ‘all’ value. -l--debugLogFileGenerate log file with output and debug information. +-x--jsonLogFileSpecify json log file location. + + -t--listTestsList the test modules present in RVS. diff --git a/rvs/src/rvscli.cpp b/rvs/src/rvscli.cpp index e2bea0b0..bb1e30bb 100644 --- a/rvs/src/rvscli.cpp +++ b/rvs/src/rvscli.cpp @@ -159,6 +159,10 @@ void rvs::cli::init_grammar() { grammar.insert(gpair("-l", sp)); grammar.insert(gpair("--debugLogFile", sp)); + sp = std::make_shared("-x", command, value); + grammar.insert(gpair("-x", sp)); + grammar.insert(gpair("--jsonLogFile", sp)); + sp = std::make_shared("-q", command); grammar.insert(gpair("-q", sp)); grammar.insert(gpair("--quiet", sp)); diff --git a/rvs/src/rvsexec.cpp b/rvs/src/rvsexec.cpp index 57122219..24d4ecd7 100644 --- a/rvs/src/rvsexec.cpp +++ b/rvs/src/rvsexec.cpp @@ -468,6 +468,8 @@ void rvs::exec::do_help() { cout << "-j --json Generate output file in JSON format.\n\n"; cout << "-l --debugLogFile Generate log file with output and debug information.\n\n"; + + cout << "-x --jsonLogFile Specify json log file location.\n\n"; cout << "-t --listTests List the test modules present in RVS.\n\n"; diff --git a/src/rvsliblogger.cpp b/src/rvsliblogger.cpp index 57c7cfd5..e1285449 100644 --- a/src/rvsliblogger.cpp +++ b/src/rvsliblogger.cpp @@ -114,6 +114,12 @@ bool rvs::logger::append() { void rvs::logger::set_log_file(const std::string& fname) { strncpy(log_file, fname.c_str(), sizeof(log_file)); + if (isPathedFile(log_file)){ + if (!doesFolderExist(log_file)){ + std::cout << "Unable to create log file, check path."; + } + } + } From df4c388daf9d0122853c79e864977ffe8e6367cd Mon Sep 17 00:00:00 2001 From: Manoj S K Date: Tue, 3 Dec 2024 02:59:59 -0800 Subject: [PATCH 3/8] fix issue where if we provide json name, no module name printed --- include/rvsliblogger.h | 2 ++ src/rvsliblogger.cpp | 4 +++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/include/rvsliblogger.h b/include/rvsliblogger.h index 64269f2f..35f83e85 100644 --- a/include/rvsliblogger.h +++ b/include/rvsliblogger.h @@ -93,6 +93,8 @@ class logger { static bool tojson_m; //! 'true' if append to existing log file is requested static bool append_m; + // state of module specific logs written, only to be run once + static bool initModule; //! 'true' if the incoming record is the first record in this rvs invocation static bool isfirstrecord_m; //! 'true' if the creating record is the first action in rvs invocation diff --git a/src/rvsliblogger.cpp b/src/rvsliblogger.cpp index e1285449..a8e390fc 100644 --- a/src/rvsliblogger.cpp +++ b/src/rvsliblogger.cpp @@ -54,6 +54,7 @@ int rvs::logger::loglevel_m(2); bool rvs::logger::tojson_m(false); bool rvs::logger::append_m(false); bool rvs::logger::isfirstrecord_m(true); +bool rvs::logger::initModule(true); bool rvs::logger::isfirstaction_m(true); std::mutex rvs::logger::cout_mutex; std::mutex rvs::logger::log_mutex; @@ -383,8 +384,9 @@ int rvs::logger::JsonStartNodeCreate(const char* Module, const char* Action) { } int rvs::logger::JsonActionStartNodeCreate(const char* Module, const char* Action) { - if(json_log_file.empty()){ + if(initModule || json_log_file.empty()){ rvs::logger::JsonStartNodeCreate(Module, Action); + initModule = false; } isfirstrecord_m = true; std::string row{newline}; From e49d40b853b66a5e5f07b9b278f82738b4fcb0bf Mon Sep 17 00:00:00 2001 From: Mohammed Junaid Date: Tue, 3 Dec 2024 13:58:09 -0600 Subject: [PATCH 4/8] Changes for ROCm 6.3 --- CHANGELOG.md | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 34241245..e41ace0a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,17 @@ Full documentation for RVS is available at [ROCmValidationSuite.Readme](https://github.com/ROCm/ROCmValidationSuite). +## RVS 1.1.0 for ROCm 6.3.0 + +### Added + +- Support for hipBLASLT blas library and option to select blas library in conf. file. +- Added Babel, thermal and performance benchmark test for MI308X. + +### Changed + +- Babel parameters made runtime configurable. + ## RVS 1.0.0 for ROCm 6.2.0 ### Added From a0e402dde5cfcb099da41c8d2c98a49d04984837 Mon Sep 17 00:00:00 2001 From: Manoj S K Date: Thu, 5 Dec 2024 01:43:27 -0800 Subject: [PATCH 5/8] use optional values for json file locartion --- rvs/src/rvscli.cpp | 3 --- rvs/src/rvsexec.cpp | 14 ++++++------ src/rvsliblogger.cpp | 51 ++++++++++++++++++++++++++------------------ 3 files changed, 36 insertions(+), 32 deletions(-) diff --git a/rvs/src/rvscli.cpp b/rvs/src/rvscli.cpp index 418333df..2525c3e4 100644 --- a/rvs/src/rvscli.cpp +++ b/rvs/src/rvscli.cpp @@ -159,9 +159,6 @@ void rvs::cli::init_grammar() { grammar.insert(gpair("-l", sp)); grammar.insert(gpair("--debugLogFile", sp)); - sp = std::make_shared("-x", command, value); - grammar.insert(gpair("-x", sp)); - grammar.insert(gpair("--jsonLogFile", sp)); sp = std::make_shared("-q", command); grammar.insert(gpair("-q", sp)); diff --git a/rvs/src/rvsexec.cpp b/rvs/src/rvsexec.cpp index 24d4ecd7..1eadfd29 100644 --- a/rvs/src/rvsexec.cpp +++ b/rvs/src/rvsexec.cpp @@ -123,17 +123,13 @@ int rvs::exec::run() { } // check -j option - if (rvs::options::has_option("-j", &val)) { - logger::to_json(true); - } - - // check -x option std::string s_json_log_file; - if (rvs::options::has_option("-x", &s_json_log_file)) { + if (rvs::options::has_option("-j", &s_json_log_file)) { + logger::to_json(true); logger::set_json_log_file(s_json_log_file); + } - // check -c option string config_file; if (rvs::options::has_option("-c", &val)) { @@ -453,7 +449,9 @@ void rvs::exec::do_help() { cout << "-a --appendLog When generating a debug logfile, do not overwrite the content\n"; cout << " of the current log. Use in conjuction with -d and -l options.\n\n"; - cout << "-c --config Specify the test configuration file to use.\n\n"; + cout << "-c --config Specify the test configuration file to use.\n"; + cout << " location of log can be specified following this option, if none \n"; + cout << " specified a file is created in /var/usr and name is output to stdout\n\n"; cout << "-d --debugLevel Specify the debug level for the output log. The range is 0-5 with\n"; cout << " 5 being the highest verbose level.\n\n"; diff --git a/src/rvsliblogger.cpp b/src/rvsliblogger.cpp index a8e390fc..04c6416c 100644 --- a/src/rvsliblogger.cpp +++ b/src/rvsliblogger.cpp @@ -93,6 +93,21 @@ bool doesFolderExist(const std::string &fname){ } +/** + * @brief helper to create json file name + * @return json file name + */ +std::string json_filename(){ + std::string json_file; + json_file.assign("rvs"); + std::chrono::milliseconds ms = std::chrono::duration_cast< std::chrono::milliseconds >( + std::chrono::system_clock::now().time_since_epoch()); + json_file = json_file + "_" + std::to_string(ms.count()) + ".json"; + json_file = json_folder + json_file; + return json_file; +} + + /** * @brief Set 'append' flag * @@ -125,13 +140,20 @@ void rvs::logger::set_log_file(const std::string& fname) { void rvs::logger::set_json_log_file(const std::string& fname) { - json_log_file = fname; - if (isPathedFile(json_log_file)){ - if (!doesFolderExist(json_log_file)){ - std::cout << "Unable to create json log file, check path."; - } + std::stringstream ss; + if (!fname.empty()){ + json_log_file = fname; + if (isPathedFile(fname) && !doesFolderExist(fname)){ + json_log_file = json_filename(); + ss << "Unable to create Json log file specified at" << fname << std::endl; + } + + }else{ + json_log_file = json_filename(); } - + ss << "Json log file created at " << json_log_file << std::endl; + std::lock_guard lk(cout_mutex); + std::cout << ss.str(); } /** @@ -301,19 +323,6 @@ int rvs::logger::LogExt(const char* Message, const int LogLevel, return 0; } -/** - * @brief helper to create json file name - * @return json file name - */ -std::string json_filename(const char* moduleName){ - std::string json_file; - json_file.assign(moduleName); - std::chrono::milliseconds ms = std::chrono::duration_cast< std::chrono::milliseconds >( - std::chrono::system_clock::now().time_since_epoch()); - json_file = json_file + "_" + std::to_string(ms.count()) + ".json"; - json_file = json_folder + json_file; - return json_file; -} /** * @brief Create log record @@ -334,7 +343,7 @@ void* rvs::logger::LogRecordCreate(const char* Module, const char* Action, uint32_t sec; uint32_t usec; if( json_log_file.empty()){ - json_log_file = json_filename(Module); + json_log_file = json_filename(); std::lock_guard lk(cout_mutex); std::cout << "json log file is " << json_log_file<< std::endl; } @@ -373,7 +382,7 @@ void* rvs::logger::LogRecordCreate(const char* Module, const char* Action, #if 1 int rvs::logger::JsonStartNodeCreate(const char* Module, const char* Action) { if ( json_log_file.empty()){ - json_log_file = json_filename(Module); + json_log_file = json_filename(); std::lock_guard lk(cout_mutex); std::cout << "json log file is " << json_log_file<< std::endl; } From c50346065e50cb5f1bc3df2edb65db765f4eb130 Mon Sep 17 00:00:00 2001 From: Manoj S K Date: Thu, 5 Dec 2024 02:26:20 -0800 Subject: [PATCH 6/8] bug fixes --- src/rvsliblogger.cpp | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/src/rvsliblogger.cpp b/src/rvsliblogger.cpp index 04c6416c..b8000ce3 100644 --- a/src/rvsliblogger.cpp +++ b/src/rvsliblogger.cpp @@ -85,14 +85,23 @@ bool doesFolderExist(const std::string &fname){ auto dirName = fname.substr(0,loc); DIR* dir = opendir(dirName.c_str()); if (dir == NULL) { - // try creating directory, this doesnt exist + std::cout << "here in no dir"<< std::endl; + // try creating directory, this doesnt exist. if fails return int ret = mkdir(dirName.c_str(), S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH ); - return ret == 0; - } else - return true; + if (ret){ + std::cout << "mkdir fails" << std::endl; + return false; + } + } + std::fstream fs; + fs.open(fname); + if (fs.fail()){ + std::cout << "fopen fail :" << fname < Date: Thu, 5 Dec 2024 08:21:00 -0800 Subject: [PATCH 7/8] logical fixes and using -j as both option to json and filename --- docs/cli.md | 4 ++-- docs/ug1main.md | 5 ++--- rvs/src/rvsexec.cpp | 5 +++-- src/rvsliblogger.cpp | 7 ++----- 4 files changed, 9 insertions(+), 12 deletions(-) diff --git a/docs/cli.md b/docs/cli.md index 3c645bd0..1d410167 100644 --- a/docs/cli.md +++ b/docs/cli.md @@ -27,10 +27,10 @@ configuration file, including the ‘all’ value. -j --json Generate output file in JSON format. - + if a path follows this argument, that will be used as json log file; + else a file created in /var/tmp/ with timestamp in name. -l --debugLogFile Generate log file with output and debug information. --x --jsonLogFile Specify json log file location. -t --listTests List the test modules present in RVS. diff --git a/docs/ug1main.md b/docs/ug1main.md index 1699860c..e0aa4e00 100644 --- a/docs/ug1main.md +++ b/docs/ug1main.md @@ -261,14 +261,13 @@ configuration file, including the ‘all’ value. -j--jsonGenerate output file in JSON format. +if a path follows this argument, that will be used as json log file; +else a file created in /var/tmp/ with timestamp in name. -l--debugLogFileGenerate log file with output and debug information. --x--jsonLogFileSpecify json log file location. - - -t--listTestsList the test modules present in RVS. diff --git a/rvs/src/rvsexec.cpp b/rvs/src/rvsexec.cpp index 1eadfd29..2039ed2e 100644 --- a/rvs/src/rvsexec.cpp +++ b/rvs/src/rvsexec.cpp @@ -463,11 +463,12 @@ void rvs::exec::do_help() { cout << " the device values specified for every actions in the\n"; cout << " configuration file, including the ‘all’ value.\n\n"; - cout << "-j --json Generate output file in JSON format.\n\n"; + cout << "-j --json Generate output file in JSON format.\n"; + cout << " if a path follows this argument, that will be used as json log file\n"; + cout << " else a file created in /var/tmp/ with timestamp in name.\n\n"; cout << "-l --debugLogFile Generate log file with output and debug information.\n\n"; - cout << "-x --jsonLogFile Specify json log file location.\n\n"; cout << "-t --listTests List the test modules present in RVS.\n\n"; diff --git a/src/rvsliblogger.cpp b/src/rvsliblogger.cpp index b8000ce3..71a30360 100644 --- a/src/rvsliblogger.cpp +++ b/src/rvsliblogger.cpp @@ -85,18 +85,15 @@ bool doesFolderExist(const std::string &fname){ auto dirName = fname.substr(0,loc); DIR* dir = opendir(dirName.c_str()); if (dir == NULL) { - std::cout << "here in no dir"<< std::endl; // try creating directory, this doesnt exist. if fails return int ret = mkdir(dirName.c_str(), S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH ); if (ret){ - std::cout << "mkdir fails" << std::endl; return false; } } std::fstream fs; - fs.open(fname); - if (fs.fail()){ - std::cout << "fopen fail :" << fname < Date: Fri, 6 Dec 2024 00:37:03 -0800 Subject: [PATCH 8/8] corrections in options --- rvs/src/rvscli.cpp | 1 - rvs/src/rvsexec.cpp | 4 +--- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/rvs/src/rvscli.cpp b/rvs/src/rvscli.cpp index 2525c3e4..c76cd41d 100644 --- a/rvs/src/rvscli.cpp +++ b/rvs/src/rvscli.cpp @@ -159,7 +159,6 @@ void rvs::cli::init_grammar() { grammar.insert(gpair("-l", sp)); grammar.insert(gpair("--debugLogFile", sp)); - sp = std::make_shared("-q", command); grammar.insert(gpair("-q", sp)); grammar.insert(gpair("--quiet", sp)); diff --git a/rvs/src/rvsexec.cpp b/rvs/src/rvsexec.cpp index 2039ed2e..dc1e3347 100644 --- a/rvs/src/rvsexec.cpp +++ b/rvs/src/rvsexec.cpp @@ -449,9 +449,7 @@ void rvs::exec::do_help() { cout << "-a --appendLog When generating a debug logfile, do not overwrite the content\n"; cout << " of the current log. Use in conjuction with -d and -l options.\n\n"; - cout << "-c --config Specify the test configuration file to use.\n"; - cout << " location of log can be specified following this option, if none \n"; - cout << " specified a file is created in /var/usr and name is output to stdout\n\n"; + cout << "-c --config Specify the test configuration file to use.\n\n"; cout << "-d --debugLevel Specify the debug level for the output log. The range is 0-5 with\n"; cout << " 5 being the highest verbose level.\n\n";