Unverified Commit 59e36b72 authored by Paul Fultz II's avatar Paul Fultz II Committed by GitHub
Browse files

Test with onnx runtime (#552)

* Build and test onnxrt

* Add sudo command

* Add sudo

* Add pkgconfig

* Make root user

* Move unstash out

* Remove noncps

* Add NonCPS back

* Remove all noncps

* Use each method

* Move unstash command

* Unstash before

* Move stash command up

* Move unstash to noncps function

* Remove noncps

* Use a function to unstash

* Remove call to unused function

* Change order of args

* Add another rocmtestnode overload

* List files

* Use capital R

* Search in build directory

* Use force

* Use newer cmake with onnx

* Install requirements

* Print out pip list

* Install pip3

* Add cxxflags for hip

* Generate locale

* Install wheel with pip3

* Disable pip installation

* Disable build wheel
parent b72dac96
...@@ -35,6 +35,8 @@ RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y --allow- ...@@ -35,6 +35,8 @@ RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y --allow-
libnuma-dev \ libnuma-dev \
libpthread-stubs0-dev \ libpthread-stubs0-dev \
libssl-dev \ libssl-dev \
locales \
pkg-config \
python3 \ python3 \
python3-dev \ python3-dev \
python3-pip \ python3-pip \
...@@ -44,11 +46,15 @@ RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y --allow- ...@@ -44,11 +46,15 @@ RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y --allow-
rocm-opencl \ rocm-opencl \
rocm-opencl-dev \ rocm-opencl-dev \
software-properties-common \ software-properties-common \
sudo \
wget \ wget \
zlib1g-dev && \ zlib1g-dev && \
apt-get clean && \ apt-get clean && \
rm -rf /var/lib/apt/lists/* rm -rf /var/lib/apt/lists/*
RUN locale-gen en_US.UTF-8
RUN update-locale LANG=en_US.UTF-8
ENV LC_ALL=C.UTF-8 ENV LC_ALL=C.UTF-8
ENV LANG=C.UTF-8 ENV LANG=C.UTF-8
...@@ -81,6 +87,19 @@ ADD dev-requirements.txt /dev-requirements.txt ...@@ -81,6 +87,19 @@ ADD dev-requirements.txt /dev-requirements.txt
ADD requirements.txt /requirements.txt ADD requirements.txt /requirements.txt
RUN cget -p $PREFIX install -f /dev-requirements.txt -DMIOPEN_CACHE_DIR="" RUN cget -p $PREFIX install -f /dev-requirements.txt -DMIOPEN_CACHE_DIR=""
# Install newer cmake for onnx runtime
RUN cget -p /opt/cmake install kitware/cmake@v3.13.0
ARG ONNXRUNTIME_REPO=https://github.com/Microsoft/onnxruntime
ARG ONNXRUNTIME_BRANCH=master
ARG ONNXRUNTIME_COMMIT=7759136610cd8415264892ad83acdf9d8ed7e87a
RUN git clone --single-branch --branch ${ONNXRUNTIME_BRANCH} --recursive ${ONNXRUNTIME_REPO} onnxruntime && \
cd onnxruntime && \
git checkout ${ONNXRUNTIME_COMMIT} && \
/bin/sh dockerfiles/scripts/install_common_deps.sh
ADD tools/build_and_test_onnxrt.sh /onnxruntime/build_and_test_onnxrt.sh
ENV MIOPEN_FIND_DB_PATH=/tmp/miopen/find-db ENV MIOPEN_FIND_DB_PATH=/tmp/miopen/find-db
ENV MIOPEN_USER_DB_PATH=/tmp/miopen/user-db ENV MIOPEN_USER_DB_PATH=/tmp/miopen/user-db
......
def rocmtestnode(variant, name, body) { def rocmtestnode(variant, name, body, args, pre) {
def image = 'migraphxlib' def image = 'migraphxlib'
def cmake_build = { compiler, flags -> def cmake_build = { compiler, flags ->
def cmd = """ def cmd = """
...@@ -25,6 +25,7 @@ def rocmtestnode(variant, name, body) { ...@@ -25,6 +25,7 @@ def rocmtestnode(variant, name, body) {
stage("checkout ${variant}") { stage("checkout ${variant}") {
checkout scm checkout scm
} }
pre()
stage("image ${variant}") { stage("image ${variant}") {
try { try {
docker.build("${image}", '.') docker.build("${image}", '.')
...@@ -33,7 +34,7 @@ def rocmtestnode(variant, name, body) { ...@@ -33,7 +34,7 @@ def rocmtestnode(variant, name, body) {
} }
} }
withDockerContainer(image: image, args: '--device=/dev/kfd --device=/dev/dri --group-add video --cap-add SYS_PTRACE') { withDockerContainer(image: image, args: "--device=/dev/kfd --device=/dev/dri --group-add video --cap-add SYS_PTRACE ${args}") {
timeout(time: 1, unit: 'HOURS') { timeout(time: 1, unit: 'HOURS') {
body(cmake_build) body(cmake_build)
} }
...@@ -41,10 +42,10 @@ def rocmtestnode(variant, name, body) { ...@@ -41,10 +42,10 @@ def rocmtestnode(variant, name, body) {
} }
} }
} }
@NonCPS // @NonCPS
def rocmtest(m) { def rocmtest(m) {
def builders = [:] def builders = [:]
for(e in m) { m.each { e ->
def label = e.key; def label = e.key;
def action = e.value; def action = e.value;
builders[label] = { builders[label] = {
...@@ -54,8 +55,8 @@ def rocmtest(m) { ...@@ -54,8 +55,8 @@ def rocmtest(m) {
parallel builders parallel builders
} }
@NonCPS // @NonCPS
def rocmnode(name, body) { def rocmnode(name, args, pre, body) {
def node_name = 'rocmtest || rocm' def node_name = 'rocmtest || rocm'
if(name == 'fiji') { if(name == 'fiji') {
node_name = 'rocmtest && fiji'; node_name = 'rocmtest && fiji';
...@@ -65,13 +66,17 @@ def rocmnode(name, body) { ...@@ -65,13 +66,17 @@ def rocmnode(name, body) {
node_name = name node_name = name
} }
return { label -> return { label ->
rocmtestnode(label, node_name, body) rocmtestnode(label, node_name, body, args, pre)
} }
} }
@NonCPS def rocmnode(name, body) {
rocmnode(name, '', {}, body)
}
// @NonCPS
def rocmnode(body) { def rocmnode(body) {
rocmnode('rocmtest', body) rocmnode('rocmtest', '', {}, body)
} }
// Static checks // Static checks
...@@ -112,6 +117,7 @@ rocmtest tidy: rocmnode('rocmtest') { cmake_build -> ...@@ -112,6 +117,7 @@ rocmtest tidy: rocmnode('rocmtest') { cmake_build ->
}, clang_release: rocmnode('vega') { cmake_build -> }, clang_release: rocmnode('vega') { cmake_build ->
stage('Clang Release') { stage('Clang Release') {
cmake_build("hcc", "-DCMAKE_BUILD_TYPE=release") cmake_build("hcc", "-DCMAKE_BUILD_TYPE=release")
stash includes: 'build/*.deb', name: 'migraphx-package'
} }
}, clang_release_py3: rocmnode('vega') { cmake_build -> }, clang_release_py3: rocmnode('vega') { cmake_build ->
stage('Clang Release Python 3') { stage('Clang Release Python 3') {
...@@ -146,3 +152,16 @@ rocmtest tidy: rocmnode('rocmtest') { cmake_build -> ...@@ -146,3 +152,16 @@ rocmtest tidy: rocmnode('rocmtest') { cmake_build ->
''' '''
} }
} }
rocmtest onnx: rocmnode('rocmtest', '-u root', {
sh 'rm -rf ./build/*.deb'
unstash 'migraphx-package'
}) { cmake_build ->
stage("Onnx runtime") {
sh '''
ls -lR
dpkg -i --force-depends ./build/*.deb
cd /onnxruntime && ./build_and_test_onnxrt.sh
'''
}
}
cd /onnxruntime
pip3 install -r requirements.txt
# Add newer cmake to the path
export PATH="/opt/cmake/bin:$PATH"
export CXXFLAGS="-D__HIP_PLATFORM_HCC__=1"
./build.sh --config Release --update --build --parallel --cmake_extra_defines ONNXRUNTIME_VERSION=$(cat ./VERSION_NUMBER) --test --use_migraphx
# pip3 install /code/onnxruntime/build/Linux/Release/dist/*.whl
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment