mirror of
https://github.com/saymrwulf/onnxruntime.git
synced 2026-07-29 20:14:01 +00:00
Jignparm/addcsharptestgpu (#393)
* add file for cshar test using CUDA docker image * add gpu csharp end to end test scripts * uncomment data download * minor change to kick off ci build * small change to kick off build * Add windows GPU test runner script
This commit is contained in:
parent
68881fadcd
commit
7c21c15732
5 changed files with 166 additions and 0 deletions
|
|
@ -0,0 +1,45 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>netcoreapp2.0</TargetFramework>
|
||||
<IsPackable>false</IsPackable>
|
||||
<OnnxRuntimeCsharpRoot>$(MSBuildThisFileDirectory)..\..</OnnxRuntimeCsharpRoot>
|
||||
<Platform>AnyCPU</Platform>
|
||||
<OutputPath>bin\$(Configuration)\</OutputPath>
|
||||
<OnnxRuntimeBuildDirectory Condition="'$(OnnxRuntimeBuildDirectory)'==''">$(OnnxRuntimeCsharpRoot)\..\build\Windows</OnnxRuntimeBuildDirectory>
|
||||
<ProtocDirectory>$(OnnxRuntimeBuildDirectory)\$(Configuration)\external\protobuf\cmake\$(Configuration)</ProtocDirectory>
|
||||
<ProtoSrc>$(OnnxRuntimeCsharpRoot)\..\cmake\external\onnx\onnx</ProtoSrc>
|
||||
<NativeBuildOutputDir>$(OnnxRuntimeBuildDirectory)\$(Configuration)\$(Configuration)</NativeBuildOutputDir>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Google.Protobuf" Version="3.6.1" />
|
||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.8.0" />
|
||||
<PackageReference Include="xunit" Version="2.4.0" />
|
||||
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.0" />
|
||||
<PackageReference Include="Microsoft.ML.OnnxRuntime.Gpu" Version="$(CurrentOnnxRuntimeVersion)"/>
|
||||
</ItemGroup>
|
||||
|
||||
|
||||
<ItemGroup>
|
||||
<Compile Include="$(MSBuildThisFileDirectory)..\Microsoft.ML.OnnxRuntime.Tests\InferenceTest.cs"/>
|
||||
<Compile Include="$(MSBuildThisFileDirectory)..\Microsoft.ML.OnnxRuntime.Tests\OnnxMl.cs"/>
|
||||
|
||||
<None Include="$(OnnxRuntimeCSharpRoot)\testdata\*">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
<Visible>false</Visible>
|
||||
</None>
|
||||
|
||||
<None Include="$(OnnxRuntimeBuildDirectory)\models\**\*">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
<Visible>false</Visible>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Service Include="{508349b6-6b84-4df5-91f0-309beebad82d}" />
|
||||
</ItemGroup>
|
||||
|
||||
|
||||
</Project>
|
||||
|
||||
46
csharp/test/Microsoft.ML.OnnxRuntime.EndToEndTests/runtest-docker-gpu.sh
Executable file
46
csharp/test/Microsoft.ML.OnnxRuntime.EndToEndTests/runtest-docker-gpu.sh
Executable file
|
|
@ -0,0 +1,46 @@
|
|||
#!/bin/bash
|
||||
# Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
# Licensed under the MIT License.
|
||||
|
||||
# build docker image for CPU
|
||||
|
||||
#TODO: Get this working, not tested yet
|
||||
set -x
|
||||
|
||||
|
||||
|
||||
SOURCE_ROOT=$1
|
||||
BUILD_DIR=$2
|
||||
NUGET_REPO_DIRNAME=$3 # path relative to BUILD_DIR
|
||||
IMAGE="ubuntu16.04-cuda10.0-cudnn7.3"
|
||||
PYTHON_VER=3.5
|
||||
OldDir=$(pwd)
|
||||
cd $SOURCE_ROOT/tools/ci_build/github/linux/docker
|
||||
docker build -t "onnxruntime-$IMAGE" --build-arg OS_VERSION=16.04 --build-arg PYTHON_VERSION=${PYTHON_VER} -f Dockerfile.ubuntu_gpu .
|
||||
|
||||
|
||||
docker rm -f "onnxruntime-gpu-container" || true
|
||||
|
||||
set +e
|
||||
|
||||
docker run -h $HOSTNAME \
|
||||
--rm \
|
||||
--name "onnxruntime-gpu-container" \
|
||||
--volume "$SOURCE_ROOT:/onnxruntime_src" \
|
||||
--volume "$BUILD_DIR:/home/onnxruntimedev" \
|
||||
--volume "$HOME/.cache/onnxruntime:/home/onnxruntimedev/.cache/onnxruntime" \
|
||||
-e "OnnxRuntimeBuildDirectory=/home/onnxruntimedev" \
|
||||
-e "IsReleaseBuild=$IsReleaseBuild" \
|
||||
"onnxruntime-$IMAGE" \
|
||||
/bin/bash /onnxruntime_src/csharp/test/Microsoft.ML.OnnxRuntime.EndToEndTests/runtest-gpu.sh \
|
||||
/home/onnxruntimedev/$NUGET_REPO_DIRNAME /onnxruntime_src /home/onnxruntimedev $TestDataUrl $TestDataChecksum &
|
||||
|
||||
wait -n
|
||||
|
||||
EXIT_CODE=$?
|
||||
|
||||
set -e
|
||||
exit $EXIT_CODE
|
||||
|
||||
|
||||
cd $OldDir
|
||||
|
|
@ -5,6 +5,7 @@
|
|||
# build docker image for CPU
|
||||
|
||||
#TODO: Get this working, not tested yet
|
||||
set -x
|
||||
|
||||
|
||||
|
||||
|
|
@ -29,6 +30,7 @@ docker run -h $HOSTNAME \
|
|||
--volume "$BUILD_DIR:/home/onnxruntimedev" \
|
||||
--volume "$HOME/.cache/onnxruntime:/home/onnxruntimedev/.cache/onnxruntime" \
|
||||
-e "OnnxRuntimeBuildDirectory=/home/onnxruntimedev" \
|
||||
-e "IsReleaseBuild=$IsReleaseBuild" \
|
||||
"onnxruntime-$IMAGE" \
|
||||
/bin/bash /onnxruntime_src/csharp/test/Microsoft.ML.OnnxRuntime.EndToEndTests/runtest.sh \
|
||||
/home/onnxruntimedev/$NUGET_REPO_DIRNAME /onnxruntime_src /home/onnxruntimedev $TestDataUrl $TestDataChecksum &
|
||||
|
|
|
|||
|
|
@ -0,0 +1,29 @@
|
|||
REM Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
REM Licensed under the MIT License.
|
||||
|
||||
@echo off
|
||||
SETLOCAL EnableDelayedExpansion
|
||||
|
||||
set LocalNuGetRepo=%1
|
||||
REM WorkingDirectory is Build.SourcesDirectory\csharp
|
||||
set /p MajorVersionNumber=<..\VERSION_NUMBER
|
||||
set VersionSuffix=
|
||||
IF NOT DEFINED IsReleaseBuild (
|
||||
FOR /F "tokens=* USEBACKQ" %%F IN (`git rev-parse --short HEAD`) DO (
|
||||
set VersionSuffix=-dev-%%F
|
||||
)
|
||||
)
|
||||
|
||||
set CurrentOnnxRuntimeVersion=%MajorVersionNumber%%VersionSuffix%
|
||||
@echo %CurrentOnnxRuntimeVersion%
|
||||
dotnet restore test\Microsoft.ML.OnnxRuntime.EndToEndTests\Microsoft.ML.OnnxRuntime.EndToEndTests.Gpu.csproj -s %LocalNuGetRepo% --configfile .\Nuget.CSharp.config
|
||||
if NOT errorlevel 0 (
|
||||
@echo "Failed to restore nuget packages for the test project"
|
||||
Exit 1
|
||||
)
|
||||
|
||||
dotnet test test\Microsoft.ML.OnnxRuntime.EndToEndTests\Microsoft.ML.OnnxRuntime.EndToEndTests.csproj --no-restore
|
||||
if NOT errorlevel 0 (
|
||||
@echo "Failed to build or execute the end-to-end test"
|
||||
Exit 1
|
||||
)
|
||||
|
|
@ -0,0 +1,44 @@
|
|||
#!/bin/bash
|
||||
# Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
# Licensed under the MIT License.
|
||||
|
||||
LocalNuGetRepo=$1
|
||||
SourceRoot=$2
|
||||
BuildDir=$3
|
||||
TestDataUrl=$4
|
||||
TestDataChecksum=$5
|
||||
|
||||
#TestDataUrl and TestDataChecksum comes from the build env variable
|
||||
set -x
|
||||
|
||||
echo "Downloading test data"
|
||||
python3 $SourceRoot/tools/ci_build/build.py --update --download_test_data --build_dir $BuildDir --test_data_url $TestDataUrl --test_data_checksum $TestDataChecksum
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "Failed to download test data"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
OldDir=`pwd`
|
||||
cd $SourceRoot
|
||||
|
||||
MajorVersion=$(cat $SourceRoot/VERSION_NUMBER)
|
||||
VersionSuffix=
|
||||
if [ "$IsReleaseBuild" != "true" ]; then
|
||||
VersionSuffix=-dev-$(git rev-parse --short=8 HEAD)
|
||||
fi
|
||||
export CurrentOnnxRuntimeVersion=$MajorVersion$VersionSuffix
|
||||
echo "Current NuGet package version is $CurrentOnnxRuntimeVersion"
|
||||
|
||||
dotnet restore $SourceRoot/csharp/test/Microsoft.ML.OnnxRuntime.EndToEndTests/Microsoft.ML.OnnxRuntime.EndToEndTests.Gpu.csproj -s $LocalNuGetRepo -s https://api.nuget.org/v3/index.json
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "Failed to restore nuget packages for the test project"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
dotnet test $SourceRoot/csharp/test/Microsoft.ML.OnnxRuntime.EndToEndTests/Microsoft.ML.OnnxRuntime.EndToEndTests.Gpu.csproj --no-restore
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "Failed to build or execute the end-to-end test"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
cd $OldDir
|
||||
Loading…
Reference in a new issue