cd ~/armnn-devenv/boost/boost_1_64_0
./bootstrap.sh --prefix=$HOME/armnn-devenv/boost/install
./b2 install --user-config=$HOME/armnn-devenv/boost/user-config.jam \
- toolset=clang-arm link=static cxxflags=-fPIC --with-filesystem \
+ toolset=clang-arm link=static cxxflags=-fPIC \
--with-test --with-log --with-program_options -j16
```
Note: You can specify the 'Android_API' version you want. For example, if your ANDROID_API is 27 then the compiler will be aarch64-linux-android27-clang++.
-DCMAKE_MODULE_LINKER_FLAGS="-llog" \
-DBOOST_ROOT=$HOME/armnn-devenv/boost/install \
-DBoost_SYSTEM_LIBRARY=$HOME/armnn-devenv/boost/install/lib/libboost_system.a \
- -DBoost_FILESYSTEM_LIBRARY=$HOME/armnn-devenv/boost/install/lib/libboost_filesystem.a \
-DARMNN_PATH=$HOME/armnn-devenv/armnn/build/libarmnn.so ..
```
cd boost_1_64_0
echo "using gcc : arm : aarch64-linux-gnu-g++ ;" > user_config.jam
./bootstrap.sh --prefix=$HOME/armnn-devenv/boost_arm64_install
- ./b2 install toolset=gcc-arm link=static cxxflags=-fPIC --with-filesystem --with-test --with-log --with-program_options -j32 --user-config=user_config.jam
+ ./b2 install toolset=gcc-arm link=static cxxflags=-fPIC --with-test --with-log --with-program_options -j32 --user-config=user_config.jam
```
#### <a name="buildCL">Build Compute Library</a>
-DCMAKE_CXX_FLAGS=--std=c++14 \
-DBOOST_ROOT=$HOME/armnn-devenv/boost_arm64_install/ \
-DBoost_SYSTEM_LIBRARY=$HOME/armnn-devenv/boost_arm64_install/lib/libboost_system.a \
- -DBoost_FILESYSTEM_LIBRARY=$HOME/armnn-devenv/boost_arm64_install/lib/libboost_filesystem.a \
-DARMNN_PATH=$HOME/armnn-devenv/armnn/build/libarmnn.so
```
armnn
${Boost_SYSTEM_LIBRARY}
${Boost_PROGRAM_OPTIONS_LIBRARY}
- ${Boost_FILESYSTEM_LIBRARY}
${Boost_THREAD_LIBRARY} )
add_executable_ex(ArmnnQuantizer
target_link_libraries(ArmnnQuantizer
${Boost_SYSTEM_LIBRARY}
${Boost_PROGRAM_OPTIONS_LIBRARY}
- ${Boost_FILESYSTEM_LIBRARY}
${Boost_THREAD_LIBRARY} )
target_link_libraries(ArmnnQuantizer
install(DIRECTORY include/ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
target_link_libraries(armnn ${Boost_THREAD_LIBRARY}
- ${Boost_SYSTEM_LIBRARY} ${Boost_FILESYSTEM_LIBRARY})
+ ${Boost_SYSTEM_LIBRARY})
if(ARMCOMPUTENEON OR ARMCOMPUTECL)
target_link_libraries(armnn ${ARMCOMPUTE_LIBRARIES})
target_link_libraries(ArmnnConverter ${CMAKE_THREAD_LIBS_INIT})
target_link_libraries(ArmnnConverter
${Boost_SYSTEM_LIBRARY}
- ${Boost_FILESYSTEM_LIBRARY}
${Boost_PROGRAM_OPTIONS_LIBRARY})
addDllCopyCommands(ArmnnConverter)
endif()
set(Boost_USE_STATIC_LIBS ON)
endif()
add_definitions("-DBOOST_ALL_NO_LIB") # Turn off auto-linking as we specify the libs manually
-find_package(Boost 1.59 REQUIRED COMPONENTS unit_test_framework system filesystem program_options)
+find_package(Boost 1.59 REQUIRED COMPONENTS unit_test_framework filesystem system program_options)
include_directories(SYSTEM "${Boost_INCLUDE_DIRS}")
link_directories(${Boost_LIBRARY_DIRS})
// SPDX-License-Identifier: MIT
//
#include "CsvReader.hpp"
+#include "armnn/Optional.hpp"
+#include <Filesystem.hpp>
#include <boost/test/unit_test.hpp>
#include <iostream>
#include <string>
-#include <boost/filesystem.hpp>
-#include <boost/optional.hpp>
using namespace armnnUtils;
std::string CreateTempCsvFile()
{
- boost::filesystem::path fileDir = boost::filesystem::temp_directory_path();
- boost::filesystem::path p{fileDir / boost::filesystem::unique_path("%%%%-%%%%-%%%%.csv")};
+ fs::path p = armnnUtils::Filesystem::NamedTempFile("Armnn-CreateTempCsvFileTest-TempFile.csv");
try
{
- boost::filesystem::ofstream ofs{p};
+ std::ofstream ofs{p};
ofs << "airplane, bicycle , bird , \"m,o,n,k,e,y\"\n";
ofs << "banana, shoe, \"ice\"";
ofs.close();
{
try
{
- boost::filesystem::remove(*m_CsvFile);
+ fs::remove(m_CsvFile.value());
}
catch (std::exception &e)
{
- std::cerr << "Unable to delete file [" << *m_CsvFile << "] : " << e.what() << std::endl;
+ std::cerr << "Unable to delete file [" << m_CsvFile.value() << "] : " << e.what() << std::endl;
BOOST_TEST(false);
}
}
}
- boost::optional<boost::filesystem::path> m_CsvFile;
+ armnn::Optional<fs::path> m_CsvFile;
};
}
#include <boost/test/unit_test.hpp>
-#include <boost/filesystem.hpp>
-#include <boost/optional.hpp>
#include <boost/variant.hpp>
#include <iostream>
#include <string>
#include <ParserHelper.hpp>
#include <VerificationHelpers.hpp>
-#include <boost/filesystem.hpp>
#include <boost/format.hpp>
#include <boost/numeric/conversion/cast.hpp>
//
#include "CommandLineProcessor.hpp"
-
-#define BOOST_FILESYSTEM_NO_DEPRECATED
+#include <Filesystem.hpp>
#include <boost/program_options.hpp>
-#include <boost/filesystem/operations.hpp>
-#include <boost/filesystem/path.hpp>
namespace armnnQuantizer
{
dir += "/";
}
- if (!boost::filesystem::exists(dir))
+ if (!fs::exists(dir))
{
std::cerr << "Output directory [" << dir << "] does not exist" << std::endl;
return false;
}
- if (!boost::filesystem::is_directory(dir))
+ if (!fs::is_directory(dir))
{
std::cerr << "Given output directory [" << dir << "] is not a directory" << std::endl;
return false;
bool ValidateProvidedFile(const std::string& inputFileName)
{
- if (!boost::filesystem::exists(inputFileName))
+ if (!fs::exists(inputFileName))
{
std::cerr << "Provided file [" << inputFileName << "] does not exist" << std::endl;
return false;
}
- if (boost::filesystem::is_directory(inputFileName))
+ if (fs::is_directory(inputFileName))
{
std::cerr << "Given file [" << inputFileName << "] is a directory" << std::endl;
return false;
}
else
{
- boost::filesystem::path csvFilePath(m_CsvFileName);
+ fs::path csvFilePath(m_CsvFileName);
m_CsvFileDirectory = csvFilePath.parent_path().c_str();
}
std::string output(m_OutputDirectory);
output.append(m_OutputFileName);
- if (boost::filesystem::exists(output))
+ if (fs::exists(output))
{
std::cerr << "Output file [" << output << "] already exists" << std::endl;
return false;
#include "QuantizationDataSet.hpp"
#include "CsvReader.hpp"
-#define BOOST_FILESYSTEM_NO_DEPRECATED
-
#include <armnn/utility/IgnoreUnused.hpp>
-
-#include <boost/filesystem/operations.hpp>
-#include <boost/filesystem/path.hpp>
+#include <Filesystem.hpp>
namespace armnnQuantizer
{
{
std::string fileName = csvRows[rowIndex].values[2];
- if (!boost::filesystem::exists(fileName))
+ if (!fs::exists(fileName))
{
throw armnn::ParseException("File [ " + fileName + "] provided on CSV row " + std::to_string(rowIndex) +
" does not exist.");
#include <boost/test/unit_test.hpp>
#include "../QuantizationDataSet.hpp"
+
+#include <armnn/Optional.hpp>
+#include <Filesystem.hpp>
#include <iostream>
#include <fstream>
#include <vector>
#include <map>
-#define BOOST_FILESYSTEM_NO_DEPRECATED
-
-#include <boost/filesystem/operations.hpp>
-#include <boost/filesystem/fstream.hpp>
-#include <boost/filesystem/path.hpp>
-#include <boost/optional/optional.hpp>
-
using namespace armnnQuantizer;
std::string CreateTempCsvFile(std::map<int, std::vector<float>> csvData)
{
- boost::filesystem::path fileDir = boost::filesystem::temp_directory_path();
- boost::filesystem::path p{fileDir / boost::filesystem::unique_path("%%%%-%%%%-%%%%.csv")};
+ fs::path fileDir = fs::temp_directory_path();
+ fs::path p = armnnUtils::Filesystem::NamedTempFile("Armnn-QuantizationCreateTempCsvFileTest-TempFile.csv");
- boost::filesystem::path tensorInput1{fileDir / boost::filesystem::unique_path("input_0_0.raw")};
- boost::filesystem::path tensorInput2{fileDir / boost::filesystem::unique_path("input_1_0.raw")};
- boost::filesystem::path tensorInput3{fileDir / boost::filesystem::unique_path("input_2_0.raw")};
+ fs::path tensorInput1{fileDir / "input_0_0.raw"};
+ fs::path tensorInput2{fileDir / "input_1_0.raw"};
+ fs::path tensorInput3{fileDir / "input_2_0.raw"};
try
{
- boost::filesystem::ofstream ofs{p};
+ std::ofstream ofs{p};
- boost::filesystem::ofstream ofs1{tensorInput1};
- boost::filesystem::ofstream ofs2{tensorInput2};
- boost::filesystem::ofstream ofs3{tensorInput3};
+ std::ofstream ofs1{tensorInput1};
+ std::ofstream ofs2{tensorInput2};
+ std::ofstream ofs3{tensorInput3};
for(auto entry : csvData.at(0))
{
try
{
- boost::filesystem::remove(*m_CsvFile);
+ fs::remove(m_CsvFile.value());
}
catch (std::exception &e)
{
- std::cerr << "Unable to delete file [" << *m_CsvFile << "] : " << e.what() << std::endl;
+ std::cerr << "Unable to delete file [" << m_CsvFile.value() << "] : " << e.what() << std::endl;
BOOST_TEST(false);
}
}
}
- boost::optional<boost::filesystem::path> m_CsvFile;
+ armnn::Optional<fs::path> m_CsvFile;
};
target_include_directories(armnnTfLiteParser PRIVATE ../armnnUtils)
target_include_directories(armnnTfLiteParser SYSTEM PRIVATE "${TF_LITE_SCHEMA_INCLUDE_PATH}")
- target_link_libraries(armnnTfLiteParser ${Boost_FILESYSTEM_LIBRARY} ${Boost_THREAD_LIBRARY})
+ target_link_libraries(armnnTfLiteParser ${Boost_THREAD_LIBRARY})
# If user has explicitly specified flatbuffers lib then use that,
# otherwise search for it based on FLATBUFFERS_BUILD_DIR
// armnnUtils:
#include <armnnUtils/Permute.hpp>
+#include <Filesystem.hpp>
#include <ParserHelper.hpp>
#include <VerificationHelpers.hpp>
#include <boost/format.hpp>
#include <boost/numeric/conversion/cast.hpp>
-#include <boost/filesystem.hpp>
#include <fstream>
#include <algorithm>
throw InvalidArgumentException(boost::str(boost::format("Invalid (null) file name %1%") %
CHECK_LOCATION().AsString()));
}
- boost::system::error_code errorCode;
- boost::filesystem::path pathToFile(fileName);
- if (!boost::filesystem::exists(pathToFile, errorCode))
+ std::error_code errorCode;
+ fs::path pathToFile(fileName);
+ if (!fs::exists(pathToFile, errorCode))
{
std::string locationString = CHECK_LOCATION().AsString();
std::string msg = boost::str(boost::format("Cannot find the file (%1%) errorCode: %2% %3%") %
#include "ParserFlatbuffersFixture.hpp"
#include "../TfLiteParser.hpp"
+#include <Filesystem.hpp>
+
using armnnTfLiteParser::TfLiteParser;
using ModelPtr = TfLiteParser::ModelPtr;
using SubgraphPtr = TfLiteParser::SubgraphPtr;
BOOST_FIXTURE_TEST_CASE(LoadModelFromFile, LoadModelFixture)
{
- using namespace boost::filesystem;
- std::string fname = unique_path(temp_directory_path() / "%%%%-%%%%-%%%%.tflite").string();
+ using namespace fs;
+ fs::path fname = armnnUtils::Filesystem::NamedTempFile("Armnn-tfLite-LoadModelFromFile-TempFile.csv");
bool saved = flatbuffers::SaveFile(fname.c_str(),
reinterpret_cast<char *>(m_GraphBinary.data()),
m_GraphBinary.size(), true);
#include <test/TensorHelpers.hpp>
-#include <boost/filesystem.hpp>
#include <boost/format.hpp>
#include "flatbuffers/idl.h"
#include "Filesystem.hpp"
-#if defined(__unix__)
-#include <sys/stat.h>
-#include <stdio.h>
-#elif defined(_MSC_VER)
-#include "WindowsWrapper.hpp"
-#endif
-
namespace armnnUtils
{
namespace Filesystem
{
-long long GetFileSize(const char* path)
+/**
+ * @brief Construct a temporary file name.
+ *
+ * Given a specified file name construct a path to that file in the
+ * system temporary directory. If the file already exists it is deleted. This
+ * could throw filesystem_error exceptions.
+ *
+ * @param fileName the file name required in the temporary directory.
+ * @return path consisting of system temporary directory and file name.
+ */
+fs::path NamedTempFile(const char* fileName)
{
-#if defined(__ANDROID__)
- struct stat statusBuffer;
- if (stat(path, & statusBuffer) != 0)
- {
- return -1;
- }
- return statusBuffer.st_size;
-#elif defined(__unix__)
- struct stat statusBuffer;
- if (stat(path, & statusBuffer) != 0)
- {
- return -1;
- }
- return static_cast<long long>(statusBuffer.st_size);
-#elif defined(_MSC_VER)
- WIN32_FILE_ATTRIBUTE_DATA attr;
- if (::GetFileAttributesEx(path, GetFileExInfoStandard, &attr) == 0)
+ fs::path tmpDir = fs::temp_directory_path();
+ fs::path namedTempFile{tmpDir / fileName};
+ if (fs::exists(namedTempFile))
{
- return -1;
+ fs::remove(namedTempFile);
}
- return attr.nFileSizeLow;
-#endif
-}
-
-bool Remove(const char* path)
-{
-#if defined(__unix__)
- return remove(path) == 0;
-#elif defined(_MSC_VER)
- return ::DeleteFile(path);
-#endif
+ return namedTempFile;
}
}
namespace Filesystem
{
-long long GetFileSize(const char* path);
-
-bool Remove(const char* path);
+/// Returns a path to a file in the system temporary folder. If the file existed it will be deleted.
+fs::path NamedTempFile(const char* fileName);
}
}
#include <armnn/Logging.hpp>
-#include <boost/filesystem.hpp>
#include <map>
#include <vector>
#include <armnn/Logging.hpp>
#include <backendsCommon/DynamicBackendUtils.hpp>
#include "armnn/utility/StringUtils.hpp"
-
-#include <boost/filesystem.hpp>
+#include <Filesystem.hpp>
#include <regex>
return false;
}
- boost::filesystem::path boostPath(path);
+ fs::path fsPath(path);
- if (!boost::filesystem::exists(boostPath))
+ if (!fs::exists(fsPath))
{
ARMNN_LOG(warning) << "WARNING: The given backend path \"" << path << "\" does not exist";
return false;
}
- if (!boost::filesystem::is_directory(boostPath))
+ if (!fs::is_directory(fsPath))
{
ARMNN_LOG(warning) << "WARNING: The given backend path \"" << path << "\" is not a directory";
return false;
}
- if (!boostPath.is_absolute())
+ if (!fsPath.is_absolute())
{
ARMNN_LOG(warning) << "WARNING: The given backend path \"" << path << "\" is not absolute";
return false;
for (const std::string& backendPath : backendPaths)
{
- using namespace boost::filesystem;
+ using namespace fs;
// Check if the path is valid. In case of error, IsValidPath will log an error message
if (!IsPathValid(backendPath))
#include <armnn/utility/PolymorphicDowncast.hpp>
#include <backendsCommon/CpuTensorHandle.hpp>
#include <backendsCommon/DynamicBackendUtils.hpp>
+#include <Filesystem.hpp>
#include <reference/workloads/RefConvolution2dWorkload.hpp>
#include <Runtime.hpp>
#include <memory>
#include <boost/test/unit_test.hpp>
-#include <boost/filesystem.hpp>
#include <boost/dll.hpp>
static std::string g_TestBaseDir = "src/backends/backendsCommon/test/";
std::string GetBasePath(const std::string& basePath)
{
- using namespace boost::filesystem;
+ using namespace fs;
- path programLocation = boost::dll::program_location().parent_path();
+ path programLocation = boost::dll::program_location().parent_path().c_str();
path sharedObjectPath = programLocation.append(basePath);
BOOST_CHECK_MESSAGE(exists(sharedObjectPath), "Base path for shared objects does not exist: " +
sharedObjectPath.string());
std::string GetTestSubDirectory(const std::string& subdir)
{
- using namespace boost::filesystem;
+ using namespace fs;
std::string testDynamicBackendsBaseDir = GetTestDirectoryBasePath();
path testDynamicBackendsBasePath(testDynamicBackendsBaseDir);
std::string GetTestSubDirectory(const std::string& basePath, const std::string& subdir)
{
- using namespace boost::filesystem;
+ using namespace fs;
path testDynamicBackendsBasePath(basePath);
path testDynamicBackendsSubDir = testDynamicBackendsBasePath.append(subdir);
std::string GetTestFilePath(const std::string& directory, const std::string& fileName)
{
- using namespace boost::filesystem;
+ using namespace fs;
path directoryPath(directory);
path fileNamePath = directoryPath.append(fileName);
std::string testSubDirectory = GetTestSubDirectory(g_TestDynamicBackendSubDir);
// We expect this path to exists so we can load a valid dynamic backend.
- BOOST_CHECK_MESSAGE(boost::filesystem::exists(testSubDirectory),
+ BOOST_CHECK_MESSAGE(fs::exists(testSubDirectory),
"Base path for shared objects does not exist: " + testSubDirectory);
std::string sharedObjectFilePath = GetTestFilePath(testSubDirectory, g_TestValidTestDynamicBackendFileName);
void GetBackendPathsTestImpl()
{
using namespace armnn;
- using namespace boost::filesystem;
+ using namespace fs;
// The test covers four directories:
// <unit test path>/src/backends/backendsCommon/test/
void GetBackendPathsOverrideTestImpl()
{
using namespace armnn;
- using namespace boost::filesystem;
+ using namespace fs;
std::string subDir1 = GetTestSubDirectory(g_TestDynamicBackendsSubDir1);
std::string subDir4 = GetTestSubDirectory(g_TestDynamicBackendsSubDir4);
void GetSharedObjectsTestImpl()
{
using namespace armnn;
- using namespace boost::filesystem;
+ using namespace fs;
// The test covers four directories:
// <unit test path>/src/backends/backendsCommon/test/
void CreateDynamicBackendsTestImpl()
{
using namespace armnn;
- using namespace boost::filesystem;
+ using namespace fs;
// The test covers four directories:
// <unit test path>/src/backends/backendsCommon/test/
void CreateDynamicBackendsMixedTypesTestImpl()
{
using namespace armnn;
- using namespace boost::filesystem;
+ using namespace fs;
std::string testDynamicBackendsSubDir5 = GetTestSubDirectory(g_TestDynamicBackendsSubDir5);
std::string testDynamicBackendsSubDir6 = GetTestSubDirectory(g_TestDynamicBackendsSubDir6);
void RegisterSingleDynamicBackendTestImpl()
{
using namespace armnn;
- using namespace boost::filesystem;
+ using namespace fs;
// Register one valid dynamic backend
void RegisterMultipleDynamicBackendsTestImpl()
{
using namespace armnn;
- using namespace boost::filesystem;
+ using namespace fs;
// Register many valid dynamic backends
void RegisterMultipleInvalidDynamicBackendsTestImpl()
{
using namespace armnn;
- using namespace boost::filesystem;
+ using namespace fs;
// Try to register many invalid dynamic backends
void RegisterMixedDynamicBackendsTestImpl()
{
using namespace armnn;
- using namespace boost::filesystem;
+ using namespace fs;
// The test covers five directories:
// <unit test path>/src/backends/backendsCommon/test/
void RuntimeDynamicBackendsTestImpl()
{
using namespace armnn;
- using namespace boost::filesystem;
+ using namespace fs;
// Swapping the backend registry storage for testing
TestBackendRegistry testBackendRegistry;
void RuntimeDuplicateDynamicBackendsTestImpl()
{
using namespace armnn;
- using namespace boost::filesystem;
+ using namespace fs;
// Swapping the backend registry storage for testing
TestBackendRegistry testBackendRegistry;
void RuntimeInvalidDynamicBackendsTestImpl()
{
using namespace armnn;
- using namespace boost::filesystem;
+ using namespace fs;
// Swapping the backend registry storage for testing
TestBackendRegistry testBackendRegistry;
void CreateReferenceDynamicBackendTestImpl()
{
using namespace armnn;
- using namespace boost::filesystem;
+ using namespace fs;
// Swapping the backend registry storage for testing
TestBackendRegistry testBackendRegistry;
void SampleDynamicBackendEndToEndTestImpl()
{
using namespace armnn;
- using namespace boost::filesystem;
// Create runtime in which test will run
IRuntime::CreationOptions options;
IRuntimePtr runtime(IRuntime::Create(options));
cd build
cmake -DBOOST_ROOT=${BOOST_PATH} \
-DBoost_SYSTEM_LIBRARY=${BOOST_PATH}/lib/libboost_system.a \
- -DBoost_FILESYSTEM_LIBRARY=${BOOST_PATH}/lib/libboost_filesystem.a \
-DARMNN_PATH=${ARMNN_PATH}/libarmnn.so ..
```
target_include_directories(Arm_SampleDynamic_backend PRIVATE ${PROJECT_SOURCE_DIR}/../../../src/profiling)
target_include_directories(Arm_SampleDynamic_backend PRIVATE ${PROJECT_SOURCE_DIR}/../../../profiling/common/include)
target_include_directories(Arm_SampleDynamic_backend PRIVATE ${Boost_INCLUDE_DIRS})
-target_link_libraries(Arm_SampleDynamic_backend ${Boost_SYSTEM_LIBRARY} ${Boost_FILESYSTEM_LIBRARY})
+target_link_libraries(Arm_SampleDynamic_backend ${Boost_SYSTEM_LIBRARY})
target_link_libraries(Arm_SampleDynamic_backend ${ARMNN_PATH})
#include <Runtime.hpp>
#include "TestTimelinePacketHandler.hpp"
-#include <boost/filesystem.hpp>
#include <boost/numeric/conversion/cast.hpp>
#include <boost/test/unit_test.hpp>
BOOST_AUTO_TEST_SUITE(FileOnlyProfilingDecoratorTests)
-std::string UniqueFileName()
-{
- std::time_t t = std::time(nullptr);
- char mbstr[100];
- std::strftime(mbstr, sizeof(mbstr), "%Y_%m_%d_%H_%M_%S_", std::localtime(&t));
- std::stringstream ss;
- ss << mbstr;
- ss << t;
- ss << ".bin";
- return ss.str();
-}
-
BOOST_AUTO_TEST_CASE(TestFileOnlyProfiling)
{
// This test requires at least one backend registry to be enabled
return;
}
- // Create a temporary file name.
- fs::path tempPath = fs::temp_directory_path();
- fs::path tempFile = UniqueFileName();
- tempPath = tempPath / tempFile;
+ // Enable m_FileOnly but also provide ILocalPacketHandler which should consume the packets.
+ // This won't dump anything to file.
armnn::Runtime::CreationOptions creationOptions;
creationOptions.m_ProfilingOptions.m_EnableProfiling = true;
creationOptions.m_ProfilingOptions.m_FileOnly = true;
}
// Create a temporary file name.
- fs::path tempPath = fs::temp_directory_path();
- fs::path tempFile = UniqueFileName();
- tempPath = tempPath / tempFile;
+ fs::path tempPath = armnnUtils::Filesystem::NamedTempFile("DumpOutgoingValidFileEndToEnd_CaptureFile.txt");
armnn::Runtime::CreationOptions options;
options.m_ProfilingOptions.m_EnableProfiling = true;
options.m_ProfilingOptions.m_FileOnly = true;
options.m_ProfilingOptions.m_LocalPacketHandlers.push_back(localPacketHandlerPtr);
// Make sure the file does not exist at this point
- BOOST_CHECK(armnnUtils::Filesystem::GetFileSize(tempPath.string().c_str()) == -1);
+ BOOST_CHECK(!fs::exists(tempPath));
armnn::Runtime runtime(options);
// ensure the GUID generator is reset to zero
GetProfilingService(&runtime).ResetExternalProfilingOptions(options.m_ProfilingOptions, true);
// The output file size should be greater than 0.
- BOOST_CHECK(armnnUtils::Filesystem::GetFileSize(tempPath.string().c_str()) > 0);
+ BOOST_CHECK(fs::file_size(tempPath) > 0);
// NOTE: would be an interesting exercise to take this file and decode it
// Delete the tmp file.
- BOOST_CHECK(armnnUtils::Filesystem::Remove(tempPath.string().c_str()));
+ BOOST_CHECK(fs::remove(tempPath));
}
BOOST_AUTO_TEST_SUITE_END()
//
#include "../ProfilingConnectionDumpToFileDecorator.hpp"
+#include <Filesystem.hpp>
#include <Runtime.hpp>
#include <armnn/utility/IgnoreUnused.hpp>
#include <fstream>
#include <sstream>
-#include <boost/filesystem.hpp>
#include <boost/numeric/conversion/cast.hpp>
#include <boost/test/unit_test.hpp>
BOOST_AUTO_TEST_CASE(DumpIncomingValidFile)
{
- boost::filesystem::path fileName =
- boost::filesystem::temp_directory_path() / boost::filesystem::unique_path();
+ fs::path fileName = armnnUtils::Filesystem::NamedTempFile("Armnn-DumpIncomingValidFileTest-TempFile");
armnn::Runtime::CreationOptions::ExternalProfilingOptions options;
options.m_IncomingCaptureFile = fileName.string();
constexpr unsigned int bytesToSkip = 2u * sizeof(uint32_t); // skip header and packet length
int diff = std::strncmp(data.data() + bytesToSkip, packetData, g_DataLength);
BOOST_CHECK(diff == 0);
+ fs::remove(fileName);
}
BOOST_AUTO_TEST_CASE(DumpOutgoingInvalidFile)
BOOST_AUTO_TEST_CASE(DumpOutgoingValidFile)
{
- boost::filesystem::path fileName =
- boost::filesystem::temp_directory_path() / boost::filesystem::unique_path();
+ fs::path fileName = armnnUtils::Filesystem::NamedTempFile("Armnn-DumpOutgoingValidFileTest-TempFile");
armnn::Runtime::CreationOptions::ExternalProfilingOptions options;
options.m_IncomingCaptureFile = "";
// check if the data read back from the dump file matches the original
int diff = std::strncmp(data.data(), g_Data.data(), g_DataLength);
BOOST_CHECK(diff == 0);
+ fs::remove(fileName);
}
BOOST_AUTO_TEST_SUITE_END()
TimelineDirectoryCaptureCommandHandler.hpp)
include_directories(${PROJECT_SOURCE_DIR}/src/profiling
- ${PROJECT_SOURCE_DIR}/profiling/common/include)
+ ${PROJECT_SOURCE_DIR}/profiling/common/include
+ ${PROJECT_SOURCE_DIR}/src/armnnUtils)
if(BUILD_UNIT_TESTS)
target_include_directories(UnitTests PRIVATE ${PROJECT_SOURCE_DIR}/src/timelineDecoder)
#include <string>
#include <fstream>
-#include <boost/filesystem/fstream.hpp>
namespace armnn
{
void JSONTimelineDecoder::PrintJSON(JSONTimelineDecoder::JSONEntity& rootEntity)
{
std::string jsonString = GetJSONString(rootEntity);
- boost::filesystem::ofstream ofs{this->outputJSONFile};
+ std::ofstream ofs{this->outputJSONFile};
ofs << jsonString;
ofs.close();
}
#include <armnn/profiling/ITimelineDecoder.hpp>
+#include <Filesystem.hpp>
#include <map>
#include <vector>
-#include <boost/filesystem/path.hpp>
-#include <boost/filesystem.hpp>
namespace armnn
{
private:
Model m_Model;
- boost::filesystem::path fileDir = boost::filesystem::temp_directory_path();
- boost::filesystem::path p{fileDir / boost::filesystem::unique_path("output.json")};
+ fs::path p = armnnUtils::Filesystem::NamedTempFile("output.json");
std::string outputJSONFile = p.string();
#include <JSONTimelineDecoder.hpp>
#include <TimelineCaptureCommandHandler.hpp>
#include <TimelineDecoder.hpp>
+#include <Filesystem.hpp>
#include <boost/test/test_tools.hpp>
#include <boost/test/unit_test_suite.hpp>
#include <fstream>
-#include <boost/filesystem.hpp>
BOOST_AUTO_TEST_SUITE(JSONTimelineDecoderTests)
timelineDecoder.PrintJSON(rootEntity);
- boost::filesystem::ifstream inFile;
- boost::filesystem::path fileDir = boost::filesystem::temp_directory_path();
- boost::filesystem::path p{fileDir / boost::filesystem::unique_path("output.json")};
-
+ fs::ifstream inFile;
+ fs::path p{fs::temp_directory_path() / "output.json"};
inFile.open(p); //open the input file
std::stringstream strStream;
target_link_libraries(${testName} ${CMAKE_THREAD_LIBS_INIT})
target_link_libraries(${testName}
${Boost_SYSTEM_LIBRARY}
- ${Boost_FILESYSTEM_LIBRARY}
${Boost_PROGRAM_OPTIONS_LIBRARY})
addDllCopyCommands(${testName})
endmacro()
target_link_libraries(${testName} ${CMAKE_THREAD_LIBS_INIT})
target_link_libraries(${testName}
${Boost_SYSTEM_LIBRARY}
- ${Boost_FILESYSTEM_LIBRARY}
${Boost_PROGRAM_OPTIONS_LIBRARY})
addDllCopyCommands(${testName})
endmacro()
target_link_libraries(${testName} ${CMAKE_THREAD_LIBS_INIT})
target_link_libraries(${testName}
${Boost_SYSTEM_LIBRARY}
- ${Boost_FILESYSTEM_LIBRARY}
${Boost_PROGRAM_OPTIONS_LIBRARY})
addDllCopyCommands(${testName})
endmacro()
target_link_libraries(${testName} ${CMAKE_THREAD_LIBS_INIT})
target_link_libraries(${testName}
${Boost_SYSTEM_LIBRARY}
- ${Boost_FILESYSTEM_LIBRARY}
${Boost_PROGRAM_OPTIONS_LIBRARY})
addDllCopyCommands(${testName})
endmacro()
target_link_libraries(ExecuteNetwork ${CMAKE_THREAD_LIBS_INIT})
target_link_libraries(ExecuteNetwork
${Boost_SYSTEM_LIBRARY}
- ${Boost_FILESYSTEM_LIBRARY}
${Boost_PROGRAM_OPTIONS_LIBRARY})
addDllCopyCommands(ExecuteNetwork)
endif()
endif()
target_link_libraries(${executorName}
${Boost_SYSTEM_LIBRARY}
- ${Boost_FILESYSTEM_LIBRARY}
${Boost_PROGRAM_OPTIONS_LIBRARY})
addDllCopyCommands(${executorName})
endmacro()
target_link_libraries(${executorName} ${CMAKE_THREAD_LIBS_INIT})
target_link_libraries(${executorName}
${Boost_SYSTEM_LIBRARY}
- ${Boost_FILESYSTEM_LIBRARY}
${Boost_PROGRAM_OPTIONS_LIBRARY})
addDllCopyCommands(${executorName})
endmacro()
ImageCSVFileGenerator/ImageCSVFileGenerator.cpp)
add_executable_ex(ImageCSVFileGenerator ${ImageCSVFileGenerator_sources})
+ target_include_directories(ImageCSVFileGenerator PRIVATE ../src/armnnUtils)
ImageTensorExecutor(ImageCSVFileGenerator)
endif()
if (CheckOption(vm, "test-cases"))
{
// Check that the file exists.
- if (!boost::filesystem::exists(testCasesFile))
+ if (!fs::exists(testCasesFile))
{
ARMNN_LOG(fatal) << "Given file \"" << testCasesFile << "\" does not exist";
return EXIT_FAILURE;
// SPDX-License-Identifier: MIT
//
-#include <boost/filesystem.hpp>
-#include <boost/filesystem/operations.hpp>
-#include <boost/filesystem/path.hpp>
+#include <Filesystem.hpp>
#include <boost/program_options.hpp>
#include <algorithm>
dir += "/";
}
- if (!boost::filesystem::exists(dir))
+ if (!fs::exists(dir))
{
std::cerr << "Directory [" << dir << "] does not exist" << std::endl;
return false;
}
- if (!boost::filesystem::is_directory(dir))
+ if (!fs::is_directory(dir))
{
std::cerr << "Given directory [" << dir << "] is not a directory" << std::endl;
return false;
return false;
}
- if (boost::filesystem::exists(outputFileName))
+ if (fs::exists(outputFileName))
{
std::cerr << "Output file [" << outputFileName << "] already exists" << std::endl;
return false;
}
- if (boost::filesystem::is_directory(outputFileName))
+ if (fs::is_directory(outputFileName))
{
std::cerr << "Output file [" << outputFileName << "] is a directory" << std::endl;
return false;
}
- boost::filesystem::path outputPath(outputFileName);
- if (!boost::filesystem::exists(outputPath.parent_path()))
+ fs::path outputPath(outputFileName);
+ if (!fs::exists(outputPath.parent_path()))
{
std::cerr << "Directory [" << outputPath.parent_path().c_str() << "] does not exist" << std::endl;
return false;
return -1;
}
- namespace fs = boost::filesystem;
-
const std::string fileFormat(".raw");
const std::string rawDirectory(cmdline.GetInputDirectory());
#include "../InferenceTestImage.hpp"
#include <armnn/Logging.hpp>
#include <armnn/TypesUtils.hpp>
+#include <Filesystem.hpp>
-#include <boost/filesystem.hpp>
-#include <boost/filesystem/operations.hpp>
-#include <boost/filesystem/path.hpp>
#include <boost/program_options.hpp>
#include <boost/variant.hpp>
return false;
}
- if (!boost::filesystem::exists(inputFileName))
+ if (!fs::exists(inputFileName))
{
std::cerr << "Input file [" << inputFileName << "] does not exist" << std::endl;
return false;
}
- if (boost::filesystem::is_directory(inputFileName))
+ if (fs::is_directory(inputFileName))
{
std::cerr << "Input file [" << inputFileName << "] is a directory" << std::endl;
return false;
return false;
}
- if (boost::filesystem::exists(outputFileName))
+ if (fs::exists(outputFileName))
{
std::cerr << "Output file [" << outputFileName << "] already exists" << std::endl;
return false;
}
- if (boost::filesystem::is_directory(outputFileName))
+ if (fs::is_directory(outputFileName))
{
std::cerr << "Output file [" << outputFileName << "] is a directory" << std::endl;
return false;
}
- boost::filesystem::path outputPath(outputFileName);
- if (!boost::filesystem::exists(outputPath.parent_path()))
+ fs::path outputPath(outputFileName);
+ if (!fs::exists(outputPath.parent_path()))
{
std::cerr << "Output directory [" << outputPath.parent_path().c_str() << "] does not exist" << std::endl;
return false;
#include <armnnOnnxParser/IOnnxParser.hpp>
#endif
+#include <Filesystem.hpp>
#include <HeapProfiling.hpp>
#include <TensorIOUtils.hpp>
#include <boost/exception/diagnostic_information.hpp>
#include <boost/format.hpp>
#include <boost/program_options.hpp>
-#include <boost/filesystem.hpp>
#include <boost/variant.hpp>
#include <algorithm>
{
ARMNN_SCOPED_HEAP_PROFILING("Parsing");
- boost::system::error_code errorCode;
- boost::filesystem::path pathToFile(params.m_ModelPath);
- if (!boost::filesystem::exists(pathToFile, errorCode))
+ std::error_code errorCode;
+ fs::path pathToFile(params.m_ModelPath);
+ if (!fs::exists(pathToFile, errorCode))
{
throw armnn::FileNotFoundException(boost::str(
boost::format("Cannot find the file (%1%) errorCode: %2% %3%") %
if (params.m_VisualizePostOptimizationModel)
{
- boost::filesystem::path filename = params.m_ModelPath;
+ fs::path filename = params.m_ModelPath;
filename.replace_extension("dot");
std::fstream file(filename.c_str(), std::ios_base::out);
optNet->SerializeToDot(file);
#include "InferenceTest.hpp"
#include <armnn/utility/Assert.hpp>
+#include <Filesystem.hpp>
#include "../src/armnn/Profiling.hpp"
#include <boost/numeric/conversion/cast.hpp>
-#include <boost/filesystem/path.hpp>
#include <boost/format.hpp>
#include <boost/program_options.hpp>
-#include <boost/filesystem/operations.hpp>
#include <fstream>
#include <iostream>
dir += "/";
}
- if (!boost::filesystem::exists(dir))
+ if (!fs::exists(dir))
{
std::cerr << "Given directory " << dir << " does not exist" << std::endl;
return false;
}
- if (!boost::filesystem::is_directory(dir))
+ if (!fs::is_directory(dir))
{
std::cerr << "Given directory [" << dir << "] is not a directory" << std::endl;
return false;
#include <armnn/utility/Assert.hpp>
#include <boost/numeric/conversion/cast.hpp>
-#include <boost/filesystem/path.hpp>
#include <boost/format.hpp>
#include <boost/program_options.hpp>
-#include <boost/filesystem/operations.hpp>
#include <fstream>
#include <iostream>
#include "../InferenceTest.hpp"
#include "ModelAccuracyChecker.hpp"
#include "armnnDeserializer/IDeserializer.hpp"
+#include <Filesystem.hpp>
-#include <boost/filesystem.hpp>
#include <boost/program_options/variables_map.hpp>
#include <boost/range/iterator_range.hpp>
#include <map>
{
try
{
- using namespace boost::filesystem;
armnn::LogSeverity level = armnn::LogSeverity::Debug;
armnn::ConfigureLogging(true, true, level);
std::vector<BindingPointInfo> outputBindings = { m_OutputBindingInfo };
// Load model output labels
- if (modelOutputLabelsPath.empty() || !boost::filesystem::exists(modelOutputLabelsPath) ||
- !boost::filesystem::is_regular_file(modelOutputLabelsPath))
+ if (modelOutputLabelsPath.empty() || !fs::exists(modelOutputLabelsPath) ||
+ !fs::is_regular_file(modelOutputLabelsPath))
{
ARMNN_LOG(fatal) << "Invalid model output labels path at " << modelOutputLabelsPath;
}
// Validate blacklist file if it's specified
if (!blacklistPath.empty() &&
- !(boost::filesystem::exists(blacklistPath) && boost::filesystem::is_regular_file(blacklistPath)))
+ !(fs::exists(blacklistPath) && fs::is_regular_file(blacklistPath)))
{
ARMNN_LOG(fatal) << "Invalid path to blacklist file at " << blacklistPath;
return 1;
vector<TContainer> inputDataContainers;
vector<TContainer> outputDataContainers;
- auto imagePath = pathToDataDir / boost::filesystem::path(imageName);
+ auto imagePath = pathToDataDir / fs::path(imageName);
switch (inputTensorDataType)
{
case armnn::DataType::Signed32:
// Populate imageFilenames with names of all .JPEG, .PNG images
std::vector<std::string> imageFilenames;
for (const auto& imageEntry :
- boost::make_iterator_range(boost::filesystem::directory_iterator(boost::filesystem::path(imageDirectoryPath))))
+ boost::make_iterator_range(fs::directory_iterator(fs::path(imageDirectoryPath))))
{
- boost::filesystem::path imagePath = imageEntry.path();
+ fs::path imagePath = imageEntry.path();
std::string imageExtension = boost::to_upper_copy<std::string>(imagePath.extension().string());
- if (boost::filesystem::is_regular_file(imagePath) && (imageExtension == ".JPEG" || imageExtension == ".PNG"))
+ if (fs::is_regular_file(imagePath) && (imageExtension == ".JPEG" || imageExtension == ".PNG"))
{
imageFilenames.push_back(imagePath.filename().string());
}