Commit 4c8bf31e authored by Attila Krasznahorkay's avatar Attila Krasznahorkay
Browse files

Merge branch '1.0.48-patches' into '1.0.48-patches'

Add Onnx

See merge request !858
parents b9f4815d 8d6339cd
# Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
#
# Configuration for building ONNX Runtime as part of the offline / analysis
# release.
#
# Set the name of the package:
atlas_subdir( onnxruntime )
# In release recompilation mode stop now:
if( ATLAS_RELEASE_MODE )
return()
endif()
# The source code of onnxruntime:
set( _source
"http://cern.ch/atlas-software-dist-eos/externals/onnxruntime/onnxruntime-v1.5.1.tar.bz2")
set( _md5 "bd17c0d085c13bab112e7d92c68b091f" )
# Temporary directory for the build results:
set( _buildDir
${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/onnxruntimeBuild )
# Extra arguments for the build configuration:
set( _extraArgs )
if( "${CMAKE_BUILD_TYPE}" STREQUAL "Release" OR
"${CMAKE_BUILD_TYPE}" STREQUAL "RelWithDebInfo" )
list( APPEND _extraArgs -DCMAKE_BUILD_TYPE:STRING=Release )
elseif( NOT "${CMAKE_BUILD_TYPE}" STREQUAL "" )
list( APPEND _extraArgs -DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE} )
endif()
if( NOT "${CMAKE_CXX_STANDARD}" STREQUAL "" )
list( APPEND _extraArgs -DCMAKE_CXX_STANDARD:STRING=${CMAKE_CXX_STANDARD} )
endif()
# Find all necessary externals.
if( ATLAS_BUILD_PYTHON )
set( Python_EXECUTABLE "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/python3" )
else()
find_package( Python COMPONENTS Interpreter )
endif()
find_package( ZLIB )
find_package( PNG )
# Build onnxruntime.
ExternalProject_Add( onnxruntime
PREFIX ${CMAKE_BINARY_DIR}
INSTALL_DIR ${CMAKE_BINARY_DIR}/${ATLAS_PLATFORM}
URL ${_source}
URL_MD5 ${_md5}
SOURCE_SUBDIR cmake
PATCH_COMMAND patch -p1 <
${CMAKE_CURRENT_SOURCE_DIR}/patches/onnxruntime-1.5.1-cmake.patch
CMAKE_CACHE_ARGS -DCMAKE_INSTALL_PREFIX:PATH=${_buildDir}
-DCMAKE_INSTALL_LIBDIR:PATH=${CMAKE_INSTALL_LIBDIR}
-Donnxruntime_BUILD_SHARED_LIB:BOOL=ON
-Donnxruntime_BUILD_UNIT_TESTS:BOOL=OFF
-DPYTHON_EXECUTABLE:FILEPATH=${Python_EXECUTABLE}
-DZLIB_INCLUDE_DIR:PATH=${ZLIB_INCLUDE_DIR}
-DZLIB_LIBRARY:FILEPATH=${ZLIB_LIBRARY}
-DPNG_PNG_INCLUDE_DIR:PATH=${PNG_PNG_INCLUDE_DIR}
-DPNG_LIBRARY:FILEPATH=${PNG_LIBRARY}
${_extraArgs}
LOG_CONFIGURE 1 )
ExternalProject_Add_Step( onnxruntime forcedownload
COMMAND ${CMAKE_COMMAND} -E echo
"Forcing the re-download of onnxruntime (2020.04.20.)"
DEPENDERS download )
ExternalProject_Add_Step( onnxruntime purgeBuild
COMMAND ${CMAKE_COMMAND} -E remove_directory "<BINARY_DIR>"
COMMAND ${CMAKE_COMMAND} -E make_directory "<BINARY_DIR>"
COMMAND ${CMAKE_COMMAND} -E remove_directory "${_buildDir}"
COMMENT "Removing previous build results for onnxruntime."
DEPENDEES download
DEPENDERS patch )
ExternalProject_Add_Step( onnxruntime buildinstall
COMMAND ${CMAKE_COMMAND} -E copy_directory ${_buildDir}/ <INSTALL_DIR>
COMMENT "Installing onnxruntime into the build area"
DEPENDEES install )
add_dependencies( Package_onnxruntime onnxruntime )
if( ATLAS_BUILD_PYTHON )
add_dependencies( onnxruntime Python )
endif()
# Install onnxruntime.
install( DIRECTORY ${_buildDir}/
DESTINATION . USE_SOURCE_PERMISSIONS OPTIONAL )
install( FILES cmake/Findonnxruntime.cmake
DESTINATION ${CMAKE_INSTALL_CMAKEDIR}/modules )
ONNX Runtime
============
This package builds the
[ONNX Runtime](https://microsoft.github.io/onnxruntime/) library using
the [source code from GitHub](https://github.com/microsoft/onnxruntime).
Note that the build makes use of a large number of "externals", which are
packaged together with the ONNX Runtime sources. This should not cause an
issue during linking however, as `libonnxruntime.so` is **very** explicit
about which symbols it would export. So the fact that internally it uses
a different version of let's say [Eigen](http://eigen.tuxfamily.org) than
what the rest of the ATLAS code uses, should not be a problem.
# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
#
# Locate the onnxruntime external package.
#
# Defines:
# ONNXRUNTIME_FOUND
# ONNXRUNTIME_INCLUDE_DIR
# ONNXRUNTIME_INCLUDE_DIRS
# ONNXRUNTIME_LIBRARIES
# ONNXRUNTIME_LIBRARY_DIRS
#
# Include the helper code:
include( AtlasInternals )
# Declare the module:
atlas_external_module( NAME onnxruntime
INCLUDE_SUFFIXES include include/onnxruntime
INCLUDE_NAMES core/common/version.h
core/session/onnxruntime_c_api.h
LIBRARY_SUFFIXES lib lib32 lib64
COMPULSORY_COMPONENTS onnxruntime )
# Handle the standard find_package arguments:
include( FindPackageHandleStandardArgs )
find_package_handle_standard_args( onnxruntime DEFAULT_MSG ONNXRUNTIME_INCLUDE_DIR
ONNXRUNTIME_LIBRARIES )
mark_as_advanced( ONNXRUNTIME_FOUND ONNXRUNTIME_INCLUDE_DIR ONNXRUNTIME_INCLUDE_DIRS
ONNXRUNTIME_LIBRARIES ONNXRUNTIME_LIBRARY_DIRS )
diff --git a/cmake/onnxruntime_automl_featurizers.cmake b/cmake/onnxruntime_automl_featurizers.cmake
index 4ea1ff19..bee5f5ec 100644
--- a/cmake/onnxruntime_automl_featurizers.cmake
+++ b/cmake/onnxruntime_automl_featurizers.cmake
@@ -16,6 +16,7 @@ target_include_directories(automl_featurizers PRIVATE ${ONNXRUNTIME_ROOT} PUBLIC
set_target_properties(automl_featurizers PROPERTIES FOLDER "AutoMLFeaturizers")
+if(onnxruntime_BUILD_UNIT_TESTS)
# Individual featurizers unit tests added at bulk
file(GLOB automl_featurizers_tests_srcs
"${ONNXRUNTIME_ROOT}/core/automl/featurizers/src/FeaturizerPrep/Featurizers/UnitTests/*.cpp"
@@ -38,6 +39,7 @@ add_test(NAME automl_featurizers_unittests
COMMAND automl_featurizers_unittests
WORKING_DIRECTORY $<TARGET_FILE_DIR:automl_featurizers_unittests>
)
+endif()
if (WIN32)
diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt
index d909400..210cf17 100644
--- a/cmake/CMakeLists.txt
+++ b/cmake/CMakeLists.txt
@@ -272,17 +272,6 @@ if(CMAKE_CROSSCOMPILING)
message("Doing crosscompiling")
endif()
-#Need python to generate def file
-if(onnxruntime_BUILD_SHARED_LIB OR onnxruntime_ENABLE_PYTHON)
- if(onnxruntime_ENABLE_PYTHON)
- find_package(PythonInterp 3.5 REQUIRED)
- find_package(PythonLibs 3.5 REQUIRED)
- else()
- find_package(PythonInterp 3.4 REQUIRED)
- find_package(PythonLibs 3.4 REQUIRED)
- endif()
-endif()
-
#target begins from here
if(onnxruntime_BUILD_BENCHMARKS)
diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt
index c49ec84..3bca399 100644
--- a/cmake/CMakeLists.txt
+++ b/cmake/CMakeLists.txt
@@ -468,16 +468,6 @@ if(CMAKE_CROSSCOMPILING)
message("Doing crosscompiling")
endif()
-#Need python to generate def file
-if(onnxruntime_BUILD_SHARED_LIB OR onnxruntime_ENABLE_PYTHON)
- if(onnxruntime_ENABLE_PYTHON)
- find_package(PythonInterp 3.5 REQUIRED)
- find_package(PythonLibs 3.5 REQUIRED)
- else()
- find_package(PythonInterp 3.4 REQUIRED)
- endif()
-endif()
-
#target begins from here
if(onnxruntime_BUILD_BENCHMARKS)
# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
# Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
#
# List of packages to build as part of AthenaExternals.
#
......@@ -16,6 +16,7 @@
+ External/Lapack
+ External/lwtnn
+ External/MKL
+ External/onnxruntime
+ External/Simage
+ External/dSFMT
+ External/yampl
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment