From 94bfc6633f3dd9bb589c67bc2a6b181602356a36 Mon Sep 17 00:00:00 2001 From: Giulio Eulisse <10544+ktf@users.noreply.github.com> Date: Tue, 25 Mar 2025 13:48:18 +0100 Subject: [PATCH 01/11] Modernize protobuf recipe --- abseil.sh | 2 ++ gsl.sh | 2 +- protobuf.sh | 17 ++++++++++++++--- 3 files changed, 17 insertions(+), 4 deletions(-) diff --git a/abseil.sh b/abseil.sh index be0da569f5..c25356764a 100644 --- a/abseil.sh +++ b/abseil.sh @@ -7,6 +7,7 @@ build_requires: - CMake - ninja - alibuild-recipe-tools + - ninja source: https://github.com/abseil/abseil-cpp prefer_system: "osx" prefer_system_check: | @@ -19,6 +20,7 @@ incremental_recipe: | mkdir -p $INSTALLROOT cmake $SOURCEDIR \ + -G Ninja \ ${CXXSTD:+-DCMAKE_CXX_STANDARD=$CXXSTD} \ -DCMAKE_INSTALL_LIBDIR=lib \ -DBUILD_TESTING=OFF \ diff --git a/gsl.sh b/gsl.sh index 82afac901c..3c0291d187 100644 --- a/gsl.sh +++ b/gsl.sh @@ -9,7 +9,7 @@ build_requires: - alibuild-recipe-tools prefer_system: (?!slc5) prefer_system_check: | - printf "#include \"gsl/gsl_version.h\"\n#define GSL_V GSL_MAJOR_VERSION * 100 + GSL_MINOR_VERSION\n# if (GSL_V < 116)\n#error \"Cannot use system's gsl. Notice we only support versions from 1.16 (included)\"\n#endif\nint main(){}" | c++ -I$(brew --prefix gsl)/include -xc++ - -o /dev/null + printf "#include \"gsl/gsl_version.h\"\n#define GSL_V GSL_MAJOR_VERSION * 100 + GSL_MINOR_VERSION\n# if (GSL_V < 116)\n#error \"Cannot use system's gsl. Notice we only support versions from 1.16 (included)\"\n#endif\nint main(){}" | cc -xc - -I$(brew --prefix gsl)/include -c -o /dev/null --- #!/bin/bash -e rsync -a --exclude '**/.git' --delete $SOURCEDIR/ $BUILDDIR diff --git a/protobuf.sh b/protobuf.sh index 7597710a5b..5ad3ec541a 100644 --- a/protobuf.sh +++ b/protobuf.sh @@ -5,20 +5,31 @@ build_requires: - CMake - "GCC-Toolchain:(?!osx)" - alibuild-recipe-tools + - abseil + - ninja prepend_path: # The protobuf headers must match the protoc binary version, so prevent the # use of system headers by putting ours first in the path. PKG_CONFIG_PATH: "$PROTOBUF_ROOT/lib/pkgconfig" --- #!/bin/bash -e -cmake "$SOURCEDIR/cmake" \ +if [ -f $SOURCEDIR/cmake/CMakeLists.txt ]; then + ALIBUILD_CMAKE_SOURCE_DIR=$SOURCEDIR/cmake +else + ALIBUILD_CMAKE_SOURCE_DIR=$SOURCEDIR +fi +cmake -S "$ALIBUILD_CMAKE_SOURCE_DIR" \ -DCMAKE_INSTALL_PREFIX="$INSTALLROOT" \ -Dprotobuf_BUILD_TESTS=NO \ -Dprotobuf_MODULE_COMPATIBLE=YES \ -Dprotobuf_BUILD_SHARED_LIBS=OFF \ + -Dprotobuf_ABSL_PROVIDER=package \ + -DABSL_ROOT_DIR=$ABSEIL_ROOT \ -DCMAKE_INSTALL_LIBDIR=lib -make ${JOBS:+-j $JOBS} -make install + +cmake --build . -- ${JOBS:+-j$JOBS} install +sed -i.bak 's|absl/log/absl_log.h|absl/log/vlog_is_on.h|' $INSTALLROOT/include/google/protobuf/io/coded_stream.h +rm $INSTALLROOT/include/google/protobuf/io/coded_stream.h.bak mkdir -p "$INSTALLROOT/etc/modulefiles" alibuild-generate-module --bin --lib > "$INSTALLROOT/etc/modulefiles/$PKGNAME" From 7b173784e2f3037002ca3ab72e6e03b5548fcae0 Mon Sep 17 00:00:00 2001 From: Giulio Eulisse <10544+ktf@users.noreply.github.com> Date: Tue, 25 Mar 2025 13:48:18 +0100 Subject: [PATCH 02/11] Disable a bunch of stuff in grpc --- grpc.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/grpc.sh b/grpc.sh index 7dae542c9b..3359e468b5 100644 --- a/grpc.sh +++ b/grpc.sh @@ -48,7 +48,8 @@ cmake $SOURCEDIR \ -DgRPC_BENCHMARK_PROVIDER=package \ -DgRPC_BUILD_GRPC_CSHARP_PLUGIN=OFF \ -DgRPC_BUILD_GRPC_OBJECTIVE_C_PLUGIN=OFF \ - -DgRPC_BUILD_GRPC_PHP_PLUGIN=OFF \ + -DgRPC_BUILD_GRPC_PHP_PLUGIN=OFF \ + -DgRPC_BUILD_GRPC_NODE_PLUGIN=OFF \ -DgRPC_BUILD_GRPC_CPP_PLUGIN=ON \ -DgRPC_BUILD_CSHARP_EXT=OFF \ -DgRPC_RE2_PROVIDER=package \ From 389361328e98817768c810519078981da0a1398a Mon Sep 17 00:00:00 2001 From: Giulio Eulisse <10544+ktf@users.noreply.github.com> Date: Tue, 25 Mar 2025 13:48:18 +0100 Subject: [PATCH 03/11] Bump abseil to latest version --- abseil.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/abseil.sh b/abseil.sh index c25356764a..8dab726983 100644 --- a/abseil.sh +++ b/abseil.sh @@ -1,6 +1,6 @@ package: abseil version: "%(tag_basename)s" -tag: "20220623.1" +tag: "20240722.0" requires: - "GCC-Toolchain:(?!osx)" build_requires: @@ -11,7 +11,7 @@ build_requires: source: https://github.com/abseil/abseil-cpp prefer_system: "osx" prefer_system_check: | - printf '#include ' | c++ -std=c++17 -I"$(brew --prefix abseil)/include" -c -xc++ - >/dev/null + printf '#include ' | c++ -std=c++20 -I"$(brew --prefix abseil)/include" -c -xc++ - >/dev/null incremental_recipe: | cmake --build . -- ${JOBS:+-j$JOBS} install mkdir -p $INSTALLROOT/etc/modulefiles && rsync -a --delete etc/modulefiles/ $INSTALLROOT/etc/modulefiles From d72a7d6a83b2c659280b3965876145b9f05c83a3 Mon Sep 17 00:00:00 2001 From: Giulio Eulisse <10544+ktf@users.noreply.github.com> Date: Tue, 25 Mar 2025 13:48:18 +0100 Subject: [PATCH 04/11] Bump protobuf to latest version --- protobuf.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/protobuf.sh b/protobuf.sh index 5ad3ec541a..1b19a1e383 100644 --- a/protobuf.sh +++ b/protobuf.sh @@ -1,5 +1,5 @@ package: protobuf -version: v21.9 +version: v29.3 source: https://github.com/protocolbuffers/protobuf build_requires: - CMake From ecb78cc4a83738afbd6c776ab75a3c59cf183bfb Mon Sep 17 00:00:00 2001 From: Giulio Eulisse <10544+ktf@users.noreply.github.com> Date: Wed, 26 Mar 2025 09:04:22 +0100 Subject: [PATCH 05/11] Bump gRPC to the latest version --- grpc.sh | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/grpc.sh b/grpc.sh index 3359e468b5..8ab8f36e07 100644 --- a/grpc.sh +++ b/grpc.sh @@ -1,6 +1,6 @@ package: grpc version: "%(tag_basename)s" -tag: v1.50.1 +tag: v1.71.0 requires: - protobuf - c-ares @@ -15,6 +15,11 @@ source: https://github.com/grpc/grpc incremental_recipe: | cmake --build . -- ${JOBS:+-j$JOBS} install mkdir -p $INSTALLROOT/etc/modulefiles && rsync -a --delete etc/modulefiles/ $INSTALLROOT/etc/modulefiles +prefer_system: .* +prefer_system_check: | + printf "#include \"grpcpp/version_info.h\"\n" | cc -I$(brew --prefix grpc)/include -xc++ -std=c++20 - -c -o /dev/null +prepend_path: + PKG_CONFIG_PATH: "$GRPC_ROOT/lib/pkgconfig" --- #!/bin/bash -e SONAME=so @@ -23,9 +28,12 @@ case $ARCHITECTURE in SONAME=dylib [[ ! $OPENSSL_ROOT ]] && OPENSSL_ROOT=$(brew --prefix openssl@3) [[ ! $PROTOBUF_ROOT ]] && PROTOBUF_ROOT=$(brew --prefix protobuf) + [[ ! $ABSEIL_ROOT ]] && ABSEIL_ROOT=$(brew --prefix abseil) # to avoid issues with rpath on mac extra_cmake_variables="-DCMAKE_INSTALL_RPATH=$INSTALLROOT/lib \ -DCMAKE_INSTALL_RPATH_USE_LINK_PATH=ON \ + -DCMAKE_SHARED_LINKER_FLAGS='-Wl,-undefined,dynamic_lookup' \ + -DCMAKE_EXE_LINKER_FLAGS='-Wl,-undefined,dynamic_lookup' \ " ;; esac @@ -33,11 +41,14 @@ esac echo "OPENSSL_ROOT : $OPENSSL_ROOT" echo "OPENSSL_REVISION: $OPENSSL_REVISION" + + + cmake $SOURCEDIR \ -G Ninja \ ${CXXSTD:+-DCMAKE_CXX_STANDARD=$CXXSTD} \ -DCMAKE_INSTALL_PREFIX=$INSTALLROOT \ - -DgRPC_PROTOBUF_PACKAGE_TYPE="CONFIG" \ + -DCMAKE_PREFIX_PATH=$ABSEIL_ROOT/cmake:$PROTOBUF_ROOT/cmake \ -DgRPC_BUILD_TESTS=OFF \ -DBUILD_SHARED_LIBS=ON \ -DgRPC_SSL_PROVIDER=package \ From d734dee74d308cc0c05ed18d53544f2495c69bbd Mon Sep 17 00:00:00 2001 From: Giulio Eulisse <10544+ktf@users.noreply.github.com> Date: Wed, 26 Mar 2025 09:04:22 +0100 Subject: [PATCH 06/11] Fix Eigen3 version to work with latest ONNXRuntime --- eigen3.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/eigen3.sh b/eigen3.sh index 813d4beefa..efc41ac29b 100644 --- a/eigen3.sh +++ b/eigen3.sh @@ -1,5 +1,7 @@ package: Eigen3 -version: 3.4.0 +version: 3.4.0-onnx1 +# Needed to compile ONNXRuntime correctly +tag: e7248b26a1ed53fa030c5c459f7ea095dfd276ac build_requires: - "GCC-Toolchain:(?!osx)" - CMake From 4ec2467706dabc073340d914e02752cd7e72184c Mon Sep 17 00:00:00 2001 From: Giulio Eulisse <10544+ktf@users.noreply.github.com> Date: Wed, 26 Mar 2025 09:04:22 +0100 Subject: [PATCH 07/11] Support pkg-config for a few mesos dependencies Simplifies building with them. --- abseil.sh | 2 ++ c-ares.sh | 2 ++ re2.sh | 4 +++- 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/abseil.sh b/abseil.sh index 8dab726983..ace61e44de 100644 --- a/abseil.sh +++ b/abseil.sh @@ -15,6 +15,8 @@ prefer_system_check: | incremental_recipe: | cmake --build . -- ${JOBS:+-j$JOBS} install mkdir -p $INSTALLROOT/etc/modulefiles && rsync -a --delete etc/modulefiles/ $INSTALLROOT/etc/modulefiles +prepend_path: + PKG_CONFIG_PATH: "$ABSEIL_ROOT/lib/pkgconfig" --- #!/bin/bash -e diff --git a/c-ares.sh b/c-ares.sh index 2ed538d557..861973c437 100644 --- a/c-ares.sh +++ b/c-ares.sh @@ -8,6 +8,8 @@ source: https://github.com/c-ares/c-ares incremental_recipe: | make ${JOBS:+-j$JOBS} install mkdir -p $INSTALLROOT/etc/modulefiles && rsync -a --delete etc/modulefiles/ $INSTALLROOT/etc/modulefiles +prepend_path: + PKG_CONFIG_PATH: "$C_ARES_ROOT/lib/pkgconfig" --- #!/bin/bash -e diff --git a/re2.sh b/re2.sh index bdfdc150c4..9d2eee8b60 100644 --- a/re2.sh +++ b/re2.sh @@ -1,5 +1,5 @@ package: re2 -version: "2019-09-01" +version: "2024-07-02" source: https://github.com/google/re2 build_requires: - "GCC-Toolchain:(?!osx)" @@ -10,6 +10,8 @@ build_requires: prefer_system: .* prefer_system_check: | printf "#include \"re2/re2.h\"\n" | cc -I$(brew --prefix re2)/include -I$(brew --prefix abseil)/include -xc++ -std=c++20 - -c -o /dev/null +prepend_path: + PKG_CONFIG_PATH: "$RE2_ROOT/lib/pkgconfig" --- #!/bin/sh cmake $SOURCEDIR \ From d8e985ad9020127796a4a5c63e9d954fcfac20ce Mon Sep 17 00:00:00 2001 From: Giulio Eulisse <10544+ktf@users.noreply.github.com> Date: Wed, 26 Mar 2025 10:55:48 +0100 Subject: [PATCH 08/11] Make mesos compile with the latest protobuf / grpc --- mesos.sh | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/mesos.sh b/mesos.sh index 8a1fd2e305..9a2ac5aa42 100644 --- a/mesos.sh +++ b/mesos.sh @@ -1,6 +1,6 @@ package: mesos version: v1.11.0 -tag: 1.11.0-alice1 +tag: 1.11.0-alice2 source: https://github.com/AliceO2Group/mesos.git requires: - zlib @@ -11,6 +11,7 @@ requires: - system-apr-util - system-cyrus-sasl - system-subversion + - boost # We specifically CANNOT build against our own curl and OpenSSL on slc8, as # those conflict with system-cyrus-sasl. # - curl @@ -24,7 +25,8 @@ prepend_path: PATH: "$MESOS_ROOT/sbin" PYTHONPATH: $MESOS_ROOT/lib/python2.7/site-packages --- -export CXXFLAGS="-fPIC -O2 -std=c++14 -w" +export CXXFLAGS="-fPIC -O2 -std=c++20 -w" +export LIBS="-L${ABSEIL_ROOT}/lib -L${C_ARES_ROOT}/lib -L${RE2_ROOT}/lib -L${GRPC_ROOT}/lib -L${PROTOBUF_ROOT}/lib $(pkg-config --libs-only-l absl_log absl_cord absl_log_internal_check_op absl_raw_hash_set absl_status absl_flags protobuf libcares upb grpc utf8_range) -laddress_sorting" # Needed for mesos grpc configure checks export CPPFLAGS="-I${ABSEIL_ROOT}/include" export CFLAGS="-I${ABSEIL_ROOT}/include" @@ -33,10 +35,13 @@ rsync -av --delete --exclude="**/.git" $SOURCEDIR/ . ./bootstrap mkdir build cd build +sed -i.bak -e's/c++11/c++20/' ../configure ../configure --prefix="$INSTALLROOT" \ --disable-python \ --disable-java \ + --with-boost=${BOOST_ROOT} \ --with-protobuf=${PROTOBUF_ROOT} \ + --with-re2=${RE2_ROOT} \ --with-grpc=${GRPC_ROOT} \ --with-glog=${GLOG_ROOT} \ --with-rapidjson=${RAPIDJSON_ROOT} From fb1b3d60b791c2c1166004d7e9c3379291f447a0 Mon Sep 17 00:00:00 2001 From: Giulio Eulisse <10544+ktf@users.noreply.github.com> Date: Thu, 27 Mar 2025 14:24:36 +0100 Subject: [PATCH 09/11] Fix datadistribution --- datadistribution.sh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/datadistribution.sh b/datadistribution.sh index 20e54e35ce..b8139c12fb 100644 --- a/datadistribution.sh +++ b/datadistribution.sh @@ -1,6 +1,7 @@ package: DataDistribution version: "%(tag_basename)s" -tag: v1.6.6 +tag: v1.6.7 +source: https://github.com/AliceO2Group/DataDistribution requires: - "GCC-Toolchain:(?!osx)" - boost @@ -15,7 +16,6 @@ requires: - fmt build_requires: - CMake -source: https://github.com/AliceO2Group/DataDistribution incremental_recipe: | # reduce number of compile slots if invoked by Jenkins if [ ! "X$JENKINS_HOME" = X ]; then @@ -38,6 +38,7 @@ esac cmake $SOURCEDIR \ ${CMAKE_GENERATOR:+-G "$CMAKE_GENERATOR"} \ ${CMAKE_BUILD_TYPE:+-DCMAKE_BUILD_TYPE=$CMAKE_BUILD_TYPE} \ + -DCMAKE_CXX_STANDARD=20 \ -DCMAKE_INSTALL_PREFIX=$INSTALLROOT \ ${BOOST_ROOT:+-DBoost_ROOT=$BOOST_ROOT} \ ${FAIRLOGGER_ROOT:+-DFairLogger_ROOT=$FAIRLOGGER_ROOT} \ @@ -45,6 +46,7 @@ cmake $SOURCEDIR \ ${FAIRMQ_ROOT:+-DFairMQ_ROOT=$FAIRMQ_ROOT} \ ${PPCONSUL_ROOT:+-Dppconsul_DIR=${PPCONSUL_ROOT}/cmake} \ ${O2_ROOT:+-DO2_ROOT=$O2_ROOT} \ + -Dprotobuf_MODULE_COMPATIBLE=ON \ ${MONITORING_ROOT:+-DMonitoring_ROOT=$MONITORING_ROOT} \ ${PROTOBUF_ROOT:+-DProtobuf_ROOT=$PROTOBUF_ROOT} \ ${UCX_ROOT:+-DUCX_DIR=${UCX_ROOT}} \ From 9022cf7cf0a4aaa0c903f9b615ec0335af71f80f Mon Sep 17 00:00:00 2001 From: Giulio Eulisse <10544+ktf@users.noreply.github.com> Date: Thu, 27 Mar 2025 14:24:36 +0100 Subject: [PATCH 10/11] Bump ONNXRuntime --- o2.sh | 12 +++- onnx.sh | 1 + onnxruntime.sh | 164 ++++++++++++++++++++++++++++++++++++++++++------- 3 files changed, 154 insertions(+), 23 deletions(-) diff --git a/o2.sh b/o2.sh index 1cb62fcd76..a53cfc24eb 100644 --- a/o2.sh +++ b/o2.sh @@ -139,6 +139,12 @@ valid_defaults: #!/bin/sh export ROOTSYS=$ROOT_ROOT +if [[ -n $ONNXRUNTIME_REVISION ]]; then + source $ONNXRUNTIME_ROOT/etc/ort-init.sh + echo "ORT_ROCM_BUILD: $ORT_ROCM_BUILD" + echo "ORT_CUDA_BUILD: $ORT_CUDA_BUILD" +fi + # Making sure people do not have SIMPATH set when they build fairroot. # Unfortunately SIMPATH seems to be hardcoded in a bunch of places in # fairroot, so this really should be cleaned up in FairRoot itself for @@ -206,7 +212,11 @@ cmake $SOURCEDIR -DCMAKE_INSTALL_PREFIX=$INSTALLROOT ${ARROW_ROOT:+-DArrow_DIR=$ARROW_ROOT/lib/cmake/Arrow} \ ${CLANG_REVISION:+-DCLANG_EXECUTABLE="$CLANG_ROOT/bin-safe/clang"} \ ${CLANG_REVISION:+-DLLVM_LINK_EXECUTABLE="$CLANG_ROOT/bin/llvm-link"} \ - ${ITSRESPONSE_ROOT:+-DITSRESPONSE=${ITSRESPONSE_ROOT}} + ${ITSRESPONSE_ROOT:+-DITSRESPONSE=${ITSRESPONSE_ROOT}} \ + ${ORT_ROCM_BUILD:+-DORT_ROCM_BUILD=${ORT_ROCM_BUILD}} \ + ${ORT_CUDA_BUILD:+-DORT_CUDA_BUILD=${ORT_CUDA_BUILD}} \ + ${ORT_MIGRAPHX_BUILD:+-DORT_MIGRAPHX_BUILD=${ORT_MIGRAPHX_BUILD}} \ + ${ORT_TENSORRT_BUILD:+-DORT_TENSORRT_BUILD=${ORT_TENSORRT_BUILD}} # LLVM_ROOT is required for Gandiva cmake --build . -- ${JOBS+-j $JOBS} install diff --git a/onnx.sh b/onnx.sh index e5de3d6074..64338a9264 100644 --- a/onnx.sh +++ b/onnx.sh @@ -9,6 +9,7 @@ requires: build_requires: - CMake - alibuild-recipe-tools + - Python - ninja --- #!/bin/bash -e diff --git a/onnxruntime.sh b/onnxruntime.sh index 8f823e3cd4..e90dac6292 100644 --- a/onnxruntime.sh +++ b/onnxruntime.sh @@ -1,12 +1,20 @@ package: ONNXRuntime version: "%(tag_basename)s" -tag: v1.18.1 +tag: v1.21.0 source: https://github.com/microsoft/onnxruntime requires: - protobuf - re2 - boost - abseil + - date + - nlohmann_json + - pytorch_cpuinfo + - ms_gsl + - safe_int + - flatbuffers + - Eigen3 + - onnx build_requires: - CMake - alibuild-recipe-tools @@ -18,24 +26,138 @@ prepend_path: mkdir -p $INSTALLROOT -cmake "$SOURCEDIR/cmake" \ - -DCMAKE_INSTALL_PREFIX=$INSTALLROOT \ - -DCMAKE_BUILD_TYPE=Release \ - -DCMAKE_INSTALL_LIBDIR=lib \ - -DPYTHON_EXECUTABLE=$(python3 -c "import sys; print(sys.executable)") \ - -Donnxruntime_BUILD_UNIT_TESTS=OFF \ - -Donnxruntime_PREFER_SYSTEM_LIB=ON \ - -Donnxruntime_BUILD_SHARED_LIB=ON \ - -DProtobuf_USE_STATIC_LIBS=ON \ - ${PROTOBUF_ROOT:+-DProtobuf_LIBRARY=$PROTOBUF_ROOT/lib/libprotobuf.a} \ - ${PROTOBUF_ROOT:+-DProtobuf_LITE_LIBRARY=$PROTOBUF_ROOT/lib/libprotobuf-lite.a} \ - ${PROTOBUF_ROOT:+-DProtobuf_PROTOC_LIBRARY=$PROTOBUF_ROOT/lib/libprotoc.a} \ - ${PROTOBUF_ROOT:+-DProtobuf_INCLUDE_DIR=$PROTOBUF_ROOT/include} \ - ${PROTOBUF_ROOT:+-DProtobuf_PROTOC_EXECUTABLE=$PROTOBUF_ROOT/bin/protoc} \ - ${RE2_ROOT:+-DRE2_INCLUDE_DIR=${RE2_ROOT}/include} \ - ${BOOST_ROOT:+-DBOOST_INCLUDE_DIR=${BOOST_ROOT}/include} \ - -DCMAKE_CXX_FLAGS="$CXXFLAGS -Wno-unknown-warning -Wno-unknown-warning-option -Wno-error=unused-but-set-variable -Wno-error=deprecated -Wno-error=maybe-uninitialized -Wno-error=template-id-cdtor" \ - -DCMAKE_C_FLAGS="$CFLAGS -Wno-unknown-warning -Wno-unknown-warning-option -Wno-error=unused-but-set-variable -Wno-error=deprecated -Wno-error=maybe-uninitialized -Wno-error=template-id-cdtor" +# Check ROCm build conditions +if [[ -f /etc/redhat-release ]]; then + export ALMA_LINUX_MAJOR_VERSION=$(awk '{print $3}' /etc/redhat-release | cut -d. -f1) +fi +if [[ "$ALIBUILD_O2_FORCE_GPU" -eq 1 ]] || [[ "$ALIBUILD_ENABLE_HIP" -eq 1 ]] || \ + ( ( [[ -z "$DISABLE_GPU" ]] || [[ "$DISABLE_GPU" -eq 0 ]] ) && \ + ( command -v /opt/rocm/bin/rocminfo >/dev/null 2>&1 ) && \ + [[ -d /opt/rocm/include/hiprand ]] && \ + [[ -d /opt/rocm/include/hipblas ]] && \ + [[ -d /opt/rocm/include/hipsparse ]] && \ + [[ -d /opt/rocm/include/hipfft ]] && \ + [[ -d /opt/rocm/include/rocblas ]] && \ + [[ -d /opt/rocm/include/rocrand ]] && \ + [[ -d /opt/rocm/include/miopen ]] && \ + [[ -d /opt/rocm/include/rccl ]] && \ + [[ -d /opt/rocm/lib/hipblaslt ]] && \ + [[ -z "$ORT_ROCM_BUILD" ]] ) && \ + ([[ -z "$ALMA_LINUX_MAJOR_VERSION" ]] || [[ "$ALMA_LINUX_MAJOR_VERSION" -eq 9 ]]); then + export ORT_ROCM_BUILD="1" + : ${ALIBUILD_O2_OVERRIDE_HIP_ARCHS:="gfx906,gfx908"} + export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/rocm/lib +else + export ORT_ROCM_BUILD="0" +fi + +# Check CUDA build conditions +if ( [[ "$ALIBUILD_O2_FORCE_GPU" -eq 1 ]] || [[ "$ALIBUILD_ENABLE_CUDA" -eq 1 ]] || \ + ( ( [[ -z "$DISABLE_GPU" ]] || [[ "$DISABLE_GPU" -eq 0 ]] ) && \ + ( command -v nvcc >/dev/null 2>&1 ) && \ + [[ -f /usr/include/cudnn.h ]] && \ + [[ -z "$ORT_CUDA_BUILD" ]] ) ) && \ + [[ "$ORT_ROCM_BUILD" -eq 0 ]] && \ + [[ -z "$ALMA_LINUX_MAJOR_VERSION" ]]; then + export ORT_CUDA_BUILD="1" + : ${ALIBUILD_O2_OVERRIDE_CUDA_ARCHS:="sm_86"} +else + export ORT_CUDA_BUILD="OFF" +fi + +# Optional builds +### MIGraphX +if ( [[ "$ORT_ROCM_BUILD" -eq 1 ]] && [[ $(find /opt/rocm* -name "libmigraphx*" -print -quit | wc -l 2>&1) -eq 1 ]] ) && \ + [[ -z "$ORT_MIGRAPHX_BUILD" ]]; then + export ORT_MIGRAPHX_BUILD="1" +elif [[ -z "$ORT_MIGRAPHX_BUILD" ]]; then + export ORT_MIGRAPHX_BUILD="0" +fi +### TensorRT +if ( [[ "$ORT_CUDA_BUILD" -eq 1 ]] && [[ $(find /usr -name "libnvinfer*" -print -quit | wc -l 2>&1) -eq 1 ]] ) && \ + [[ -z "$ORT_MIGRAPHX_BUILD" ]]; then + export ORT_TENSORRT_BUILD="1" +elif [[ -z "$ORT_TENSORRT_BUILD" ]]; then + export ORT_TENSORRT_BUILD="0" +fi + +mkdir -p $INSTALLROOT/etc +cat << EOF > $INSTALLROOT/etc/ort-init.sh +export ORT_ROCM_BUILD=$ORT_ROCM_BUILD +export ORT_CUDA_BUILD=$ORT_CUDA_BUILD +export ORT_MIGRAPHX_BUILD=$ORT_MIGRAPHX_BUILD +export ORT_TENSORRT_BUILD=$ORT_TENSORRT_BUILD +EOF + +python3 $SOURCEDIR/onnxruntime/core/flatbuffers/schema/compile_schema.py --flatc $(which flatc) +python3 $SOURCEDIR/onnxruntime/lora/adapter_format/compile_schema.py --flatc $(which flatc) + +# In order to work with new versions of eigen3, backport +sed -i.bak "s/eigen/Eigen3/g" $SOURCEDIR/cmake/external/eigen.cmake +python3 -c 'import sys; print(sys.executable)' +sed -i.bak "s/CMAKE_CXX_STANDARD 17/CMAKE_CXX_STANDARD 20/;s/-Wno-interference-size/-w/" $SOURCEDIR/cmake/CMakeLists.txt + +cmake "$SOURCEDIR/cmake" \ + --debug-find \ + -G Ninja \ + -DCMAKE_INSTALL_PREFIX="$INSTALLROOT" \ + -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_INSTALL_LIBDIR=lib \ + -DPython_EXECUTABLE="$(python3 -c 'import sys; print(sys.executable)')" \ + -DFETCHCONTENT_FULLY_DISCONNECTED=ON \ + -DFETCHCONTENT_QUIET=OFF \ + -DCMAKE_POLICY_DEFAULT_CMP0170=NEW \ + -DFETCHCONTENT_TRY_FIND_PACKAGE_MODE=ALWAYS \ + -Dsafeint_SOURCE_DIR=${SAFE_INT_ROOT}/include \ + -Deigen_SOURCE_PATH=${EIGEN3_ROOT}/include/eigen3 \ + -DGIT_EXECUTABLE=$(type git) \ + -Donnxruntime_BUILD_UNIT_TESTS=OFF \ + -Donnxruntime_USE_PREINSTALLED_EIGEN=ON \ + -Donnxruntime_BUILD_BENCHMARKS=OFF \ + -Donnxruntime_BUILD_CSHARP=OFF \ + -Donnxruntime_USE_OPENMP=OFF \ + -Donnxruntime_USE_TVM=OFF \ + -Donnxruntime_USE_LLVM=OFF \ + -Donnxruntime_ENABLE_DLPACK=OFF \ + -Donnxruntime_USE_NUPHAR=OFF \ + -Donnxruntime_ENABLE_MICROSOFT_INTERNAL=OFF \ + -Donnxruntime_USE_TENSORRT=OFF \ + -Donnxruntime_CROSS_COMPILING=OFF \ + -Donnxruntime_DISABLE_CONTRIB_OPS=OFF \ + -Donnxruntime_PREFER_SYSTEM_LIB=OFF \ + -Donnxruntime_BUILD_SHARED_LIB=ON \ + -Donnxruntime_USE_VCPKG=OFF \ + -DProtobuf_USE_STATIC_LIBS=ON \ + -Donnxruntime_ENABLE_TRAINING=OFF \ + -Donnxruntime_USE_FULL_PROTOBUF=ON \ + -Donnxruntime_ENABLE_PYTHON=OFF \ + -Donnxruntime_MINIMAL_BUILD=OFF \ + ${PROTOBUF_ROOT:+-DProtobuf_LIBRARY=$PROTOBUF_ROOT/lib/libprotobuf.a} \ + ${PROTOBUF_ROOT:+-DProtobuf_LITE_LIBRARY=$PROTOBUF_ROOT/lib/libprotobuf-lite.a} \ + ${PROTOBUF_ROOT:+-DProtobuf_PROTOC_LIBRARY=$PROTOBUF_ROOT/lib/libprotoc.a} \ + ${PROTOBUF_ROOT:+-DProtobuf_INCLUDE_DIR=$PROTOBUF_ROOT/include} \ + ${PROTOBUF_ROOT:+-DONNX_CUSTOM_PROTOC_EXECUTABLE=$PROTOBUF_ROOT/bin/protoc} \ + ${RE2_ROOT:+-DRE2_INCLUDE_DIR=${RE2_ROOT}/include} \ + ${BOOST_ROOT:+-DBOOST_INCLUDE_DIR=${BOOST_ROOT}/include} \ + -Donnxruntime_USE_MIGRAPHX=${ORT_MIGRAPHX_BUILD} \ + -Donnxruntime_USE_ROCM=${ORT_ROCM_BUILD} \ + -Donnxruntime_ROCM_HOME=/opt/rocm \ + -Donnxruntime_CUDA_HOME=/usr/local/cuda \ + -DCMAKE_HIP_COMPILER=/opt/rocm/llvm/bin/clang++ \ + -D__HIP_PLATFORM_AMD__=${ORT_ROCM_BUILD} \ + ${ALIBUILD_O2_OVERRIDE_HIP_ARCHS:+-DCMAKE_HIP_ARCHITECTURES=${ALIBUILD_O2_OVERRIDE_HIP_ARCHS}} \ + ${ALIBUILD_O2_OVERRIDE_CUDA_ARCH:+-CMAKE_CUDA_ARCHITECTURES=${ALIBUILD_O2_OVERRIDE_CUDA_ARCHS}} \ + -Donnxruntime_USE_COMPOSABLE_KERNEL=OFF \ + -Donnxruntime_USE_ROCBLAS_EXTENSION_API=${ORT_ROCM_BUILD} \ + -Donnxruntime_USE_COMPOSABLE_KERNEL_CK_TILE=ON \ + -Donnxruntime_DISABLE_RTTI=OFF \ + -DMSVC=OFF \ + -Donnxruntime_USE_CUDA=${ORT_CUDA_BUILD} \ + -Donnxruntime_USE_CUDA_NHWC_OPS=${ORT_CUDA_BUILD} \ + -Donnxruntime_CUDA_USE_TENSORRT=${ORT_TENSORRT_BUILD} \ + -Donnxruntime_FUZZ_ENABLED=OFF \ + -DCMAKE_CXX_FLAGS="${CXXFLAGS} -Wno-unknown-warning -Wno-unknown-warning-option -Wno-pass-failed -Wno-error=unused-but-set-variable -Wno-pass-failed=transform-warning -Wno-error=deprecated -Wno-error=maybe-uninitialized -Wno-error=deprecated-enum-enum-conversion -Wno-error -Wno-error=missing-requires -w" \ + -DCMAKE_C_FLAGS="$CFLAGS -Wno-unknown-warning -Wno-unknown-warning-option -Wno-pass-failed -Wno-error=unused-but-set-variable -Wno-pass-failed=transform-warning -Wno-error=deprecated -Wno-error=maybe-uninitialized -Wno-error=deprecated-enum-enum-conversion -Wno-error -Wno-error=missing-requires -w" cmake --build . -- ${JOBS:+-j$JOBS} install @@ -44,8 +166,6 @@ mkdir -p "$INSTALLROOT/etc/modulefiles" MODULEFILE="$INSTALLROOT/etc/modulefiles/$PKGNAME" alibuild-generate-module --lib > "$MODULEFILE" cat >> "$MODULEFILE" < Date: Thu, 27 Mar 2025 14:53:07 +0100 Subject: [PATCH 11/11] Disable migraphx again --- onnxruntime.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/onnxruntime.sh b/onnxruntime.sh index e90dac6292..249132408e 100644 --- a/onnxruntime.sh +++ b/onnxruntime.sh @@ -69,13 +69,13 @@ fi ### MIGraphX if ( [[ "$ORT_ROCM_BUILD" -eq 1 ]] && [[ $(find /opt/rocm* -name "libmigraphx*" -print -quit | wc -l 2>&1) -eq 1 ]] ) && \ [[ -z "$ORT_MIGRAPHX_BUILD" ]]; then - export ORT_MIGRAPHX_BUILD="1" + export ORT_MIGRAPHX_BUILD="0" # Disable for now, not working elif [[ -z "$ORT_MIGRAPHX_BUILD" ]]; then export ORT_MIGRAPHX_BUILD="0" fi ### TensorRT if ( [[ "$ORT_CUDA_BUILD" -eq 1 ]] && [[ $(find /usr -name "libnvinfer*" -print -quit | wc -l 2>&1) -eq 1 ]] ) && \ - [[ -z "$ORT_MIGRAPHX_BUILD" ]]; then + [[ -z "$ORT_TENSORRT_BUILD" ]]; then export ORT_TENSORRT_BUILD="1" elif [[ -z "$ORT_TENSORRT_BUILD" ]]; then export ORT_TENSORRT_BUILD="0"