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 5 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
60 changes: 57 additions & 3 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.0
tag: v1.19.0
source: https://github.com/microsoft/onnxruntime
requires:
- protobuf
Expand All @@ -19,7 +19,61 @@ prepend_path:

mkdir -p $INSTALLROOT

ORT_BUILD_FLAGS=""
case $ARCHITECTURE in
osx_*)
if [[ $ARCHITECTURE == *_x86-64 ]]; then
Copy link
Contributor

Choose a reason for hiding this comment

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

Solche printouts würde ich weglassen, das ist ja hauptsächlich für debugging

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Ja, aber ich nehme an das es auch einen macOS build gibt der die Mac GPU anspricht. Da muss ich nochmal ein bisschen rumsuchen, dann könnte man den if-Block nämlich nehmen um da die build flags rein zu packen. Aber ja, die print-outs nehm ich am Ende natürlich noch raus

echo "Installing ONNXRuntime for MacOS (CPU version)"
else
echo "Installing ONNXRuntime for MacOS (Metal backend)"
fi
;;
*)
if command -v rocminfo >/dev/null 2>&1; then
Copy link
Contributor

Choose a reason for hiding this comment

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

  • rocm version check fehlt
  • Es ist nicht klar, ob rocminfo im Pfad liegt. Du solltest zumindest /opt/rocm/bin/rocminfo testen. Und dann ist migraphx ein separates ROCm paket. Sprich, wenn rocminfo vorhanden ist, heist das noch nicht, das migraphx vorhanden ist. Du solltest explicit auf migraphx testen.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Good point, das check ich nochmal

echo "Installing ONNXRuntime for ROCm"
ORT_BUILD_FLAGS="\
-Donnxruntime_USE_ROCM=ON \
-Donnxruntime_USE_MIGRAPHX=ON \
-Donnxruntime_ROCM_HOME=/opt/rocm \
-DCMAKE_HIP_COMPILER=/opt/rocm/llvm/bin/clang++ \
-D__HIP_PLATFORM_AMD__=1 \
-DCMAKE_HIP_ARCHITECTURES=gfx906,gfx908 \
-Donnxruntime_USE_COMPOSABLE_KERNEL=OFF \
-Donnxruntime_USE_ROCBLAS_EXTENSION_API=ON \
-Donnxruntime_USE_COMPOSABLE_KERNEL_CK_TILE=ON \
-Donnxruntime_ENABLE_TRAINING=OFF \
-Donnxruntime_DISABLE_RTTI=OFF \
-DMSVC=OFF \
"
elif command -v nvcc >/dev/null 2>&1; then
CUDA_VERSION=$(nvcc --version | grep "release" | awk '{print $NF}' | cut -d. -f1)
if [[ "$CUDA_VERSION" == "V11" ]]; then
Copy link
Contributor

Choose a reason for hiding this comment

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

glaube CUDA 11 kannst du weglassen, und nur >=12 annehmen

echo "Installing ONNXRuntime for CUDA 11.x"
ORT_BUILD_FLAGS=" -Donnxruntime_USE_CUDA=ON \
-DCUDA_TOOLKIT_ROOT_DIR=$CUDA_ROOT \
-Donnxruntime_USE_CUDA_NHWC_OPS=ON \
-Donnxruntime_CUDA_USE_TENSORRT=ON \
Copy link
Contributor

Choose a reason for hiding this comment

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

Wenn du tensorrt nutzt, musst du dann prüfen, ob das explicit installiert ist? Oder ist das immer beim CUDA SDK dabei?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Scheint nicht automatisch mitzukommen (https://docs.nvidia.com/deeplearning/tensorrt/install-guide/index.html)... Ok da bau ich auch noch einen Check mit ein

"
elif [[ "$CUDA_VERSION" == "V12" ]]; then
Copy link
Contributor

Choose a reason for hiding this comment

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

Was ist wenn ROCm und CUDA beides vorhanden ist? Können wir dann nicht beides bauen?

Copy link
Collaborator Author

@ChSonnabend ChSonnabend Sep 17, 2024

Choose a reason for hiding this comment

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

echo "Installing ONNXRuntime for CUDA 12.x"
ORT_BUILD_FLAGS=" -Donnxruntime_USE_CUDA=ON \
-DCUDA_TOOLKIT_ROOT_DIR=$CUDA_ROOT \
-Donnxruntime_USE_CUDA_NHWC_OPS=ON \
-Donnxruntime_CUDA_USE_TENSORRT=ON \
"
else
echo "CUDA version is not 11.x or 12.x, installing ONNXRuntime basic CPU version"
ORT_BUILD_FLAGS=""
fi
else
echo "Installing ONNXRuntime basic CPU version"
ORT_BUILD_FLAGS=""
fi
;;
esac

cmake "$SOURCEDIR/cmake" \
$ORT_BUILD_FLAGS \
-DCMAKE_INSTALL_PREFIX=$INSTALLROOT \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_LIBDIR=lib \
Expand All @@ -35,8 +89,8 @@ cmake "$SOURCEDIR/cmake"
${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" \
-DCMAKE_C_FLAGS="$CFLAGS -Wno-unknown-warning -Wno-unknown-warning-option -Wno-error=unused-but-set-variable"
-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" \
-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"

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

Expand Down