-
Notifications
You must be signed in to change notification settings - Fork 169
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
Draft of ORT GPU build #5622
Open
ChSonnabend
wants to merge
24
commits into
alisw:master
Choose a base branch
from
ChSonnabend:onnxruntime-gpu
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Draft of ORT GPU build #5622
Changes from 21 commits
Commits
Show all changes
24 commits
Select commit
Hold shift + click to select a range
c80e36c
OnnxRuntime build on AMD GPU's
ChSonnabend 4d42b1f
Merge branch 'alisw:master' into onnxruntime-gpu
ChSonnabend 23c3e5f
Modifying recipe for build on Nvidia GPU's (still needs testing)
ChSonnabend 78fcf07
Updating ONNX build flags
ChSonnabend 6e3689b
Merge branch 'alisw:master' into onnxruntime-gpu
ChSonnabend 0fa8a06
Merge branch 'master' into onnxruntime-gpu
ChSonnabend 73b54ce
Updating version to 1.19.0
ChSonnabend 5e42e46
Adding automatic checks for migraphx, changing build cmake flags and …
ChSonnabend 9e47dfd
Merge branch 'master' into onnxruntime-gpu
ChSonnabend e90a9e5
This builds ORT with the GPU flags. Note: In the al9_gpu container th…
ChSonnabend d7b089d
Adding comments and reshuffeling for better readibility
ChSonnabend d45d194
Adding checks for Cuda and ROCm libraries
ChSonnabend 000afbb
Updating to a recent version of ONNX
ChSonnabend 9613081
Merge branch 'alisw:master' into onnxruntime-gpu
ChSonnabend f28a341
Changing to -eq 1
ChSonnabend 4813226
Changing to double-brace syntax
ChSonnabend 2713a61
Changing to version 1.20 since 1.19 has issues for GPU execution
ChSonnabend 62ece4e
Adding check for Alma9 (if system is AlmaLinux). exports's still need…
ChSonnabend ea219bf
Adding compile flags for ONNXRuntime
ChSonnabend ae214b5
Adding AlmaLinux 9 as general &&-check
ChSonnabend 6f3d636
Adding ORT_ROCM_BUILD check for CUDA build
ChSonnabend f5fd93b
Removing C/CXX flag for template-id-cdtor
ChSonnabend 5e0f296
Force disabling for alma linux distribution
ChSonnabend e01351a
Adding ORT variables to be available at build time (and LD_LIBRARY_PA…
ChSonnabend File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.20.0 | ||||||||
source: https://github.com/microsoft/onnxruntime | ||||||||
requires: | ||||||||
- protobuf | ||||||||
|
@@ -19,24 +19,95 @@ 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 [[ -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 ]] && \ | ||||||||
[[ -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 ]]; then | ||||||||
export ORT_CUDA_BUILD=1 | ||||||||
: ${ALIBUILD_O2_OVERRIDE_CUDA_ARCHS:="sm_86"} | ||||||||
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 ]] ) && \ | ||||||||
[[ -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 | ||||||||
|
||||||||
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 \ | ||||||||
-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_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}} \ | ||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think there is also an OVERRIDE_CUDA_ARCH, could you check and use that as well? |
||||||||
${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} \ | ||||||||
-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=template-id-cdtor" \ | ||||||||
-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=template-id-cdtor" | ||||||||
|
||||||||
cmake --build . -- ${JOBS:+-j$JOBS} install | ||||||||
|
||||||||
|
@@ -45,7 +116,6 @@ mkdir -p "$INSTALLROOT/etc/modulefiles" | |||||||
MODULEFILE="$INSTALLROOT/etc/modulefiles/$PKGNAME" | ||||||||
alibuild-generate-module --lib > "$MODULEFILE" | ||||||||
cat >> "$MODULEFILE" <<EoF | ||||||||
|
||||||||
# Our environment | ||||||||
set ${PKGNAME}_ROOT \$::env(BASEDIR)/$PKGNAME/\$version | ||||||||
prepend-path ROOT_INCLUDE_PATH \$${PKGNAME}_ROOT/include/onnxruntime | ||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.