Compilation for WebAssembly: part 1 (#15008)
This commit is contained in:
parent
d6a4635fd5
commit
efa5c51122
@ -83,6 +83,9 @@ macro(ie_sse42_optimization_flags flags)
|
||||
set(${flags} -xSSE4.2)
|
||||
else()
|
||||
set(${flags} -msse4.2)
|
||||
if(EMSCRIPTEN)
|
||||
list(APPEND ${flags} -msimd128)
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
endmacro()
|
||||
@ -220,7 +223,9 @@ endfunction()
|
||||
# Compilation and linker flags
|
||||
#
|
||||
|
||||
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
|
||||
if(NOT DEFINED CMAKE_POSITION_INDEPENDENT_CODE)
|
||||
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
|
||||
endif()
|
||||
|
||||
# to allows to override CMAKE_CXX_STANDARD from command line
|
||||
if(NOT DEFINED CMAKE_CXX_STANDARD)
|
||||
@ -353,11 +358,19 @@ else()
|
||||
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,-dead_strip")
|
||||
set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} -Wl,-dead_strip")
|
||||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-dead_strip")
|
||||
elseif(EMSCRIPTEN)
|
||||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -s MODULARIZE -s EXPORTED_RUNTIME_METHODS=ccall")
|
||||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -s ERROR_ON_MISSING_LIBRARIES=1 -s ERROR_ON_UNDEFINED_SYMBOLS=1")
|
||||
# set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -s USE_PTHREADS=1 -s PTHREAD_POOL_SIZE=4")
|
||||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -s ALLOW_MEMORY_GROWTH=1")
|
||||
ie_add_compiler_flags(-sDISABLE_EXCEPTION_CATCHING=0)
|
||||
# ie_add_compiler_flags(-sUSE_PTHREADS=1)
|
||||
else()
|
||||
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--gc-sections -Wl,--exclude-libs,ALL")
|
||||
set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} -Wl,--gc-sections -Wl,--exclude-libs,ALL")
|
||||
set(exclude_libs "-Wl,--exclude-libs,ALL")
|
||||
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--gc-sections ${exclude_libs}")
|
||||
set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} -Wl,--gc-sections ${exclude_libs}")
|
||||
if(NOT ENABLE_FUZZING)
|
||||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--exclude-libs,ALL")
|
||||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${exclude_libs}")
|
||||
endif()
|
||||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--gc-sections")
|
||||
endif()
|
||||
|
@ -5,8 +5,13 @@
|
||||
if(UNIX)
|
||||
set(IE_C_CXX_FLAGS "${IE_C_CXX_FLAGS} -Wformat -Wformat-security")
|
||||
if (NOT ENABLE_SANITIZER)
|
||||
# ASan does not support fortification https://github.com/google/sanitizers/issues/247
|
||||
set(IE_C_CXX_FLAGS "${IE_C_CXX_FLAGS} -D_FORTIFY_SOURCE=2")
|
||||
if(EMSCRIPTEN)
|
||||
# emcc does not support fortification, see:
|
||||
# https://stackoverflow.com/questions/58854858/undefined-symbol-stack-chk-guard-in-libopenh264-so-when-building-ffmpeg-wit
|
||||
else()
|
||||
# ASan does not support fortification https://github.com/google/sanitizers/issues/247
|
||||
set(IE_C_CXX_FLAGS "${IE_C_CXX_FLAGS} -D_FORTIFY_SOURCE=2")
|
||||
endif()
|
||||
endif()
|
||||
if(NOT APPLE)
|
||||
set(CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} -pie")
|
||||
@ -24,7 +29,12 @@ if(UNIX)
|
||||
set(IE_C_CXX_FLAGS "${IE_C_CXX_FLAGS} -s")
|
||||
endif()
|
||||
elseif(OV_COMPILER_IS_CLANG)
|
||||
set(IE_C_CXX_FLAGS "${IE_C_CXX_FLAGS} -fstack-protector-all")
|
||||
if(EMSCRIPTEN)
|
||||
# emcc does not support fortification
|
||||
# https://stackoverflow.com/questions/58854858/undefined-symbol-stack-chk-guard-in-libopenh264-so-when-building-ffmpeg-wit
|
||||
else()
|
||||
set(IE_C_CXX_FLAGS "${IE_C_CXX_FLAGS} -fstack-protector-all")
|
||||
endif()
|
||||
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "Intel")
|
||||
if (NOT ENABLE_SANITIZER)
|
||||
set(IE_C_CXX_FLAGS "${IE_C_CXX_FLAGS} -Wl,--strip-all")
|
||||
|
@ -8,7 +8,7 @@ include(target_flags)
|
||||
# FIXME: there are compiler failures with LTO and Cross-Compile toolchains. Disabling for now, but
|
||||
# this must be addressed in a proper way
|
||||
ie_dependent_option (ENABLE_LTO "Enable Link Time Optimization" OFF
|
||||
"LINUX OR (APPLE AND AARCH64);NOT CMAKE_CROSSCOMPILING;CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 4.9" OFF)
|
||||
"LINUX OR (APPLE AND AARCH64);EMSCRIPTEN OR NOT CMAKE_CROSSCOMPILING;CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 4.9" OFF)
|
||||
|
||||
ie_option (OS_FOLDER "create OS dedicated folder in output" OFF)
|
||||
|
||||
@ -42,24 +42,31 @@ ie_dependent_option (ENABLE_COVERAGE "enable code coverage" OFF "CMAKE_CXX_COMPI
|
||||
|
||||
# Defines CPU capabilities
|
||||
|
||||
ie_dependent_option (ENABLE_SSE42 "Enable SSE4.2 optimizations" ON "X86_64 OR X86" OFF)
|
||||
ie_dependent_option (ENABLE_SSE42 "Enable SSE4.2 optimizations" ON "X86_64 OR (X86 AND NOT EMSCRIPTEN)" OFF)
|
||||
|
||||
ie_dependent_option (ENABLE_AVX2 "Enable AVX2 optimizations" ON "X86_64 OR X86" OFF)
|
||||
ie_dependent_option (ENABLE_AVX2 "Enable AVX2 optimizations" ON "X86_64 OR (X86 AND NOT EMSCRIPTEN)" OFF)
|
||||
|
||||
ie_dependent_option (ENABLE_AVX512F "Enable AVX512 optimizations" ON "X86_64 OR X86" OFF)
|
||||
ie_dependent_option (ENABLE_AVX512F "Enable AVX512 optimizations" ON "X86_64 OR (X86 AND NOT EMSCRIPTEN)" OFF)
|
||||
|
||||
ie_option (BUILD_SHARED_LIBS "Build as a shared library" ON)
|
||||
if(EMSCRIPTEN)
|
||||
set (BUILD_SHARED_LIBS_DEFAULT OFF)
|
||||
else()
|
||||
set (BUILD_SHARED_LIBS_DEFAULT ON)
|
||||
endif()
|
||||
|
||||
# Type of build, we add this as an explicit option to default it to ON
|
||||
ie_option (BUILD_SHARED_LIBS "Build as a shared library" ${BUILD_SHARED_LIBS_DEFAULT})
|
||||
|
||||
# Android does not support SOVERSION
|
||||
# see https://www.opengis.ch/2011/11/23/creating-non-versioned-shared-libraries-for-android/
|
||||
ie_dependent_option (ENABLE_LIBRARY_VERSIONING "Enable libraries versioning" ON "NOT WIN32;NOT ANDROID" OFF)
|
||||
ie_dependent_option (ENABLE_LIBRARY_VERSIONING "Enable libraries versioning" ON "NOT WIN32;NOT ANDROID;BUILD_SHARED_LIBS" OFF)
|
||||
|
||||
ie_dependent_option (ENABLE_FASTER_BUILD "Enable build features (PCH, UNITY) to speed up build time" OFF "CMAKE_VERSION VERSION_GREATER_EQUAL 3.16" OFF)
|
||||
|
||||
if(UNIX AND NOT ANDROID)
|
||||
set(STYLE_CHECKS_DEFAULT ON)
|
||||
else()
|
||||
if(CMAKE_CROSSCOMPILING)
|
||||
set(STYLE_CHECKS_DEFAULT OFF)
|
||||
else()
|
||||
set(STYLE_CHECKS_DEFAULT ON)
|
||||
endif()
|
||||
|
||||
ie_option (ENABLE_CPPLINT "Enable cpplint checks during the build" ${STYLE_CHECKS_DEFAULT})
|
||||
|
@ -4,7 +4,10 @@
|
||||
|
||||
include(target_flags)
|
||||
|
||||
if(CMAKE_HOST_SYSTEM_NAME STREQUAL "Linux")
|
||||
# TODO: remove this function: we must not have conditions for particular OS names or versions
|
||||
|
||||
# cmake needs to look at /etc files only when we build for Linux on Linux
|
||||
if(CMAKE_HOST_LINUX AND LINUX)
|
||||
function(get_linux_name res_var)
|
||||
if(EXISTS "/etc/lsb-release")
|
||||
# linux version detection using cat /etc/lsb-release
|
||||
|
@ -69,18 +69,28 @@ elseif(CMAKE_HOST_SYSTEM_PROCESSOR MATCHES "^riscv64$")
|
||||
set(HOST_RISCV64 ON)
|
||||
endif()
|
||||
|
||||
if(UNIX AND NOT (APPLE OR ANDROID))
|
||||
if(CMAKE_SYSTEM_NAME STREQUAL "Emscripten")
|
||||
set(EMSCRIPTEN ON)
|
||||
endif()
|
||||
|
||||
if(UNIX AND NOT (APPLE OR ANDROID OR EMSCRIPTEN))
|
||||
set(LINUX ON)
|
||||
endif()
|
||||
|
||||
if(NOT DEFINED CMAKE_HOST_LINUX AND CMAKE_HOST_SYSTEM_NAME STREQUAL "Linux")
|
||||
set(CMAKE_HOST_LINUX ON)
|
||||
endif()
|
||||
|
||||
if(ENV{OECORE_NATIVE_SYSROOT} AND AARCH64)
|
||||
set(YOCTO_AARCH64 ON)
|
||||
endif()
|
||||
|
||||
if(EXISTS "/etc/debian_version")
|
||||
set(OV_OS_DEBIAN ON)
|
||||
elseif(EXISTS "/etc/redhat-release")
|
||||
set(OV_OS_RHEL ON)
|
||||
if(CMAKE_HOST_LINUX AND LINUX)
|
||||
if(EXISTS "/etc/debian_version")
|
||||
set(OV_OS_DEBIAN ON)
|
||||
elseif(EXISTS "/etc/redhat-release")
|
||||
set(OV_OS_RHEL ON)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(CMAKE_CXX_COMPILER_ID MATCHES "^(Apple)?Clang$")
|
||||
@ -93,7 +103,8 @@ endif()
|
||||
get_property(OV_GENERATOR_MULTI_CONFIG GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
|
||||
|
||||
function(ov_glibc_version)
|
||||
if(LINUX)
|
||||
# cmake needs to look at glibc version only when we build for Linux on Linux
|
||||
if(CMAKE_HOST_LINUX AND LINUX)
|
||||
function(ov_get_definition definition var)
|
||||
execute_process(COMMAND echo "#include <errno.h>"
|
||||
COMMAND "${CMAKE_CXX_COMPILER}" -xc - -E -dM
|
||||
|
@ -14,17 +14,17 @@ ieTargetLinkWholeArchive("MyriadFunctionalTests" "CommonLib" "AnotherLib")
|
||||
function(ieTargetLinkWholeArchive targetName)
|
||||
set(libs)
|
||||
foreach(staticLib ${ARGN})
|
||||
if (MSVC)
|
||||
if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
|
||||
# CMake does not support generator expression in LINK_FLAGS, so we workaround it a little bit:
|
||||
# passing same static library as normal link (to get build deps working, and includes too), than using WHOLEARCHIVE option
|
||||
# it's important here to not use slash '/' for option !
|
||||
if (CMAKE_GENERATOR MATCHES "Visual Studio")
|
||||
if(CMAKE_GENERATOR MATCHES "Visual Studio")
|
||||
# MSBuild is unhappy when parsing double quotes in combination with WHOLEARCHIVE flag.
|
||||
# remove quotes from path - so build path with spaces not supported, but it's better than nothing.
|
||||
list(APPEND libs ${staticLib}
|
||||
"-WHOLEARCHIVE:$<TARGET_FILE:${staticLib}>"
|
||||
)
|
||||
if (CMAKE_CURRENT_BINARY_DIR MATCHES " ")
|
||||
if(CMAKE_CURRENT_BINARY_DIR MATCHES " ")
|
||||
message(WARNING "Visual Studio CMake generator may cause problems if your build directory contains spaces. "
|
||||
"Remove spaces from path or select different generator.")
|
||||
endif()
|
||||
@ -47,7 +47,7 @@ function(ieTargetLinkWholeArchive targetName)
|
||||
)
|
||||
endif()
|
||||
endforeach()
|
||||
if (libs)
|
||||
if(libs)
|
||||
target_link_libraries(${targetName} PRIVATE ${libs})
|
||||
endif()
|
||||
endfunction()
|
||||
|
@ -6,7 +6,7 @@
|
||||
# Common cmake options
|
||||
#
|
||||
|
||||
ie_dependent_option (ENABLE_INTEL_CPU "CPU plugin for OpenVINO Runtime" ON "X86_64" OFF)
|
||||
ie_dependent_option (ENABLE_INTEL_CPU "CPU plugin for OpenVINO Runtime" ON "RISCV64 OR X86 OR X86_64" OFF)
|
||||
|
||||
ie_option (ENABLE_TESTS "unit, behavior and functional tests" OFF)
|
||||
|
||||
@ -100,7 +100,7 @@ ie_option (ENABLE_TEMPLATE "Enable template plugin" ON)
|
||||
|
||||
ie_dependent_option (ENABLE_INTEL_MYRIAD_COMMON "common part of myriad plugin" ON "NOT WINDOWS_PHONE;NOT WINDOWS_STORE" OFF)
|
||||
|
||||
if(UNIVERSAL2)
|
||||
if(UNIVERSAL2 OR EMSCRIPTEN)
|
||||
set(ENABLE_INTEL_MYRIAD_DEFAULT OFF)
|
||||
else()
|
||||
set(ENABLE_INTEL_MYRIAD_DEFAULT ON)
|
||||
@ -132,7 +132,7 @@ set(OPENVINO_EXTRA_MODULES "" CACHE STRING "Extra paths for extra modules to inc
|
||||
|
||||
ie_dependent_option(ENABLE_TBB_RELEASE_ONLY "Only Release TBB libraries are linked to the OpenVINO Runtime binaries" ON "THREADING MATCHES TBB;LINUX" OFF)
|
||||
|
||||
if(LINUX)
|
||||
if(CMAKE_HOST_LINUX AND LINUX)
|
||||
# Debian packages are enabled on Ubuntu systems
|
||||
# so, system TBB / pugixml can be tried for usage
|
||||
set(ENABLE_SYSTEM_LIBS_DEFAULT ON)
|
||||
@ -165,10 +165,10 @@ ie_dependent_option (ENABLE_CPU_DEBUG_CAPS "enable CPU debug capabilities at run
|
||||
find_host_package(PythonInterp 3 QUIET)
|
||||
ie_option(ENABLE_OV_ONNX_FRONTEND "Enable ONNX FrontEnd" ${PYTHONINTERP_FOUND})
|
||||
ie_option(ENABLE_OV_PADDLE_FRONTEND "Enable PaddlePaddle FrontEnd" ON)
|
||||
ie_option(ENABLE_OV_IR_FRONTEND "Enable IR FrontEnd" ON)
|
||||
ie_option(ENABLE_OV_TF_FRONTEND "Enable TensorFlow FrontEnd" ON)
|
||||
ie_dependent_option(ENABLE_SYSTEM_PROTOBUF "Use system protobuf" OFF
|
||||
"ENABLE_OV_ONNX_FRONTEND OR ENABLE_OV_PADDLE_FRONTEND OR ENABLE_OV_TF_FRONTEND;BUILD_SHARED_LIBS" OFF)
|
||||
ie_option(ENABLE_OV_IR_FRONTEND "Enable IR FrontEnd" ON)
|
||||
|
||||
ie_dependent_option(ENABLE_OV_CORE_UNIT_TESTS "Enables OpenVINO core unit tests" ON "ENABLE_TESTS" OFF)
|
||||
ie_option(ENABLE_OPENVINO_DEBUG "Enable output for OPENVINO_DEBUG statements" OFF)
|
||||
|
@ -243,10 +243,10 @@ macro(_ov_find_intel_myriad_dependencies)
|
||||
set(pkg_config_required_arg REQUIRED)
|
||||
endif()
|
||||
pkg_search_module(libusb
|
||||
${pkg_config_quiet_arg}
|
||||
${pkg_config_required_arg}
|
||||
IMPORTED_TARGET
|
||||
libusb-1.0)
|
||||
${pkg_config_quiet_arg}
|
||||
${pkg_config_required_arg}
|
||||
IMPORTED_TARGET
|
||||
libusb-1.0)
|
||||
unset(pkg_config_quiet_arg)
|
||||
unset(pkg_config_required_arg)
|
||||
endif()
|
||||
|
@ -217,7 +217,7 @@ Shape snippets::op::Subgraph::canonicalize(const BlockedShapeVector& outputShape
|
||||
startOffset--;
|
||||
}
|
||||
std::copy(inShape.begin(), inShape.end(), &newShape[startOffset]);
|
||||
inShape = move(newShape);
|
||||
inShape = std::move(newShape);
|
||||
} else {
|
||||
// todo: 4d blocked + 5d planar layouts are not supported: <N, C, H, W, c> + <N, C, D, H, W>
|
||||
NODE_VALIDATION_CHECK(this,
|
||||
|
@ -415,7 +415,7 @@ static std::string get_ov_library_path_a() {
|
||||
}
|
||||
GetModuleFileNameA(hm, (LPSTR)ov_library_path, sizeof(ov_library_path));
|
||||
return get_path_name(std::string(ov_library_path));
|
||||
#elif defined(__APPLE__) || defined(__linux__)
|
||||
#elif defined(__APPLE__) || defined(__linux__) || defined(__EMSCRIPTEN__)
|
||||
Dl_info info;
|
||||
dladdr(reinterpret_cast<void*>(ov::util::get_ov_lib_path), &info);
|
||||
return get_path_name(ov::util::get_absolute_file_path(info.dli_fname)).c_str();
|
||||
@ -449,7 +449,7 @@ std::wstring ov::util::get_ov_lib_path_w() {
|
||||
}
|
||||
GetModuleFileNameW(hm, (LPWSTR)ov_library_path, sizeof(ov_library_path) / sizeof(ov_library_path[0]));
|
||||
return get_path_name(std::wstring(ov_library_path));
|
||||
# elif defined(__linux__) || defined(__APPLE__)
|
||||
# elif defined(__linux__) || defined(__APPLE__) || defined(__EMSCRIPTEN__)
|
||||
return ov::util::string_to_wstring(get_ov_library_path_a());
|
||||
# else
|
||||
# error "Unsupported OS"
|
||||
|
@ -78,7 +78,7 @@ pair<Shape, vector<Shape>> get_numpy_broadcast_shapes(const vector<Shape>& input
|
||||
for (const Shape& input : input_shapes) {
|
||||
Shape padded_shape{input};
|
||||
padded_shape.insert(begin(padded_shape), target_shape.size() - padded_shape.size(), 1);
|
||||
full_shapes.push_back(move(padded_shape));
|
||||
full_shapes.push_back(std::move(padded_shape));
|
||||
}
|
||||
|
||||
return {target_shape, full_shapes};
|
||||
@ -194,7 +194,7 @@ static shared_ptr<Node> broadcast_value_pdpd_style(const Output<Node>& value, co
|
||||
auto value_bcast =
|
||||
make_shared<op::v1::Broadcast>(trimmed_value, shape_const, opset1::get_axes_mapping_output(output_shape, axes));
|
||||
|
||||
return move(value_bcast);
|
||||
return std::move(value_bcast);
|
||||
}
|
||||
|
||||
pair<shared_ptr<Node>, shared_ptr<Node>> numpy_broadcast(const pair<Output<Node>, Output<Node>>& args) {
|
||||
|
@ -335,7 +335,7 @@ public:
|
||||
OPENVINO_RTTI("AttributeAdapter<uint64_t>");
|
||||
};
|
||||
|
||||
#ifdef __APPLE__
|
||||
#if defined(__APPLE__) || defined(__EMSCRIPTEN__)
|
||||
// size_t is one of the uint types on _WIN32
|
||||
template <>
|
||||
class OPENVINO_API AttributeAdapter<size_t> : public IndirectScalarValueAccessor<size_t, int64_t> {
|
||||
|
@ -16,10 +16,6 @@ endif()
|
||||
|
||||
message(STATUS "OpenVINO Core unit tests enabled")
|
||||
|
||||
if(LINUX)
|
||||
set(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE)
|
||||
endif()
|
||||
|
||||
# For type relaxed types
|
||||
set_source_files_properties(${CMAKE_CURRENT_SOURCE_DIR}/threading.cpp
|
||||
PROPERTIES INCLUDE_DIRECTORIES $<TARGET_PROPERTY:inference_engine_transformations,INTERFACE_INCLUDE_DIRECTORIES>)
|
||||
|
@ -51,7 +51,7 @@ static std::string _get_frontend_library_path() {
|
||||
GetModuleFileNameA(hm, (LPSTR)ie_library_path, sizeof(ie_library_path));
|
||||
return ov::util::get_directory(std::string(ie_library_path));
|
||||
# endif
|
||||
#elif defined(__APPLE__) || defined(__linux__)
|
||||
#elif defined(__APPLE__) || defined(__linux__) || defined(__EMSCRIPTEN__)
|
||||
Dl_info info;
|
||||
dladdr(reinterpret_cast<void*>(ov::frontend::get_frontend_library_path), &info);
|
||||
return ov::util::get_directory(ov::util::get_absolute_file_path(std::string(info.dli_fname))).c_str();
|
||||
|
@ -273,7 +273,7 @@ void XmlDeserializer::on_adapter(const std::string& name, ngraph::ValueAccessor<
|
||||
if (!getParameters<size_t>(m_node.child("data"), name, shape))
|
||||
return;
|
||||
static_cast<ngraph::Strides&>(*a) = ngraph::Strides(shape);
|
||||
#ifdef __APPLE__
|
||||
#if defined(__APPLE__) || defined(__EMSCRIPTEN__)
|
||||
} else if (auto a = ngraph::as_type<ngraph::AttributeAdapter<std::vector<size_t>>>(&adapter)) {
|
||||
std::vector<size_t> result;
|
||||
if (!getParameters<size_t>(m_node.child("data"), name, result))
|
||||
|
@ -21,10 +21,6 @@ add_compile_definitions(
|
||||
MANIFEST="${CMAKE_CURRENT_SOURCE_DIR}/unit_test.manifest"
|
||||
SERIALIZED_ZOO="${TEST_MODEL_ZOO}")
|
||||
|
||||
if(LINUX)
|
||||
set(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE)
|
||||
endif()
|
||||
|
||||
list(APPEND ONNX_TESTS_DEPENDENCIES openvino_template_extension)
|
||||
|
||||
if (ENABLE_INTEL_CPU)
|
||||
|
@ -51,7 +51,7 @@ if(WIN32)
|
||||
file (GLOB LIBRARY_HEADERS
|
||||
${LIBRARY_HEADERS}
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/src/os/win/*.hpp)
|
||||
elseif(NOT APPLE)
|
||||
elseif(NOT (APPLE OR EMSCRIPTEN))
|
||||
file (GLOB LIBRARY_SRC
|
||||
${LIBRARY_SRC}
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/src/os/lin/*.cpp)
|
||||
|
@ -78,7 +78,7 @@ static std::string getIELibraryPathA() {
|
||||
}
|
||||
GetModuleFileNameA(hm, (LPSTR)ie_library_path, sizeof(ie_library_path));
|
||||
return getPathName(std::string(ie_library_path));
|
||||
#elif defined(__APPLE__) || defined(__linux__)
|
||||
#elif defined(__APPLE__) || defined(__linux__) || defined(__EMSCRIPTEN__)
|
||||
# ifdef USE_STATIC_IE
|
||||
# ifdef __APPLE__
|
||||
Dl_info info;
|
||||
@ -114,7 +114,7 @@ std::wstring getIELibraryPathW() {
|
||||
}
|
||||
GetModuleFileNameW(hm, (LPWSTR)ie_library_path, sizeof(ie_library_path) / sizeof(ie_library_path[0]));
|
||||
return getPathName(std::wstring(ie_library_path));
|
||||
# elif defined(__linux__) || defined(__APPLE__)
|
||||
# elif defined(__linux__) || defined(__APPLE__) || defined(__EMSCRIPTEN__)
|
||||
return ::ov::util::string_to_wstring(getIELibraryPathA().c_str());
|
||||
# else
|
||||
# error "Unsupported OS"
|
||||
|
@ -100,7 +100,7 @@ bool checkOpenMpEnvVars(bool includeOMPNumThreads) {
|
||||
return false;
|
||||
}
|
||||
|
||||
#if defined(__APPLE__)
|
||||
#if defined(__APPLE__) || defined(__EMSCRIPTEN__)
|
||||
// for Linux and Windows the getNumberOfCPUCores (that accounts only for physical cores) implementation is OS-specific
|
||||
// (see cpp files in corresponding folders), for __APPLE__ it is default :
|
||||
int getNumberOfCPUCores(bool) {
|
||||
|
@ -11,13 +11,13 @@
|
||||
|
||||
#include "ie_system_conf.h"
|
||||
|
||||
#if !(defined(__APPLE__) || defined(_WIN32))
|
||||
#if !(defined(__APPLE__) || defined(__EMSCRIPTEN__) || defined(_WIN32))
|
||||
# include <sched.h>
|
||||
# include <unistd.h>
|
||||
#endif
|
||||
|
||||
namespace InferenceEngine {
|
||||
#if !(defined(__APPLE__) || defined(_WIN32))
|
||||
#if !(defined(__APPLE__) || defined(__EMSCRIPTEN__) || defined(_WIN32))
|
||||
std::tuple<CpuSet, int> GetProcessMask() {
|
||||
for (int ncpus = sizeof(cpu_set_t) / CHAR_BIT; ncpus < 32768 /* reasonable limit of #cores*/; ncpus <<= 1) {
|
||||
CpuSet mask{CPU_ALLOC(ncpus)};
|
||||
@ -113,5 +113,5 @@ bool PinCurrentThreadByMask(int ncores, const CpuSet& procMask) {
|
||||
bool PinCurrentThreadToSocket(int socket) {
|
||||
return false;
|
||||
}
|
||||
#endif // !(defined(__APPLE__) || defined(_WIN32))
|
||||
#endif // !(defined(__APPLE__) || defined(__EMSCRIPTEN__) || defined(_WIN32))
|
||||
} // namespace InferenceEngine
|
||||
|
@ -9,12 +9,12 @@
|
||||
|
||||
#include "ie_api.h"
|
||||
|
||||
#if !(defined(__APPLE__) || defined(_WIN32))
|
||||
#if !(defined(__APPLE__) || defined(__EMSCRIPTEN__) || defined(_WIN32))
|
||||
# include <sched.h>
|
||||
#endif
|
||||
|
||||
namespace InferenceEngine {
|
||||
#if (defined(__APPLE__) || defined(_WIN32))
|
||||
#if (defined(__APPLE__) || defined(__EMSCRIPTEN__) || defined(_WIN32))
|
||||
using cpu_set_t = void;
|
||||
#endif // (defined(__APPLE__) || defined(_WIN32))
|
||||
|
||||
|
@ -6,6 +6,7 @@
|
||||
|
||||
#include <algorithm>
|
||||
#include <cstdlib>
|
||||
#include <limits>
|
||||
|
||||
namespace ov {
|
||||
namespace intel_gna {
|
||||
|
@ -31,6 +31,12 @@ if(ENABLE_ONEDNN_FOR_GPU)
|
||||
ie_add_compiler_flags(-Wno-error=array-bounds -Wno-error=stringop-overflow= -Wno-error=unused-result)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
foreach(cmake_var IN ITEMS CMAKE_SYSTEM_NAME CMAKE_SYSTEM_VERSION
|
||||
CMAKE_SYSTEM_PROCESSOR CMAKE_TOOLCHAIN_FILE)
|
||||
list(APPEND cmake_extra_args "-D${cmake_var}=${${cmake_var}}")
|
||||
endforeach()
|
||||
|
||||
ExternalProject_Add(onednn_gpu_build
|
||||
SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/onednn_gpu"
|
||||
BINARY_DIR "${ONEDNN_BUILD_DIR}"
|
||||
@ -44,6 +50,7 @@ if(ENABLE_ONEDNN_FOR_GPU)
|
||||
"-DDNNL_ENABLE_PRIMITIVE:STRING=${ONEDNN_ENABLED_PRIMITIVES}"
|
||||
"-DDNNL_ENABLE_PRIMITIVE_GPU_ISA:STRING=${ONEDNN_ENABLED_ISA}"
|
||||
CMAKE_ARGS
|
||||
${cmake_extra_args}
|
||||
"-DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}"
|
||||
"-DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}"
|
||||
"-DCMAKE_CXX_COMPILER_LAUNCHER=${CMAKE_CXX_COMPILER_LAUNCHER}"
|
||||
|
@ -116,7 +116,7 @@ endif()
|
||||
# OpenCL compiler
|
||||
#
|
||||
|
||||
if(LINUX AND HOST_X86_64 AND OV_GLIBC_VERSION VERSION_GREATER_EQUAL 2.27)
|
||||
if(CMAKE_HOST_LINUX AND HOST_X86_64 AND OV_GLIBC_VERSION VERSION_GREATER_EQUAL 2.27)
|
||||
if(DEFINED ENV{THIRDPARTY_SERVER_PATH})
|
||||
set(IE_PATH_TO_DEPS "$ENV{THIRDPARTY_SERVER_PATH}")
|
||||
elseif(DEFINED THIRDPARTY_SERVER_PATH)
|
||||
|
3
thirdparty/CMakeLists.txt
vendored
3
thirdparty/CMakeLists.txt
vendored
@ -186,7 +186,8 @@ endif()
|
||||
#
|
||||
|
||||
if(ENABLE_SAMPLES OR ENABLE_COMPILE_TOOL OR ENABLE_TESTS)
|
||||
if(LINUX)
|
||||
# on Windows and macOS we don't use gflags, because will be dynamically linked
|
||||
if(CMAKE_HOST_LINUX AND LINUX)
|
||||
if(OV_OS_RHEL)
|
||||
set(gflag_component nothreads_shared)
|
||||
elseif(OV_OS_DEBIAN)
|
||||
|
Loading…
Reference in New Issue
Block a user