From a67f4fdd93fa963483c47b57dd348fc181694075 Mon Sep 17 00:00:00 2001 From: gobhardw Date: Tue, 4 Jun 2024 15:02:51 +0530 Subject: [PATCH] SWDEV-465520: RHEL9 toolchain doesnt seem to support experimental filesystem Change-Id: I6b1e7f42c49b1c7af412c0b68851724861c9970a [ROCm/rocprofiler commit: 1e69b3e2f61ccb41e7c1c23433b6632a73e3ee66] --- projects/rocprofiler/plugin/att/att.cpp | 5 +- projects/rocprofiler/plugin/cli/cli.cpp | 5 +- .../rocprofiler/plugin/ctf/barectf_platform.h | 4 +- .../rocprofiler/plugin/ctf/barectf_tracer.h | 6 +-- .../rocprofiler/plugin/ctf/barectf_writer.h | 4 +- projects/rocprofiler/plugin/ctf/ctf.cpp | 4 +- projects/rocprofiler/plugin/ctf/plugin.cpp | 5 +- projects/rocprofiler/plugin/ctf/plugin.h | 11 ++-- projects/rocprofiler/plugin/file/file.cpp | 5 +- projects/rocprofiler/plugin/file/file_v1.cpp | 5 +- projects/rocprofiler/plugin/json/json.cpp | 5 +- .../rocprofiler/plugin/perfetto/perfetto.cpp | 7 +-- .../src/api/rocprofiler_singleton.cpp | 4 +- .../src/core/counters/metrics/metrics.h | 4 +- .../src/core/hardware/hsa_info.cpp | 4 +- .../src/core/session/tracer/src/loader.h | 5 +- .../src/tools/rocprofv2/rocprofv2.cpp | 5 +- .../rocprofiler/src/tools/rocsys/rocsys.cpp | 5 +- projects/rocprofiler/src/tools/tool.cpp | 6 +-- projects/rocprofiler/src/utils/filesystem.hpp | 51 +++++++++++++++++++ projects/rocprofiler/test/ctrl/test_hsa.cpp | 5 +- projects/rocprofiler/test/run.sh | 3 +- .../profiler/apps/multiqueue_testapp.cpp | 3 +- .../profiler/apps/multiqueue_testapp.h | 1 - .../featuretests/profiler/profiler_gtest.cpp | 22 ++++---- .../ROCProfiler_Singleton_unittests.cpp | 4 +- 26 files changed, 125 insertions(+), 63 deletions(-) create mode 100644 projects/rocprofiler/src/utils/filesystem.hpp diff --git a/projects/rocprofiler/plugin/att/att.cpp b/projects/rocprofiler/plugin/att/att.cpp index 86b14e1409..9735701ada 100644 --- a/projects/rocprofiler/plugin/att/att.cpp +++ b/projects/rocprofiler/plugin/att/att.cpp @@ -29,7 +29,6 @@ #include #include #include -#include #include #include #include @@ -47,6 +46,8 @@ #include "../utils.h" #include "../../src/core/session/att/att_header.h" +#include "src/utils/filesystem.hpp" + #define ATT_FILENAME_MAXBYTES 90 #define TEST_INVALID_KERNEL size_t(-1) @@ -107,7 +108,7 @@ class att_plugin_t { if (!output_dir.size()) return; try { - std::experimental::filesystem::create_directories(output_dir); + rocprofiler::common::filesystem::create_directories(output_dir); } catch (...) {} output_dir += '/'; } diff --git a/projects/rocprofiler/plugin/cli/cli.cpp b/projects/rocprofiler/plugin/cli/cli.cpp index 0c6a7bdac3..996af70008 100644 --- a/projects/rocprofiler/plugin/cli/cli.cpp +++ b/projects/rocprofiler/plugin/cli/cli.cpp @@ -30,7 +30,6 @@ #include #include #include -#include #include #include #include @@ -46,7 +45,9 @@ #include "rocprofiler_plugin.h" #include "../utils.h" -namespace fs = std::experimental::filesystem; +#include "src/utils/filesystem.hpp" + +namespace fs = rocprofiler::common::filesystem; namespace { diff --git a/projects/rocprofiler/plugin/ctf/barectf_platform.h b/projects/rocprofiler/plugin/ctf/barectf_platform.h index 914028deaf..ff561ca653 100644 --- a/projects/rocprofiler/plugin/ctf/barectf_platform.h +++ b/projects/rocprofiler/plugin/ctf/barectf_platform.h @@ -26,7 +26,7 @@ #include #include #include -#include +#include "src/utils/filesystem.hpp" #include "barectf.h" @@ -71,7 +71,7 @@ template class BarectfPlatform final { // For each event record to write, the platform reads `clock_val` to // know the current timestamp. explicit BarectfPlatform(const std::size_t packet_size, - const std::experimental::filesystem::path& data_stream_file_path, + const rocprofiler::common::filesystem::path& data_stream_file_path, const std::uint64_t& clock_val) : clock_val_{&clock_val}, buffer_(packet_size) { // Initialize barectf callbacks. diff --git a/projects/rocprofiler/plugin/ctf/barectf_tracer.h b/projects/rocprofiler/plugin/ctf/barectf_tracer.h index 1842cdbe1a..f1c2e57b49 100644 --- a/projects/rocprofiler/plugin/ctf/barectf_tracer.h +++ b/projects/rocprofiler/plugin/ctf/barectf_tracer.h @@ -25,7 +25,7 @@ #include #include #include -#include +#include "src/utils/filesystem.hpp" #include "barectf_event_record.h" #include "barectf_writer.h" @@ -64,7 +64,7 @@ template class BarectfTracer final { // tracer, but may reduce the number of required CTF data stream files // to ensure time-ordered event records. explicit BarectfTracer(const std::size_t packet_size, - std::experimental::filesystem::path trace_dir, + rocprofiler::common::filesystem::path trace_dir, const char* const data_stream_file_name_prefix, const std::size_t max_writer_queue_size = 200) : packet_size_{packet_size}, @@ -107,7 +107,7 @@ template class BarectfTracer final { std::size_t packet_size_; // CTF trace directory. - std::experimental::filesystem::path trace_dir_; + rocprofiler::common::filesystem::path trace_dir_; // CTF data stream file name prefix. std::string data_stream_file_name_prefix_; diff --git a/projects/rocprofiler/plugin/ctf/barectf_writer.h b/projects/rocprofiler/plugin/ctf/barectf_writer.h index 73a0354601..cf3f8a4a1d 100644 --- a/projects/rocprofiler/plugin/ctf/barectf_writer.h +++ b/projects/rocprofiler/plugin/ctf/barectf_writer.h @@ -27,7 +27,7 @@ #include #include #include -#include +#include "src/utils/filesystem.hpp" #include "barectf_platform.h" #include "barectf_event_record.h" @@ -71,7 +71,7 @@ template class BarectfWriter final { // The built barectf writer manages an event record queue having a // maximum size of `max_queue_size`. explicit BarectfWriter(const std::size_t packet_size, - const std::experimental::filesystem::path& data_stream_file_path, + const rocprofiler::common::filesystem::path& data_stream_file_path, const std::size_t max_queue_size) : platform_{packet_size, data_stream_file_path, clock_val_}, max_queue_size_{max_queue_size} {} diff --git a/projects/rocprofiler/plugin/ctf/ctf.cpp b/projects/rocprofiler/plugin/ctf/ctf.cpp index 648242be06..4101db0588 100644 --- a/projects/rocprofiler/plugin/ctf/ctf.cpp +++ b/projects/rocprofiler/plugin/ctf/ctf.cpp @@ -28,7 +28,7 @@ #include #include #include -#include +#include "src/utils/filesystem.hpp" #include #include "rocprofiler.h" @@ -39,7 +39,7 @@ #include #endif -namespace fs = std::experimental::filesystem; +namespace fs = rocprofiler::common::filesystem; namespace { diff --git a/projects/rocprofiler/plugin/ctf/plugin.cpp b/projects/rocprofiler/plugin/ctf/plugin.cpp index d8ff09736f..64e23cca35 100644 --- a/projects/rocprofiler/plugin/ctf/plugin.cpp +++ b/projects/rocprofiler/plugin/ctf/plugin.cpp @@ -28,7 +28,6 @@ #include #include #include -#include #include #include @@ -47,7 +46,9 @@ #include "barectf_tracer.h" #include "plugin.h" -namespace fs = std::experimental::filesystem; +#include "src/utils/filesystem.hpp" + +namespace fs = rocprofiler::common::filesystem; namespace rocm_ctf { namespace { diff --git a/projects/rocprofiler/plugin/ctf/plugin.h b/projects/rocprofiler/plugin/ctf/plugin.h index e4fb5a2dd9..1b543432f9 100644 --- a/projects/rocprofiler/plugin/ctf/plugin.h +++ b/projects/rocprofiler/plugin/ctf/plugin.h @@ -23,7 +23,8 @@ #include #include -#include + +#include "src/utils/filesystem.hpp" #include "rocprofiler.h" #include "rocprofiler_plugin.h" @@ -49,8 +50,8 @@ class Plugin final { // // This constructor immediately adjusts and copies the metadata stream // file `metadata_stream_path` to the trace directory (`trace_dir`). - explicit Plugin(std::size_t packet_size, const std::experimental::filesystem::path& trace_dir, - const std::experimental::filesystem::path& metadata_stream_path); + explicit Plugin(std::size_t packet_size, const rocprofiler::common::filesystem::path& trace_dir, + const rocprofiler::common::filesystem::path& metadata_stream_path); // Handles a tracer record. void HandleTracerRecord(const rocprofiler_record_tracer_t& record, @@ -127,8 +128,8 @@ class Plugin final { // adjusts the `offset` property of its single clock class, and writes // the result to the `metadata` file within the `trace_dir` directory. void CopyAdjustedMetadataStreamFile( - const std::experimental::filesystem::path& metadata_stream_path, - const std::experimental::filesystem::path& trace_dir); + const rocprofiler::common::filesystem::path& metadata_stream_path, + const rocprofiler::common::filesystem::path& trace_dir); // Dedicated tracers. BarectfTracer roctx_tracer_; diff --git a/projects/rocprofiler/plugin/file/file.cpp b/projects/rocprofiler/plugin/file/file.cpp index 012458d01a..8d463daa2d 100644 --- a/projects/rocprofiler/plugin/file/file.cpp +++ b/projects/rocprofiler/plugin/file/file.cpp @@ -30,7 +30,6 @@ #include #include #include -#include #include #include #include @@ -46,7 +45,9 @@ #include "rocprofiler_plugin.h" #include "../utils.h" -namespace fs = std::experimental::filesystem; +#include "src/utils/filesystem.hpp" + +namespace fs = rocprofiler::common::filesystem; namespace { diff --git a/projects/rocprofiler/plugin/file/file_v1.cpp b/projects/rocprofiler/plugin/file/file_v1.cpp index 9bc965f4ed..46e82e21de 100644 --- a/projects/rocprofiler/plugin/file/file_v1.cpp +++ b/projects/rocprofiler/plugin/file/file_v1.cpp @@ -30,7 +30,6 @@ #include #include #include -#include #include #include #include @@ -46,7 +45,9 @@ #include "rocprofiler_plugin.h" #include "../utils.h" -namespace fs = std::experimental::filesystem; +#include "src/utils/filesystem.hpp" + +namespace fs = rocprofiler::common::filesystem; namespace { diff --git a/projects/rocprofiler/plugin/json/json.cpp b/projects/rocprofiler/plugin/json/json.cpp index 90eeab7f5d..71f48b379d 100644 --- a/projects/rocprofiler/plugin/json/json.cpp +++ b/projects/rocprofiler/plugin/json/json.cpp @@ -24,7 +24,6 @@ #include #include #include -#include #include #include #include @@ -47,7 +46,9 @@ #include "rocprofiler_plugin.h" #include "../utils.h" -namespace fs = std::experimental::filesystem; +#include "src/utils/filesystem.hpp" + +namespace fs = rocprofiler::common::filesystem; namespace { diff --git a/projects/rocprofiler/plugin/perfetto/perfetto.cpp b/projects/rocprofiler/plugin/perfetto/perfetto.cpp index 25fba8492e..6985b9af34 100644 --- a/projects/rocprofiler/plugin/perfetto/perfetto.cpp +++ b/projects/rocprofiler/plugin/perfetto/perfetto.cpp @@ -25,7 +25,6 @@ #include #include #include -#include #include #include #include @@ -49,10 +48,12 @@ #include "rocprofiler_plugin.h" #include "../utils.h" +#include "src/utils/filesystem.hpp" + #define STREAM_CONSTANT 98736677 #define QUEUE_CONSTANT 18746479 -namespace fs = std::experimental::filesystem; +namespace fs = rocprofiler::common::filesystem; PERFETTO_DEFINE_CATEGORIES( perfetto::Category("GENERIC").SetDescription("GENERAL_CATEGORY"), @@ -515,7 +516,7 @@ class perfetto_plugin_t { if (kernel_name_it == kernel_names_map.end()) { kernel_name_it = kernel_names_map.emplace(tracer_record.name, - rocprofiler::truncate_name(rocprofiler::cxx_demangle(tracer_record.name))).first; + rocprofiler::truncate_name(rocprofiler::cxx_demangle(tracer_record.name))).first; } TRACE_EVENT_BEGIN( "HIP_OPS", perfetto::DynamicString(kernel_name_it->second.c_str()), diff --git a/projects/rocprofiler/src/api/rocprofiler_singleton.cpp b/projects/rocprofiler/src/api/rocprofiler_singleton.cpp index 9973593351..910df8cbea 100644 --- a/projects/rocprofiler/src/api/rocprofiler_singleton.cpp +++ b/projects/rocprofiler/src/api/rocprofiler_singleton.cpp @@ -24,7 +24,6 @@ #include #include -#include #include #include #include @@ -36,8 +35,9 @@ #include "src/utils/helper.h" #include "src/utils/logger.h" #include "src/core/memory/generic_buffer.h" +#include "src/utils/filesystem.hpp" -namespace fs = std::experimental::filesystem; +namespace fs = rocprofiler::common::filesystem; #define ASSERTM(exp, msg) assert(((void)msg, exp)) extern std::mutex sessions_pending_signal_lock; diff --git a/projects/rocprofiler/src/core/counters/metrics/metrics.h b/projects/rocprofiler/src/core/counters/metrics/metrics.h index e446b6285b..609e126bab 100644 --- a/projects/rocprofiler/src/core/counters/metrics/metrics.h +++ b/projects/rocprofiler/src/core/counters/metrics/metrics.h @@ -35,7 +35,6 @@ THE SOFTWARE. #include #include #include -#include #include "types.h" #include "exception.h" @@ -45,9 +44,10 @@ THE SOFTWARE. #include #include "src/core/hardware/hsa_info.h" #include "src/core/hsa/hsa_support.h" +#include "src/utils/filesystem.hpp" -namespace fs = std::experimental::filesystem; +namespace fs = rocprofiler::common::filesystem; namespace rocprofiler { struct counter_t { std::string name; diff --git a/projects/rocprofiler/src/core/hardware/hsa_info.cpp b/projects/rocprofiler/src/core/hardware/hsa_info.cpp index 57e4e112fe..1812fba8c4 100644 --- a/projects/rocprofiler/src/core/hardware/hsa_info.cpp +++ b/projects/rocprofiler/src/core/hardware/hsa_info.cpp @@ -20,11 +20,11 @@ #include "hsa_info.h" #include -#include +#include "src/utils/filesystem.hpp" #include "src/utils/helper.h" -namespace fs = std::experimental::filesystem; +namespace fs = rocprofiler::common::filesystem; #define CHECK_STATUS(msg, status) \ do { \ diff --git a/projects/rocprofiler/src/core/session/tracer/src/loader.h b/projects/rocprofiler/src/core/session/tracer/src/loader.h index 3167bb38dd..d0b506e23b 100644 --- a/projects/rocprofiler/src/core/session/tracer/src/loader.h +++ b/projects/rocprofiler/src/core/session/tracer/src/loader.h @@ -26,11 +26,10 @@ #include #include -#include - #include "src/utils/helper.h" +#include "src/utils/filesystem.hpp" -namespace fs = std::experimental::filesystem; +namespace fs = rocprofiler::common::filesystem; namespace roctracer { diff --git a/projects/rocprofiler/src/tools/rocprofv2/rocprofv2.cpp b/projects/rocprofiler/src/tools/rocprofv2/rocprofv2.cpp index ae4b584534..9e04028cf2 100644 --- a/projects/rocprofiler/src/tools/rocprofv2/rocprofv2.cpp +++ b/projects/rocprofiler/src/tools/rocprofv2/rocprofv2.cpp @@ -27,7 +27,6 @@ Copyright (c) 2022 Advanced Micro Devices, Inc. #include #include #include -#include #include #include #include @@ -39,8 +38,10 @@ Copyright (c) 2022 Advanced Micro Devices, Inc. #include #include +#include "src/utils/filesystem.hpp" + // filesystem for path resolutions -namespace fs = std::filesystem; +namespace fs = rocprofiler::common::filesystem; namespace rocprofiler { namespace src { diff --git a/projects/rocprofiler/src/tools/rocsys/rocsys.cpp b/projects/rocprofiler/src/tools/rocsys/rocsys.cpp index 045a236dbf..149f781483 100644 --- a/projects/rocprofiler/src/tools/rocsys/rocsys.cpp +++ b/projects/rocprofiler/src/tools/rocsys/rocsys.cpp @@ -33,7 +33,8 @@ #include #include -#include + +#include "src/utils/filesystem.hpp" /* mpiexec -n 16 rocsys --session-new test launch python app.py @@ -47,7 +48,7 @@ struct shmd_t { struct shmd_t* shmd; } // namespace -namespace fs = std::experimental::filesystem; +namespace fs = rocprofiler::common::filesystem; void report(const char* msg, int terminate) { std::cerr << msg << ": " << errno << std::endl; diff --git a/projects/rocprofiler/src/tools/tool.cpp b/projects/rocprofiler/src/tools/tool.cpp index f247a662bd..da528fa8b3 100644 --- a/projects/rocprofiler/src/tools/tool.cpp +++ b/projects/rocprofiler/src/tools/tool.cpp @@ -46,7 +46,6 @@ #include #include #include -#include #include #include #include @@ -60,6 +59,7 @@ #include "utils/helper.h" #include "trace_buffer.h" #include "core/session/att/att.h" +#include "src/utils/filesystem.hpp" struct PluginHeaderPacket { @@ -69,7 +69,7 @@ struct PluginHeaderPacket { #define SLEEP_CYCLE_LENGTH 100l -namespace fs = std::experimental::filesystem; +namespace fs = rocprofiler::common::filesystem; // Macro to check ROCProfiler calls status #define CHECK_ROCPROFILER(call) \ @@ -439,7 +439,7 @@ void plugins_load(void* userdata) { if (out_path.size() && !bIsATT) { try { - std::experimental::filesystem::create_directories(out_path); + rocprofiler::common::filesystem::create_directories(out_path); } catch (...) { } out_path = out_path + '/'; diff --git a/projects/rocprofiler/src/utils/filesystem.hpp b/projects/rocprofiler/src/utils/filesystem.hpp new file mode 100644 index 0000000000..9ef550c23d --- /dev/null +++ b/projects/rocprofiler/src/utils/filesystem.hpp @@ -0,0 +1,51 @@ +// MIT License +// +// Copyright (c) 2023 Advanced Micro Devices, Inc. All rights reserved. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// SOFTWARE. + +#pragma once + +#if defined(__cpp_lib_filesystem) +#define ROCPROFILER_HAS_CPP_LIB_FILESYSTEM 1 +#else +#if defined __has_include +#if __has_include() +#define ROCPROFILER_HAS_CPP_LIB_FILESYSTEM 1 +#endif +#endif +#endif + +// include the correct filesystem header +#if defined(ROCPROFILER_HAS_CPP_LIB_FILESYSTEM) && ROCPROFILER_HAS_CPP_LIB_FILESYSTEM > 0 +#include +#else +#include +#endif + +// create a namespace alias +namespace rocprofiler { +namespace common { +#if defined(ROCPROFILER_HAS_CPP_LIB_FILESYSTEM) && ROCPROFILER_HAS_CPP_LIB_FILESYSTEM > 0 +namespace filesystem = ::std::filesystem; // NOLINT +#else +namespace filesystem = ::std::experimental::filesystem; // NOLINT +#endif +} // namespace common +} // namespace rocprofiler \ No newline at end of file diff --git a/projects/rocprofiler/test/ctrl/test_hsa.cpp b/projects/rocprofiler/test/ctrl/test_hsa.cpp index bbc9c360e6..93bcf42c21 100644 --- a/projects/rocprofiler/test/ctrl/test_hsa.cpp +++ b/projects/rocprofiler/test/ctrl/test_hsa.cpp @@ -23,7 +23,6 @@ THE SOFTWARE. #include "ctrl/test_hsa.h" #include -#include #include // for dladdr @@ -31,7 +30,9 @@ THE SOFTWARE. #include "util/helper_funcs.h" #include "util/hsa_rsrc_factory.h" -namespace fs = std::experimental::filesystem; +#include "src/utils/filesystem.hpp" + +namespace fs = rocprofiler::common::filesystem; HsaRsrcFactory* TestHsa::hsa_rsrc_ = NULL; diff --git a/projects/rocprofiler/test/run.sh b/projects/rocprofiler/test/run.sh index d6aa7dbf9e..2ae21f34a2 100755 --- a/projects/rocprofiler/test/run.sh +++ b/projects/rocprofiler/test/run.sh @@ -84,7 +84,8 @@ export ROCP_METRICS=$BIN_DIR/metrics.xml ## C test eval_test "C test" $BIN_DIR/test/c_test -export HSACO_OBJ_FILES_PATH="$BIN_DIR/test/" +#export HSACO_OBJ_FILES_PATH="$BIN_DIR/test/" +export HSACO_OBJ_FILES_PATH="$BIN_DIR/" if test -f "$BIN_DIR/test/librocprof-tool.so" ; then export ROCPROF_TOOL_PATH="$BIN_DIR/test/" diff --git a/projects/rocprofiler/tests-v2/featuretests/profiler/apps/multiqueue_testapp.cpp b/projects/rocprofiler/tests-v2/featuretests/profiler/apps/multiqueue_testapp.cpp index 63adb0cf53..8486535c11 100644 --- a/projects/rocprofiler/tests-v2/featuretests/profiler/apps/multiqueue_testapp.cpp +++ b/projects/rocprofiler/tests-v2/featuretests/profiler/apps/multiqueue_testapp.cpp @@ -30,9 +30,10 @@ THE SOFTWARE. */ #include "multiqueue_testapp.h" +#include "src/utils/filesystem.hpp" #include "src/utils/exception.h" -namespace fs = std::experimental::filesystem; +namespace fs = rocprofiler::common::filesystem; std::vector Device::all_devices; std::string GetRunningPath(std::string string_to_erase); diff --git a/projects/rocprofiler/tests-v2/featuretests/profiler/apps/multiqueue_testapp.h b/projects/rocprofiler/tests-v2/featuretests/profiler/apps/multiqueue_testapp.h index 9e226d01ff..9bf529458c 100644 --- a/projects/rocprofiler/tests-v2/featuretests/profiler/apps/multiqueue_testapp.h +++ b/projects/rocprofiler/tests-v2/featuretests/profiler/apps/multiqueue_testapp.h @@ -32,7 +32,6 @@ THE SOFTWARE. #include #include -#include #include #include #include diff --git a/projects/rocprofiler/tests-v2/featuretests/profiler/profiler_gtest.cpp b/projects/rocprofiler/tests-v2/featuretests/profiler/profiler_gtest.cpp index a04538e216..43a4dcc8f0 100644 --- a/projects/rocprofiler/tests-v2/featuretests/profiler/profiler_gtest.cpp +++ b/projects/rocprofiler/tests-v2/featuretests/profiler/profiler_gtest.cpp @@ -31,8 +31,8 @@ THE SOFTWARE. #include #include #include -#include +#include "src/utils/filesystem.hpp" #include "src/utils/helper.h" #include "utils/csv_parser.h" #include "src/utils/logger.h" @@ -1253,7 +1253,7 @@ void PluginTests::ProcessApplication(std::stringstream& ss) { } bool FilePluginTest::hasFileInDir(const std::string& filename, const char* directory) { - for (const auto& entry : std::experimental::filesystem::directory_iterator(directory)) { + for (const auto& entry : rocprofiler::common::filesystem::directory_iterator(directory)) { if (filename.size() == 0) return true; if (std::string(entry.path().filename()).find(filename) != std::string::npos) return true; } @@ -1265,7 +1265,7 @@ class VectorAddFolderOnlyTest : public FilePluginTest { virtual void SetUp() { RunApplication("hip_vectoradd", " --hsa-activity --hip-activity -d /tmp/tests-v2/file/"); } - virtual void TearDown() { std::experimental::filesystem::remove_all("/tmp/tests-v2/file/"); } + virtual void TearDown() { rocprofiler::common::filesystem::remove_all("/tmp/tests-v2/file/"); } bool hasFile() { return hasFileInDir(".csv", "/tmp/tests-v2/file/"); } }; @@ -1278,7 +1278,7 @@ class VectorAddFileAndFolderTest : public FilePluginTest { virtual void SetUp() { RunApplication("hip_vectoradd", " --hip-activity -d /tmp/tests-v2/file/ -o file_test"); } - virtual void TearDown() { std::experimental::filesystem::remove_all("/tmp/tests-v2/file/"); } + virtual void TearDown() { rocprofiler::common::filesystem::remove_all("/tmp/tests-v2/file/"); } bool hasFile() { return hasFileInDir("file_test.csv", "/tmp/tests-v2/file/"); } }; @@ -1293,7 +1293,7 @@ class VectorAddFilenameMPITest : public FilePluginTest { RunApplication("hip_vectoradd", " --hip-activity -d /tmp/tests-v2/file/ -o test_%q{MPI_RANK}_"); } virtual void TearDown() { - std::experimental::filesystem::remove_all("/tmp/tests-v2/file/"); + rocprofiler::common::filesystem::remove_all("/tmp/tests-v2/file/"); unsetenv("MPI_RANK"); } bool hasFile() { return hasFileInDir("test_7_", "/tmp/tests-v2/file/"); } @@ -1304,7 +1304,7 @@ TEST_F(VectorAddFilenameMPITest, WhenRunningProfilerWithFilePluginTest) { } bool PerfettoPluginTest::hasFileInDir(const std::string& filename, const char* directory) { - for (const auto& entry : std::experimental::filesystem::directory_iterator(directory)) { + for (const auto& entry : rocprofiler::common::filesystem::directory_iterator(directory)) { std::string entrypath = std::string(entry.path().filename()); if (entrypath.find(".pftrace") == std::string::npos) continue; if (entrypath.substr(0, filename.size()) == filename) return true; @@ -1320,7 +1320,7 @@ class VectorAddPerfettoMPITest : public PerfettoPluginTest { " -d /tmp/tests-v2/perfetto/ -o test_%q{MPI_RANK}_ --plugin perfetto"); } virtual void TearDown() { - std::experimental::filesystem::remove_all("/tmp/tests-v2/perfetto/"); + rocprofiler::common::filesystem::remove_all("/tmp/tests-v2/perfetto/"); unsetenv("MPI_RANK"); } bool hasFile() { return hasFileInDir("test_7_", "/tmp/tests-v2/perfetto/"); } @@ -1331,8 +1331,8 @@ TEST_F(VectorAddPerfettoMPITest, DISABLED_WhenRunningProfilerWithPerfettoTest) { } bool CTFPluginTest::hasMetadataInDir(const char* directory) { - auto path = std::experimental::filesystem::directory_iterator(directory)->path(); - for (const auto& entry : std::experimental::filesystem::directory_iterator(path)) + auto path = rocprofiler::common::filesystem::directory_iterator(directory)->path(); + for (const auto& entry : rocprofiler::common::filesystem::directory_iterator(path)) if (std::string(entry.path().filename()) == "metadata") return true; return false; } @@ -1341,7 +1341,7 @@ class VectorAddCTFTest : public CTFPluginTest { protected: virtual void SetUp() { RunApplication("hip_vectoradd", " -d /tmp/tests-v2/ctf --plugin ctf"); } virtual void TearDown() { - std::experimental::filesystem::remove_all("/tmp/tests-v2/"); + rocprofiler::common::filesystem::remove_all("/tmp/tests-v2/"); unsetenv("MPI_RANK"); } bool hasFile() { return hasMetadataInDir("/tmp/tests-v2/ctf/"); } @@ -1356,7 +1356,7 @@ class VectorAddCTFMPITest : public CTFPluginTest { RunApplication("hip_vectoradd", " -d /tmp/tests-v2/ctf_%q{MPI_RANK} --plugin ctf"); } virtual void TearDown() { - std::experimental::filesystem::remove_all("/tmp/tests-v2/"); + rocprofiler::common::filesystem::remove_all("/tmp/tests-v2/"); unsetenv("MPI_RANK"); } bool hasFile() { return hasMetadataInDir("/tmp/tests-v2/ctf_7/"); } diff --git a/projects/rocprofiler/tests-v2/unittests/core/ROCProfiler_Singleton/ROCProfiler_Singleton_unittests.cpp b/projects/rocprofiler/tests-v2/unittests/core/ROCProfiler_Singleton/ROCProfiler_Singleton_unittests.cpp index cd47824ddb..7205063594 100644 --- a/projects/rocprofiler/tests-v2/unittests/core/ROCProfiler_Singleton/ROCProfiler_Singleton_unittests.cpp +++ b/projects/rocprofiler/tests-v2/unittests/core/ROCProfiler_Singleton/ROCProfiler_Singleton_unittests.cpp @@ -24,11 +24,11 @@ #include #include -#include #include "api/rocprofiler_singleton.h" #include "src/core/hsa/hsa_support.h" +#include "src/utils/filesystem.hpp" -namespace fs = std::experimental::filesystem; +namespace fs = rocprofiler::common::filesystem; using namespace std::string_literals; #define MAX_THREADS 10000