Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ORT GPU build #5622

Merged
merged 31 commits into from
Jan 22, 2025
Merged
Changes from 11 commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
c80e36c
OnnxRuntime build on AMD GPU's
ChSonnabend Aug 15, 2024
4d42b1f
Merge branch 'alisw:master' into onnxruntime-gpu
ChSonnabend Aug 16, 2024
23c3e5f
Modifying recipe for build on Nvidia GPU's (still needs testing)
ChSonnabend Sep 4, 2024
78fcf07
Updating ONNX build flags
ChSonnabend Sep 17, 2024
6e3689b
Merge branch 'alisw:master' into onnxruntime-gpu
ChSonnabend Sep 17, 2024
0fa8a06
Merge branch 'master' into onnxruntime-gpu
ChSonnabend Sep 27, 2024
73b54ce
Updating version to 1.19.0
ChSonnabend Sep 27, 2024
5e42e46
Adding automatic checks for migraphx, changing build cmake flags and …
ChSonnabend Oct 3, 2024
9e47dfd
Merge branch 'master' into onnxruntime-gpu
ChSonnabend Oct 3, 2024
e90a9e5
This builds ORT with the GPU flags. Note: In the al9_gpu container th…
ChSonnabend Oct 4, 2024
d7b089d
Adding comments and reshuffeling for better readibility
ChSonnabend Oct 4, 2024
d45d194
Adding checks for Cuda and ROCm libraries
ChSonnabend Nov 18, 2024
000afbb
Updating to a recent version of ONNX
ChSonnabend Nov 19, 2024
9613081
Merge branch 'alisw:master' into onnxruntime-gpu
ChSonnabend Nov 21, 2024
f28a341
Changing to -eq 1
ChSonnabend Nov 22, 2024
4813226
Changing to double-brace syntax
ChSonnabend Nov 26, 2024
2713a61
Changing to version 1.20 since 1.19 has issues for GPU execution
ChSonnabend Nov 26, 2024
62ece4e
Adding check for Alma9 (if system is AlmaLinux). exports's still need…
ChSonnabend Nov 28, 2024
ea219bf
Adding compile flags for ONNXRuntime
ChSonnabend Nov 28, 2024
ae214b5
Adding AlmaLinux 9 as general &&-check
ChSonnabend Nov 29, 2024
6f3d636
Adding ORT_ROCM_BUILD check for CUDA build
ChSonnabend Nov 29, 2024
f5fd93b
Removing C/CXX flag for template-id-cdtor
ChSonnabend Nov 30, 2024
5e0f296
Force disabling for alma linux distribution
ChSonnabend Dec 1, 2024
e01351a
Adding ORT variables to be available at build time (and LD_LIBRARY_PA…
ChSonnabend Dec 19, 2024
6bf0ad8
Merge branch 'alisw:master' into onnxruntime-gpu
ChSonnabend Jan 16, 2025
d093398
Fixing linter, adjusting for comments
ChSonnabend Jan 17, 2025
6624f3f
Fixing ...; then
ChSonnabend Jan 17, 2025
0cfeaa0
Changing to -n
ChSonnabend Jan 17, 2025
48e25ed
Adding hipblaslt check
ChSonnabend Jan 20, 2025
bee78c8
Update onnxruntime.sh
ktf Jan 21, 2025
1493b80
Update onnxruntime.sh
ktf Jan 21, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
85 changes: 66 additions & 19 deletions onnxruntime.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package: ONNXRuntime
version: "%(tag_basename)s"
tag: v1.18.1
tag: v1.19.0
source: https://github.com/microsoft/onnxruntime
requires:
- protobuf
Expand All @@ -19,24 +19,71 @@ 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" \
-DCMAKE_C_FLAGS="$CFLAGS -Wno-unknown-warning -Wno-unknown-warning-option -Wno-error=unused-but-set-variable -Wno-error=deprecated"
# Check ROCm build conditions
if { [ "$ALIBUILD_O2_FORCE_GPU" -ne 0 ] || [ "$ALIBUILD_ENABLE_HIP" -ne 0 ] || command -v /opt/rocm/bin/rocminfo >/dev/null 2>&1; } && \
{ [ -z "$DISABLE_GPU" ] || [ "$DISABLE_GPU" -eq 0 ]; }; then
export ORT_ROCM_BUILD=1
: ${ALIBUILD_O2_OVERRIDE_HIP_ARCHS:="gfx906,gfx908"}
else
export ORT_ROCM_BUILD=0
fi
ChSonnabend marked this conversation as resolved.
Show resolved Hide resolved
# Check CUDA build conditions
if { [ "$ALIBUILD_O2_FORCE_GPU" -ne 0 ] || [ "$ALIBUILD_ENABLE_CUDA" -ne 0 ] || command -v nvcc >/dev/null 2>&1; } && \
{ [ -z "$DISABLE_GPU" ] || [ "$DISABLE_GPU" -eq 0 ]; }; then
export ORT_CUDA_BUILD=1
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would also set a default for ALIBUILD_O2_OVERRIDE_CUDA_ARCHS to sm_86 or sm_89 architecture for now

else
export ORT_CUDA_BUILD=0
fi

# Optional builds
### MIGraphX
if [ "$ORT_ROCM_BUILD" -eq 1 ] && [ $(find /opt/rocm* -name "libmigraphx*" -print -quit | wc -l 2>&1) -eq 1 ]; then
export ORT_MIGRAPHX_BUILD=1
else
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 ]; then
export ORT_TENSORRT_BUILD=1
else
export ORT_TENSORRT_BUILD=0
fi

