SWDEV-465520: RHEL9 toolchain doesnt seem to support experimental filesystem

Change-Id: I6b1e7f42c49b1c7af412c0b68851724861c9970a


[ROCm/rocprofiler commit: 1e69b3e2f6]
Этот коммит содержится в:
gobhardw
2024-06-04 15:02:51 +05:30
коммит произвёл Ammar Elwazir
родитель 607cfb9ee1
Коммит a67f4fdd93
26 изменённых файлов: 125 добавлений и 63 удалений
+3 -2
Просмотреть файл
@@ -29,7 +29,6 @@
#include <cassert>
#include <cstddef>
#include <cstdint>
#include <experimental/filesystem>
#include <fstream>
#include <iostream>
#include <memory>
@@ -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 += '/';
}
+3 -2
Просмотреть файл
@@ -30,7 +30,6 @@
#include <cassert>
#include <cstddef>
#include <cstdint>
#include <experimental/filesystem>
#include <fstream>
#include <iostream>
#include <memory>
@@ -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 {
+2 -2
Просмотреть файл
@@ -26,7 +26,7 @@
#include <fstream>
#include <vector>
#include <functional>
#include <experimental/filesystem>
#include "src/utils/filesystem.hpp"
#include "barectf.h"
@@ -71,7 +71,7 @@ template <typename DescrT> 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.
+3 -3
Просмотреть файл
@@ -25,7 +25,7 @@
#include <memory>
#include <vector>
#include <string>
#include <experimental/filesystem>
#include "src/utils/filesystem.hpp"
#include "barectf_event_record.h"
#include "barectf_writer.h"
@@ -64,7 +64,7 @@ template <typename PlatformDescrT> 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 <typename PlatformDescrT> 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_;
+2 -2
Просмотреть файл
@@ -27,7 +27,7 @@
#include <cassert>
#include <queue>
#include <utility>
#include <experimental/filesystem>
#include "src/utils/filesystem.hpp"
#include "barectf_platform.h"
#include "barectf_event_record.h"
@@ -71,7 +71,7 @@ template <typename PlatformDescrT> 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} {}
+2 -2
Просмотреть файл
@@ -28,7 +28,7 @@
#include <chrono>
#include <regex>
#include <unistd.h>
#include <experimental/filesystem>
#include "src/utils/filesystem.hpp"
#include <type_traits>
#include "rocprofiler.h"
@@ -39,7 +39,7 @@
#include <rocm-core/rocm_getpath.h>
#endif
namespace fs = std::experimental::filesystem;
namespace fs = rocprofiler::common::filesystem;
namespace {
+3 -2
Просмотреть файл
@@ -28,7 +28,6 @@
#include <memory>
#include <limits>
#include <fstream>
#include <experimental/filesystem>
#include <time.h>
#include <hsa/hsa.h>
@@ -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 {
+6 -5
Просмотреть файл
@@ -23,7 +23,8 @@
#include <mutex>
#include <cstdlib>
#include <experimental/filesystem>
#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<RocTxPlatformDescr> roctx_tracer_;
+3 -2
Просмотреть файл
@@ -30,7 +30,6 @@
#include <cassert>
#include <cstddef>
#include <cstdint>
#include <experimental/filesystem>
#include <fstream>
#include <iostream>
#include <memory>
@@ -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 {
+3 -2
Просмотреть файл
@@ -30,7 +30,6 @@
#include <cassert>
#include <cstddef>
#include <cstdint>
#include <experimental/filesystem>
#include <fstream>
#include <iostream>
#include <memory>
@@ -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 {
+3 -2
Просмотреть файл
@@ -24,7 +24,6 @@
#include <cassert>
#include <cstdint>
#include <cstdlib>
#include <experimental/filesystem>
#include <fstream>
#include <string>
#include <iostream>
@@ -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 {
+4 -3
Просмотреть файл
@@ -25,7 +25,6 @@
#include <condition_variable>
#include <cstdint>
#include <cstdlib>
#include <experimental/filesystem>
#include <fstream>
#include <memory>
#include <optional>
@@ -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()),
+2 -2
Просмотреть файл
@@ -24,7 +24,6 @@
#include <sys/syscall.h>
#include <unistd.h>
#include <experimental/filesystem>
#include <atomic>
#include <cassert>
#include <optional>
@@ -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;
+2 -2
Просмотреть файл
@@ -35,7 +35,6 @@ THE SOFTWARE.
#include <map>
#include <vector>
#include <mutex>
#include <experimental/filesystem>
#include "types.h"
#include "exception.h"
@@ -45,9 +44,10 @@ THE SOFTWARE.
#include <unordered_set>
#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;
+2 -2
Просмотреть файл
@@ -20,11 +20,11 @@
#include "hsa_info.h"
#include <fstream>
#include <experimental/filesystem>
#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 { \
+2 -3
Просмотреть файл
@@ -26,11 +26,10 @@
#include <link.h>
#include <unistd.h>
#include <experimental/filesystem>
#include "src/utils/helper.h"
#include "src/utils/filesystem.hpp"
namespace fs = std::experimental::filesystem;
namespace fs = rocprofiler::common::filesystem;
namespace roctracer {
+3 -2
Просмотреть файл
@@ -27,7 +27,6 @@ Copyright (c) 2022 Advanced Micro Devices, Inc.
#include <atomic>
#include <cstddef>
#include <cstdlib>
#include <filesystem>
#include <iostream>
#include <string>
#include <vector>
@@ -39,8 +38,10 @@ Copyright (c) 2022 Advanced Micro Devices, Inc.
#include <fmt/core.h>
#include <fmt/color.h>
#include "src/utils/filesystem.hpp"
// filesystem for path resolutions
namespace fs = std::filesystem;
namespace fs = rocprofiler::common::filesystem;
namespace rocprofiler {
namespace src {
+3 -2
Просмотреть файл
@@ -33,7 +33,8 @@
#include <iostream>
#include <algorithm>
#include <experimental/filesystem>
#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;
+3 -3
Просмотреть файл
@@ -46,7 +46,6 @@
#include <cstdlib>
#include <csetjmp>
#include <exception>
#include <experimental/filesystem>
#include <fstream>
#include <iostream>
#include <map>
@@ -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 + '/';
+51
Просмотреть файл
@@ -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(<filesystem>)
#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 <filesystem>
#else
#include <experimental/filesystem>
#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
+3 -2
Просмотреть файл
@@ -23,7 +23,6 @@ THE SOFTWARE.
#include "ctrl/test_hsa.h"
#include <atomic>
#include <experimental/filesystem>
#include <dlfcn.h> // 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;
+2 -1
Просмотреть файл
@@ -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/"
+2 -1
Просмотреть файл
@@ -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<hsa_agent_t> Device::all_devices;
std::string GetRunningPath(std::string string_to_erase);
-1
Просмотреть файл
@@ -32,7 +32,6 @@ THE SOFTWARE.
#include <unistd.h>
#include <cstdlib>
#include <experimental/filesystem>
#include <iostream>
#include <string>
#include <vector>
+11 -11
Просмотреть файл
@@ -31,8 +31,8 @@ THE SOFTWARE.
#include <string>
#include <thread>
#include <array>
#include <experimental/filesystem>
#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/"); }
@@ -24,11 +24,11 @@
#include <mutex>
#include <memory>
#include <experimental/filesystem>
#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