1
1
package: ONNXRuntime
2
2
version: " %(tag_basename)s"
3
- tag: v1.18.1
3
+ tag: v1.20.0
4
4
source: https://github.com/microsoft/onnxruntime
5
5
requires:
6
6
- protobuf
@@ -18,24 +18,105 @@ prepend_path:
18
18
19
19
mkdir -p $INSTALLROOT
20
20
21
- cmake " $SOURCEDIR /cmake" \
22
- -DCMAKE_INSTALL_PREFIX=$INSTALLROOT \
23
- -DCMAKE_BUILD_TYPE=Release \
24
- -DCMAKE_INSTALL_LIBDIR=lib \
25
- -DPYTHON_EXECUTABLE=$( python3 -c " import sys; print(sys.executable)" ) \
26
- -Donnxruntime_BUILD_UNIT_TESTS=OFF \
27
- -Donnxruntime_PREFER_SYSTEM_LIB=ON \
28
- -Donnxruntime_BUILD_SHARED_LIB=ON \
29
- -DProtobuf_USE_STATIC_LIBS=ON \
30
- ${PROTOBUF_ROOT: +-DProtobuf_LIBRARY=$PROTOBUF_ROOT / lib/ libprotobuf.a} \
31
- ${PROTOBUF_ROOT: +-DProtobuf_LITE_LIBRARY=$PROTOBUF_ROOT / lib/ libprotobuf-lite.a} \
32
- ${PROTOBUF_ROOT: +-DProtobuf_PROTOC_LIBRARY=$PROTOBUF_ROOT / lib/ libprotoc.a} \
33
- ${PROTOBUF_ROOT: +-DProtobuf_INCLUDE_DIR=$PROTOBUF_ROOT / include} \
34
- ${PROTOBUF_ROOT: +-DProtobuf_PROTOC_EXECUTABLE=$PROTOBUF_ROOT / bin/ protoc} \
35
- ${RE2_ROOT: +-DRE2_INCLUDE_DIR=${RE2_ROOT} / include} \
36
- ${BOOST_ROOT: +-DBOOST_INCLUDE_DIR=${BOOST_ROOT} / include} \
37
- -DCMAKE_CXX_FLAGS=" $CXXFLAGS -Wno-unknown-warning -Wno-unknown-warning-option -Wno-error=unused-but-set-variable -Wno-error=deprecated" \
38
- -DCMAKE_C_FLAGS=" $CFLAGS -Wno-unknown-warning -Wno-unknown-warning-option -Wno-error=unused-but-set-variable -Wno-error=deprecated"
21
+ # Check ROCm build conditions
22
+ if [[ -f /etc/redhat-release ]]; then
23
+ export ALMA_LINUX_MAJOR_VERSION=$( awk ' {print $3}' /etc/redhat-release | cut -d. -f1)
24
+ fi
25
+
26
+ if [[ " $ALIBUILD_O2_FORCE_GPU " -eq 1 ]] || [[ " $ALIBUILD_ENABLE_HIP " -eq 1 ]] || \
27
+ ( ( [[ -z " $DISABLE_GPU " ]] || [[ " $DISABLE_GPU " -eq 0 ]] ) && \
28
+ ( command -v /opt/rocm/bin/rocminfo > /dev/null 2>&1 ) && \
29
+ [[ -d /opt/rocm/include/hiprand ]] && \
30
+ [[ -d /opt/rocm/include/hipblas ]] && \
31
+ [[ -d /opt/rocm/include/hipsparse ]] && \
32
+ [[ -d /opt/rocm/include/hipfft ]] && \
33
+ [[ -d /opt/rocm/include/rocblas ]] && \
34
+ [[ -d /opt/rocm/include/rocrand ]] && \
35
+ [[ -d /opt/rocm/include/miopen ]] && \
36
+ [[ -d /opt/rocm/include/rccl ]] && \
37
+ [[ -d /opt/rocm/lib/hipblaslt ]] && \
38
+ [[ -z " $ORT_ROCM_BUILD " ]] ) && \
39
+ ([[ -z " $ALMA_LINUX_MAJOR_VERSION " ]] || [[ " $ALMA_LINUX_MAJOR_VERSION " -eq 9 ]]); then
40
+ export ORT_ROCM_BUILD=" 1"
41
+ : ${ALIBUILD_O2_OVERRIDE_HIP_ARCHS:= " gfx906,gfx908" }
42
+ export LD_LIBRARY_PATH=$LD_LIBRARY_PATH :/opt/rocm/lib
43
+ else
44
+ export ORT_ROCM_BUILD=" 0"
45
+ fi
46
+
47
+ # Check CUDA build conditions
48
+ if ( [[ " $ALIBUILD_O2_FORCE_GPU " -eq 1 ]] || [[ " $ALIBUILD_ENABLE_CUDA " -eq 1 ]] || \
49
+ ( ( [[ -z " $DISABLE_GPU " ]] || [[ " $DISABLE_GPU " -eq 0 ]] ) && \
50
+ ( command -v nvcc > /dev/null 2>&1 ) && \
51
+ [[ -f /usr/include/cudnn.h ]] && \
52
+ [[ -z " $ORT_CUDA_BUILD " ]] ) ) && \
53
+ [[ " $ORT_ROCM_BUILD " -eq 0 ]] && \
54
+ [[ -z " $ALMA_LINUX_MAJOR_VERSION " ]]; then
55
+ export ORT_CUDA_BUILD=" 1"
56
+ : ${ALIBUILD_O2_OVERRIDE_CUDA_ARCHS:= " sm_86" }
57
+ else
58
+ export ORT_CUDA_BUILD=" 0"
59
+ fi
60
+
61
+ # Optional builds
62
+ # ## MIGraphX
63
+ if ( [[ " $ORT_ROCM_BUILD " -eq 1 ]] && [[ $( find /opt/rocm* -name " libmigraphx*" -print -quit | wc -l 2>&1 ) -eq 1 ]] ) && \
64
+ [[ -z " $ORT_MIGRAPHX_BUILD " ]]; then
65
+ export ORT_MIGRAPHX_BUILD=" 1"
66
+ elif [[ -z " $ORT_MIGRAPHX_BUILD " ]]; then
67
+ export ORT_MIGRAPHX_BUILD=" 0"
68
+ fi
69
+ # ## TensorRT
70
+ if ( [[ " $ORT_CUDA_BUILD " -eq 1 ]] && [[ $( find /usr -name " libnvinfer*" -print -quit | wc -l 2>&1 ) -eq 1 ]] ) && \
71
+ [[ -z " $ORT_MIGRAPHX_BUILD " ]]; then
72
+ export ORT_TENSORRT_BUILD=" 1"
73
+ elif [[ -z " $ORT_TENSORRT_BUILD " ]]; then
74
+ export ORT_TENSORRT_BUILD=" 0"
75
+ fi
76
+
77
+ mkdir -p $INSTALLROOT /etc
78
+ cat << EOF > $INSTALLROOT /etc/ort-init.sh
79
+ export ORT_ROCM_BUILD=$ORT_ROCM_BUILD
80
+ export ORT_CUDA_BUILD=$ORT_CUDA_BUILD
81
+ export ORT_MIGRAPHX_BUILD=$ORT_MIGRAPHX_BUILD
82
+ export ORT_TENSORRT_BUILD=$ORT_TENSORRT_BUILD
83
+ EOF
84
+
85
+ cmake " $SOURCEDIR /cmake" \
86
+ -DCMAKE_INSTALL_PREFIX=" $INSTALLROOT " \
87
+ -DCMAKE_BUILD_TYPE=Release \
88
+ -DCMAKE_INSTALL_LIBDIR=lib \
89
+ -DPYTHON_EXECUTABLE=" $( python3 -c ' import sys; print(sys.executable)' ) " \
90
+ -Donnxruntime_BUILD_UNIT_TESTS=OFF \
91
+ -Donnxruntime_PREFER_SYSTEM_LIB=ON \
92
+ -Donnxruntime_BUILD_SHARED_LIB=ON \
93
+ -DProtobuf_USE_STATIC_LIBS=ON \
94
+ -Donnxruntime_ENABLE_TRAINING=OFF \
95
+ ${PROTOBUF_ROOT: +-DProtobuf_LIBRARY=$PROTOBUF_ROOT / lib/ libprotobuf.a} \
96
+ ${PROTOBUF_ROOT: +-DProtobuf_LITE_LIBRARY=$PROTOBUF_ROOT / lib/ libprotobuf-lite.a} \
97
+ ${PROTOBUF_ROOT: +-DProtobuf_PROTOC_LIBRARY=$PROTOBUF_ROOT / lib/ libprotoc.a} \
98
+ ${PROTOBUF_ROOT: +-DProtobuf_INCLUDE_DIR=$PROTOBUF_ROOT / include} \
99
+ ${PROTOBUF_ROOT: +-DProtobuf_PROTOC_EXECUTABLE=$PROTOBUF_ROOT / bin/ protoc} \
100
+ ${RE2_ROOT: +-DRE2_INCLUDE_DIR=${RE2_ROOT} / include} \
101
+ ${BOOST_ROOT: +-DBOOST_INCLUDE_DIR=${BOOST_ROOT} / include} \
102
+ -Donnxruntime_USE_MIGRAPHX=${ORT_MIGRAPHX_BUILD} \
103
+ -Donnxruntime_USE_ROCM=${ORT_ROCM_BUILD} \
104
+ -Donnxruntime_ROCM_HOME=/opt/rocm \
105
+ -Donnxruntime_CUDA_HOME=/usr/local/cuda \
106
+ -DCMAKE_HIP_COMPILER=/opt/rocm/llvm/bin/clang++ \
107
+ -D__HIP_PLATFORM_AMD__=${ORT_ROCM_BUILD} \
108
+ ${ALIBUILD_O2_OVERRIDE_HIP_ARCHS: +-DCMAKE_HIP_ARCHITECTURES=${ALIBUILD_O2_OVERRIDE_HIP_ARCHS} } \
109
+ ${ALIBUILD_O2_OVERRIDE_CUDA_ARCH: +-CMAKE_CUDA_ARCHITECTURES=${ALIBUILD_O2_OVERRIDE_CUDA_ARCHS} } \
110
+ -Donnxruntime_USE_COMPOSABLE_KERNEL=OFF \
111
+ -Donnxruntime_USE_ROCBLAS_EXTENSION_API=${ORT_ROCM_BUILD} \
112
+ -Donnxruntime_USE_COMPOSABLE_KERNEL_CK_TILE=ON \
113
+ -Donnxruntime_DISABLE_RTTI=OFF \
114
+ -DMSVC=OFF \
115
+ -Donnxruntime_USE_CUDA=${ORT_CUDA_BUILD} \
116
+ -Donnxruntime_USE_CUDA_NHWC_OPS=${ORT_CUDA_BUILD} \
117
+ -Donnxruntime_CUDA_USE_TENSORRT=${ORT_TENSORRT_BUILD} \
118
+ -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" \
119
+ -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"
39
120
40
121
cmake --build . -- ${JOBS: +-j$JOBS } install
41
122
@@ -44,8 +125,7 @@ mkdir -p "$INSTALLROOT/etc/modulefiles"
44
125
MODULEFILE=" $INSTALLROOT /etc/modulefiles/$PKGNAME "
45
126
alibuild-generate-module --lib > " $MODULEFILE "
46
127
cat >> " $MODULEFILE " << EoF
47
-
48
128
# Our environment
49
- set ${PKGNAME} _ROOT \$ ::env(BASEDIR)/$PKGNAME /\$ version
50
129
prepend-path ROOT_INCLUDE_PATH \$ ${PKGNAME} _ROOT/include/onnxruntime
130
+ append-path LD_LIBRARY_PATH /opt/rocm/lib
51
131
EoF
0 commit comments