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 diff --git a/docs/cli.md b/docs/cli.md index bd2f6645..1d410167 100644 --- a/docs/cli.md +++ b/docs/cli.md @@ -27,9 +27,11 @@ 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. + -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..e0aa4e00 100644 --- a/docs/ug1main.md +++ b/docs/ug1main.md @@ -261,6 +261,8 @@ 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. diff --git a/include/rvsliblogger.h b/include/rvsliblogger.h index a1d7e4e3..35f83e85 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(); @@ -92,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/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..dc1e3347 100644 --- a/rvs/src/rvsexec.cpp +++ b/rvs/src/rvsexec.cpp @@ -123,8 +123,11 @@ int rvs::exec::run() { } // check -j option - if (rvs::options::has_option("-j", &val)) { + std::string 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 @@ -458,9 +461,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 << "-t --listTests List the test modules present in RVS.\n\n"; diff --git a/src/rvsliblogger.cpp b/src/rvsliblogger.cpp index 37ed3050..71a30360 100644 --- a/src/rvsliblogger.cpp +++ b/src/rvsliblogger.cpp @@ -23,6 +23,9 @@ * *******************************************************************************/ #include "include/rvsliblogger.h" +#include +#include +#include #include #include @@ -51,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; @@ -71,6 +75,45 @@ 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. if fails return + int ret = mkdir(dirName.c_str(), S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH ); + if (ret){ + return false; + } + } + std::fstream fs; + fs.open(fname, std::ios::out | std::ios::trunc); + if (fs.fail()){// unable to create file in dir + return false; + } + return true; +} + +/** + * @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 * @@ -93,6 +136,30 @@ 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."; + } + } + +} + + +void rvs::logger::set_json_log_file(const std::string& fname) { + 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(); } /** @@ -262,19 +329,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 @@ -295,7 +349,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; } @@ -334,21 +388,20 @@ 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; } 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); } 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}; @@ -491,10 +544,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();