cmake "$SOURCEDIR/cmake" \
-DCMAKE_INSTALL_PREFIX=$INSTALLROOT \
ktf marked this conversation as resolved.
Show resolved Hide resolved
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_LIBDIR=lib \
-DPYTHON_EXECUTABLE=$(python3 -c "import sys; print(sys.executable)") \
ktf marked this conversation as resolved.
Show resolved Hide resolved
-Donnxruntime_BUILD_UNIT_TESTS=OFF \
-Donnxruntime_PREFER_SYSTEM_LIB=ON \
-Donnxruntime_BUILD_SHARED_LIB=ON \
-DProtobuf_USE_STATIC_LIBS=ON \
-Donnxruntime_ENABLE_TRAINING=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:+-DProtobuf_PROTOC_EXECUTABLE=$PROTOBUF_ROOT/bin/protoc} \
${RE2_ROOT:+-DRE2_INCLUDE_DIR=${RE2_ROOT}/include} \
${BOOST_ROOT:+-DBOOST_INCLUDE_DIR=${BOOST_ROOT}/include} \
-Donnxruntime_USE_ROCM=${ORT_ROCM_BUILD} \
${ALIBUILD_O2_OVERRIDE_HIP_ARCHS:+-DCMAKE_HIP_ARCHITECTURES=${ALIBUILD_O2_OVERRIDE_HIP_ARCHS}} \
-D__HIP_PLATFORM_AMD__=${ORT_ROCM_BUILD} \
-Donnxruntime_USE_ROCBLAS_EXTENSION_API=${ORT_ROCM_BUILD} \
-Donnxruntime_ROCM_HOME=/opt/rocm \
-DCMAKE_HIP_COMPILER=/opt/rocm/llvm/bin/clang++ \
-Donnxruntime_USE_MIGRAPHX=${ORT_MIGRAPHX_BUILD} \
-Donnxruntime_USE_CUDA=${ORT_CUDA_BUILD} \
${ALIBUILD_O2_OVERRIDE_CUDA_ARCH:+-CMAKE_CUDA_ARCHITECTURES=${ALIBUILD_O2_OVERRIDE_CUDA_ARCHS}} \
-Donnxruntime_USE_CUDA_NHWC_OPS=${ORT_CUDA_BUILD} \
-Donnxruntime_CUDA_HOME=/usr/local/cuda \
-Donnxruntime_CUDA_USE_TENSORRT=${ORT_TENSORRT_BUILD} \
-Donnxruntime_USE_COMPOSABLE_KERNEL=OFF \
-Donnxruntime_USE_COMPOSABLE_KERNEL_CK_TILE=ON \
-Donnxruntime_DISABLE_RTTI=OFF \
-DMSVC=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" \
-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"

cmake --build . -- ${JOBS:+-j$JOBS} install

Expand Down