diff options
-rw-r--r-- | CMakeLists.txt | 12 | ||||
-rw-r--r-- | src/armnn/layers/StackLayer.cpp | 4 | ||||
-rwxr-xr-x | src/armnnTfLiteParser/CMakeLists.txt | 3 | ||||
-rw-r--r-- | src/armnnTfLiteParser/test/LoadModel.cpp | 2 | ||||
-rw-r--r-- | src/backends/backendsCommon/DynamicBackendUtils.cpp | 12 | ||||
-rw-r--r-- | src/backends/backendsCommon/DynamicBackendUtils.hpp | 12 | ||||
-rw-r--r-- | src/backends/reference/RefMemoryManager.cpp | 8 |
7 files changed, 38 insertions, 15 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 2236e2469e..420aabd365 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -449,18 +449,22 @@ target_link_libraries(armnn armnnUtils) target_link_libraries(armnn ${CMAKE_DL_LIBS}) install(TARGETS armnn - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}) + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) if(BUILD_CAFFE_PARSER) install(TARGETS armnnCaffeParser - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}) + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) endif() if(BUILD_ONNX_PARSER) install(TARGETS armnnOnnxParser - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}) + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) endif() if(BUILD_TF_PARSER) install(TARGETS armnnTfParser - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}) + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) endif() install(DIRECTORY include/ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) diff --git a/src/armnn/layers/StackLayer.cpp b/src/armnn/layers/StackLayer.cpp index 7f1dbec461..43e0ac3134 100644 --- a/src/armnn/layers/StackLayer.cpp +++ b/src/armnn/layers/StackLayer.cpp @@ -38,7 +38,7 @@ std::vector<TensorShape> StackLayer::InferOutputShapes(const std::vector<TensorS BOOST_ASSERT(axis <= inputNumDimensions); - unsigned int dimensionSizes[inputNumDimensions + 1]; + std::vector<unsigned int> dimensionSizes(inputNumDimensions + 1, 0); for (unsigned int i = 0; i < axis; ++i) { dimensionSizes[i] = inputShape[i]; @@ -51,7 +51,7 @@ std::vector<TensorShape> StackLayer::InferOutputShapes(const std::vector<TensorS dimensionSizes[i] = inputShape[i-1]; } - TensorShape targetShape = TensorShape(inputNumDimensions + 1, dimensionSizes); + TensorShape targetShape = TensorShape(inputNumDimensions + 1, dimensionSizes.data()); return std::vector<TensorShape>({ targetShape }); } diff --git a/src/armnnTfLiteParser/CMakeLists.txt b/src/armnnTfLiteParser/CMakeLists.txt index 8ff0837e31..17d4cf68c2 100755 --- a/src/armnnTfLiteParser/CMakeLists.txt +++ b/src/armnnTfLiteParser/CMakeLists.txt @@ -22,5 +22,6 @@ if(BUILD_TF_LITE_PARSER) target_link_libraries(armnnTfLiteParser armnn ${FLATBUFFERS_LIBRARY}) install(TARGETS armnnTfLiteParser - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}) + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) endif() diff --git a/src/armnnTfLiteParser/test/LoadModel.cpp b/src/armnnTfLiteParser/test/LoadModel.cpp index dac30efb1e..9ae3412a11 100644 --- a/src/armnnTfLiteParser/test/LoadModel.cpp +++ b/src/armnnTfLiteParser/test/LoadModel.cpp @@ -6,8 +6,6 @@ #include "ParserFlatbuffersFixture.hpp" #include "../TfLiteParser.hpp" -#include <unistd.h> - using armnnTfLiteParser::TfLiteParser; using ModelPtr = TfLiteParser::ModelPtr; using SubgraphPtr = TfLiteParser::SubgraphPtr; diff --git a/src/backends/backendsCommon/DynamicBackendUtils.cpp b/src/backends/backendsCommon/DynamicBackendUtils.cpp index fc4336f4ac..da7c3244f1 100644 --- a/src/backends/backendsCommon/DynamicBackendUtils.cpp +++ b/src/backends/backendsCommon/DynamicBackendUtils.cpp @@ -16,6 +16,7 @@ namespace armnn void* DynamicBackendUtils::OpenHandle(const std::string& sharedObjectPath) { +#if defined(__unix__) if (sharedObjectPath.empty()) { throw RuntimeException("OpenHandle error: shared object path must not be empty"); @@ -28,16 +29,23 @@ void* DynamicBackendUtils::OpenHandle(const std::string& sharedObjectPath) } return sharedObjectHandle; +#else + throw RuntimeException("Dynamic backends not supported on this platform"); +#endif } void DynamicBackendUtils::CloseHandle(const void* sharedObjectHandle) { +#if defined(__unix__) if (!sharedObjectHandle) { return; } dlclose(const_cast<void*>(sharedObjectHandle)); +#else + throw RuntimeException("Dynamic backends not supported on this platform"); +#endif } bool DynamicBackendUtils::IsBackendCompatible(const BackendVersion &backendVersion) @@ -56,6 +64,7 @@ bool DynamicBackendUtils::IsBackendCompatibleImpl(const BackendVersion &backendA std::string DynamicBackendUtils::GetDlError() { +#if defined(__unix__) const char* errorMessage = dlerror(); if (!errorMessage) { @@ -63,6 +72,9 @@ std::string DynamicBackendUtils::GetDlError() } return std::string(errorMessage); +#else + throw RuntimeException("Dynamic backends not supported on this platform"); +#endif } std::vector<std::string> DynamicBackendUtils::GetBackendPaths(const std::string& overrideBackendPath) diff --git a/src/backends/backendsCommon/DynamicBackendUtils.hpp b/src/backends/backendsCommon/DynamicBackendUtils.hpp index 0aa0ac8da5..6d9f11d215 100644 --- a/src/backends/backendsCommon/DynamicBackendUtils.hpp +++ b/src/backends/backendsCommon/DynamicBackendUtils.hpp @@ -10,11 +10,13 @@ #include <armnn/Exceptions.hpp> +#include <boost/format.hpp> + #include <string> -#include <dlfcn.h> #include <vector> - -#include <boost/format.hpp> +#if defined(__unix__) +#include <dlfcn.h> +#endif #if !defined(DYNAMIC_BACKEND_PATHS) #define DYNAMIC_BACKEND_PATHS "" @@ -58,6 +60,7 @@ private: template<typename EntryPointType> EntryPointType DynamicBackendUtils::GetEntryPoint(const void* sharedObjectHandle, const char* symbolName) { +#if defined(__unix__) if (sharedObjectHandle == nullptr) { throw RuntimeException("GetEntryPoint error: invalid handle"); @@ -75,6 +78,9 @@ EntryPointType DynamicBackendUtils::GetEntryPoint(const void* sharedObjectHandle } return entryPoint; +#else + throw RuntimeException("Dynamic backends not supported on this platform"); +#endif } } // namespace armnn diff --git a/src/backends/reference/RefMemoryManager.cpp b/src/backends/reference/RefMemoryManager.cpp index 0f4a289807..fdd008dbe6 100644 --- a/src/backends/reference/RefMemoryManager.cpp +++ b/src/backends/reference/RefMemoryManager.cpp @@ -6,6 +6,8 @@ #include <boost/assert.hpp> +#include <algorithm> + namespace armnn { @@ -73,7 +75,7 @@ RefMemoryManager::Pool::~Pool() void* RefMemoryManager::Pool::GetPointer() { - BOOST_ASSERT_MSG(m_Pointer, "RefMemoryManager::Pool::GetPointer() called when memory not acquired"); + BOOST_ASSERT_MSG(m_Pointer, "RefMemoryManager::Pool::GetPointer() called when memory not acquired"); return m_Pointer; } @@ -85,14 +87,14 @@ void RefMemoryManager::Pool::Reserve(unsigned int numBytes) void RefMemoryManager::Pool::Acquire() { - BOOST_ASSERT_MSG(!m_Pointer, "RefMemoryManager::Pool::Acquire() called when memory already acquired"); + BOOST_ASSERT_MSG(!m_Pointer, "RefMemoryManager::Pool::Acquire() called when memory already acquired"); BOOST_ASSERT(m_Size >= 0); m_Pointer = ::operator new(size_t(m_Size)); } void RefMemoryManager::Pool::Release() { - BOOST_ASSERT_MSG(m_Pointer, "RefMemoryManager::Pool::Release() called when memory not acquired"); + BOOST_ASSERT_MSG(m_Pointer, "RefMemoryManager::Pool::Release() called when memory not acquired"); ::operator delete(m_Pointer); m_Pointer = nullptr; } |