Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
103 commits
Select commit Hold shift + click to select a range
2320cb6
Detect os and arch and move the artifacts to a new folder.
May 6, 2020
39430bb
Adjust arch detection.
May 6, 2020
82f9877
Remove unnecesary jars so we cam focus on those we publish.
May 6, 2020
718b2cb
Merge branch 'master' into yuslepukhin/rework_jar
May 6, 2020
573ff01
Attempt uploadArchive method but it produces no signature error.
May 7, 2020
1be9c58
Add signing
May 7, 2020
7030931
Revert wrapper
May 8, 2020
b6875b1
Apply Adam's patch and review comments.
May 8, 2020
f5eba04
Make signature simlper.
May 8, 2020
ad51eec
Merge branch 'master' into yuslepukhin/rework_jar
May 8, 2020
bd113c6
Merge branch 'master' into yuslepukhin/rework_jar
May 11, 2020
5920d10
Fix indent.
May 11, 2020
a6cc572
Merge branch 'master' into yuslepukhin/rework_jar
May 12, 2020
9a3f7af
Halt on 32-bit arch.
May 12, 2020
7e2503c
Java Pipeline start.
May 13, 2020
fc3245d
Merge branch 'master' into yuslepukhin/java_pipeline
May 13, 2020
a36fe01
Introduce Java-api packaging pipeline
May 13, 2020
46da842
Add Download, Unzipping and updating the jar
May 14, 2020
0b4399d
Modify build settings add publishing to pipeline
May 14, 2020
0abefa9
Fix first error.
May 14, 2020
e3789b7
Update java-api-packaging-pipelines.yml for Azure Pipelines
yuslepukhin May 14, 2020
d7150fe
Update java-api-packaging-pipelines.yml for Azure Pipelines
yuslepukhin May 14, 2020
f7f55bf
Update java-api-packaging-pipelines.yml for Azure Pipelines
yuslepukhin May 14, 2020
66dc196
Update java-api-packaging-pipelines.yml for Azure Pipelines
yuslepukhin May 14, 2020
836fce2
Remove DisplayName from the script
May 14, 2020
48c70db
Update java-api-packaging-pipelines.yml for Azure Pipelines
yuslepukhin May 14, 2020
c71a1d4
Update java-api-packaging-pipelines.yml for Azure Pipelines
yuslepukhin May 14, 2020
5bcf1b0
Update java-api-packaging-pipelines.yml for Azure Pipelines
yuslepukhin May 14, 2020
c8a05a6
Update java-api-packaging-pipelines.yml for Azure Pipelines
yuslepukhin May 14, 2020
7dbeccb
Fix pipeline issues. Install openjdk8 to centos6 docker image.
May 14, 2020
8fe7b88
Adjust packaging, fix script errors.
May 15, 2020
fec54ea
Add gradle to the path. Rework native library copy/strip.
May 18, 2020
faf63d3
Fix ENV stmt
May 18, 2020
78b47be
Introduce GPU pipeline. Fix parameters passed to native DLL extraction.
May 18, 2020
c95e809
Adjust the script and Linuix pools.
May 18, 2020
f3f0daa
Fix Java HOME env and Path. Add missing parameter.
May 18, 2020
209a2ff
Add Java
May 18, 2020
ab3433f
Update java-api-packaging-pipelines-gpu.yml for Azure Pipelines
yuslepukhin May 19, 2020
04561c4
Update java-api-packaging-pipelines-gpu.yml for Azure Pipelines
yuslepukhin May 19, 2020
71ee255
Fix library name match.
May 19, 2020
ed4d83b
Add version setting.
May 19, 2020
c3b3492
Autoremove bsolte packages.
May 19, 2020
353493e
Fix Windows build command line. Add sudo to docker commands.
May 19, 2020
67a4471
Merge branch 'master' into yuslepukhin/java_pipeline
May 19, 2020
6f89cf1
Fix a '
May 19, 2020
db831ed
Remove version from artifact name.
May 19, 2020
884e097
Replace install_dps url.
May 20, 2020
d33e6eb
Merge branch 'master' into yuslepukhin/java_pipeline
May 20, 2020
661bd22
Add component governance.
May 20, 2020
9f70f97
Fix component gov path.
May 20, 2020
5967d2b
Fix build switches, add generating testing.jar
May 20, 2020
c420890
Remove --enable_wcos from CUDA. Currently not working.
May 20, 2020
e5c11fb
Replace DownloadPipelineArtifact to @2
yuslepukhin May 20, 2020
ae6d5bb
Update download artifact version. Fix paths.
May 20, 2020
af3e6b1
Fix up artifacts names. Add end to end testing.
May 21, 2020
b88a29f
Fix up template invocation.
May 21, 2020
cbdae46
Remove stray jobs.
May 21, 2020
b7b2f4d
Fix parameters
May 21, 2020
9e00f67
Add steps.
May 21, 2020
187511e
Add quotes
May 21, 2020
5cb5540
Add quotes.
May 21, 2020
080c6c3
Remove spaces.
May 21, 2020
ec202d5
Inject the testing task directly into the pipeline
yuslepukhin May 21, 2020
2f924cb
Inject Finak Jar testing tasks directly into CPU pipeline
yuslepukhin May 21, 2020
a220875
Fix up parameters
yuslepukhin May 21, 2020
64e4a05
Inject Final Jar testing jobs directly into a pipeline
yuslepukhin May 21, 2020
145ec63
Fix up slashes?
May 21, 2020
e5b3cb5
Remove clean step.
May 21, 2020
88e9222
Remove cleaning the artifacts folder as we download there.
May 21, 2020
83aa14a
Adjust paths.
May 21, 2020
350d179
Fix unix testing.
May 21, 2020
4812364
Merge branch 'master' into yuslepukhin/java_pipeline
May 21, 2020
52775f5
Restore openjdk
May 22, 2020
030281a
Merge branch 'master' into yuslepukhin/java_pipeline
May 26, 2020
e0d957b
Add custom lib for testing to testing.jar.
May 26, 2020
c4e937d
Add lib prefix to the libs.
May 26, 2020
103a03f
Fix up GPU pipeline. Run final test on Linux under GPU docker.
May 26, 2020
ef510d7
Fix the indent
yuslepukhin May 26, 2020
3f3d883
Adjust library paths for both CPU and GPU.
May 26, 2020
6a60af7
Adjust library loading logic.
May 27, 2020
ba279a9
Add toString()
May 27, 2020
da26cb7
Revert MacOS. Try Linux w/o ./
May 27, 2020
998822a
Adjust library path.
May 27, 2020
4480917
Remove loading as a resource.
May 27, 2020
a48dad5
Load unix linraries as a resource. Create a symlink to custom_op lib
May 27, 2020
01c4233
Add leading underscore to resouce libs.
May 27, 2020
b5de20d
Adjust packaging tools.
May 27, 2020
d82662d
Refer to gpu jar in the shall script.
May 27, 2020
92775b5
Add executable permission for new scripts.
May 28, 2020
a71bc21
Merge branch 'yuslepukhin/java_pipeline' of https://github.com/micros…
May 28, 2020
af54ceb
Setup Cuda env variables.
May 28, 2020
4ffa61c
Remove LD_LIBRARY_PATH manipulation. Add cleaning to all jobs.
May 28, 2020
a5d03bc
Merge branch 'master' into yuslepukhin/java_pipeline
May 28, 2020
1c14c54
Remove native windows binaries from testing.jar
May 28, 2020
ca6e88b
Add Java version output.
May 28, 2020
45dc765
Fix native library removal.
May 28, 2020
5aa003c
Make sure the current dir is what we need.
May 28, 2020
6d996f2
Add -DUSE_CUDA=1 flat for gpu testing.
May 29, 2020
e965f86
Merge branch 'master' into yuslepukhin/java_pipeline
May 29, 2020
d0aa585
Merge branch 'master' into yuslepukhin/java_pipeline
May 29, 2020
7f9338a
Merge branch 'master' into yuslepukhin/java_pipeline
Jun 1, 2020
f09031a
Break the line so it is not too long for flake
Jun 1, 2020
a3ab6d1
Merge branch 'master' into yuslepukhin/java_pipeline
Jun 1, 2020
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
4 changes: 3 additions & 1 deletion cmake/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,14 @@ set(CMAKE_OSX_DEPLOYMENT_TARGET "10.12" CACHE STRING "Minimum OS X deployment ve

# Project
project(onnxruntime C CXX)
# Needed for Java
set (CMAKE_C_STANDARD 99)

include(CheckCXXCompilerFlag)
include(CheckLanguage)

# CentOS compiler is old but it does allow certain C++14 features
# such as lambda captures and they are convinient
# such as lambda captures and they are convenient
# On the other hand it does not allow some others.
# So we cant' regulate simply with the standard.
set(CMAKE_CXX_STANDARD 14)
Expand Down
13 changes: 9 additions & 4 deletions cmake/onnxruntime_unittests.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -816,12 +816,15 @@ set_property(TARGET custom_op_library APPEND_STRING PROPERTY LINK_FLAGS ${ONNXRU

if (onnxruntime_BUILD_JAVA)
message(STATUS "Running Java tests")
# native-test is added to resources so custom_op_lib can be loaded
# and we want to symlink it there
set(JAVA_NATIVE_TEST_DIR ${JAVA_OUTPUT_DIR}/native-test)
file(MAKE_DIRECTORY ${JAVA_NATIVE_TEST_DIR})

# delegate to gradle's test runner
if(WIN32)
# If we're on windows, symlink the custom op test library somewhere we can see it
set(JAVA_NATIVE_TEST_DIR ${JAVA_OUTPUT_DIR}/native-test)
file(MAKE_DIRECTORY ${JAVA_NATIVE_TEST_DIR})
add_custom_command(TARGET custom_op_library POST_BUILD COMMAND ${CMAKE_COMMAND} -E create_symlink $<TARGET_FILE:custom_op_library> ${JAVA_NATIVE_TEST_DIR}/$<TARGET_FILE_NAME:custom_op_library>)
add_custom_command(TARGET custom_op_library POST_BUILD COMMAND ${CMAKE_COMMAND} -E create_symlink $<TARGET_FILE:custom_op_library>
${JAVA_NATIVE_TEST_DIR}/$<TARGET_FILE_NAME:custom_op_library>)
# On windows ctest requires a test to be an .exe(.com) file
# So there are two options 1) Install Chocolatey and its gradle package
# That package would install gradle.exe shim to its bin so ctest could run gradle.exe
Expand All @@ -833,6 +836,8 @@ if (onnxruntime_BUILD_JAVA)
-DREPO_ROOT=${REPO_ROOT}
-P ${CMAKE_CURRENT_SOURCE_DIR}/onnxruntime_java_unittests.cmake)
else()
add_custom_command(TARGET custom_op_library POST_BUILD COMMAND ${CMAKE_COMMAND} -E create_symlink $<TARGET_FILE:custom_op_library>
${JAVA_NATIVE_TEST_DIR}/$<TARGET_LINKER_FILE_NAME:custom_op_library>)
if (onnxruntime_USE_CUDA)
add_test(NAME onnxruntime4j_test COMMAND ${GRADLE_EXECUTABLE} cmakeCheck -DcmakeBuildDir=${CMAKE_CURRENT_BINARY_DIR} -DUSE_CUDA=1
WORKING_DIRECTORY ${REPO_ROOT}/java)
Expand Down
4 changes: 2 additions & 2 deletions java/src/test/java/ai/onnxruntime/InferenceTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -907,9 +907,9 @@ public void testLoadCustomLibrary() throws OrtException {
// So we look it up as a classpath resource and resolve it to a real path
customLibraryName = getResourcePath("/custom_op_library.dll").toString();
} else if (osName.contains("mac")) {
customLibraryName = "libcustom_op_library.dylib";
customLibraryName = getResourcePath("/libcustom_op_library.dylib").toString();
} else if (osName.contains("linux")) {
customLibraryName = "./libcustom_op_library.so";
customLibraryName = getResourcePath("/libcustom_op_library.so").toString();
} else {
fail("Unknown os/platform '" + osName + "'");
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,243 @@
jobs:
- job: Linux_Java_API_Build_GPU_x64
workspace:
clean: all
timeoutInMinutes: 60
pool: 'Linux-GPU-CUDA10'
steps:
- template: templates/set-version-number-variables-step.yml
- task: CmdLine@2
inputs:
script: |
sudo docker build --pull -t onnxruntime-centos6-gpu --build-arg BUILD_USER=onnxruntimedev --build-arg BUILD_UID=$(id -u) --build-arg PYTHON_VERSION=$(python.version) -f Dockerfile.centos6_gpu .
workingDirectory: $(Build.SourcesDirectory)/tools/ci_build/github/linux/docker
- task: CmdLine@2
inputs:
script: |
sudo docker run --gpus all -e NVIDIA_VISIBLE_DEVICES=all --rm --volume $(Build.SourcesDirectory):/onnxruntime_src --volume $(Build.BinariesDirectory):/build --volume /data/models:/build/models:ro -e NIGHTLY_BUILD onnxruntime-centos6-gpu /usr/bin/python3.6 /onnxruntime_src/tools/ci_build/build.py --build_dir /build --config Release --skip_submodule_sync --parallel --build_java --build_shared_lib --cmake_path /usr/bin/cmake --ctest_path /usr/bin/ctest --use_cuda --cuda_version=10.1 --cuda_home=/usr/local/cuda-10.1 --cudnn_home=/usr/local/cuda-10.1
workingDirectory: $(Build.SourcesDirectory)
- template: templates/java-api-artifacts-package-and-publish-steps-posix.yml
parameters:
arch: 'linux-x64'
buildConfig: 'Release'
artifactName: 'onnxruntime-java-linux-x64-gpu'
version: '$(OnnxRuntimeVersion)'
libraryName: 'libonnxruntime.so'
nativeLibraryName: 'libonnxruntime4j_jni.so'

- template: templates/component-governance-component-detection-steps.yml
parameters :
condition : 'succeeded'

- template: templates/clean-agent-build-directory-step.yml

- job: Windows_Java_API_Build_GPU_x64
workspace:
clean: all
pool: 'Win-GPU-2019'
timeoutInMinutes: 120
variables:
EnvSetupScript: setup_env_cuda.bat
buildArch: x64
msbuildArch: amd64
msbuildPlatform: x64
buildparameter: --use_cuda --cuda_version=10.1 --cuda_home="C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.1" --cudnn_home="C:\local\cudnn-10.1-windows10-x64-v7.6.5.32\cuda"
steps:
- task: UsePythonVersion@0
inputs:
versionSpec: '3.7'
addToPath: true
architecture: $(buildArch)

- task: BatchScript@1
displayName: 'setup env'
inputs:
filename: '$(Build.SourcesDirectory)\tools\ci_build\github\windows\$(EnvSetupScript)'
modifyEnvironment: true
workingFolder: '$(Build.BinariesDirectory)'

- script: |
python -m pip install -q pyopenssl setuptools wheel numpy scipy
workingDirectory: '$(Build.BinariesDirectory)'
displayName: 'Install python modules'

- powershell: |
$Env:USE_MSVC_STATIC_RUNTIME=1
$Env:ONNX_ML=1
$Env:CMAKE_ARGS="-DONNX_USE_PROTOBUF_SHARED_LIBS=OFF -DProtobuf_USE_STATIC_LIBS=ON -DONNX_USE_LITE_PROTO=ON -DCMAKE_TOOLCHAIN_FILE=C:/vcpkg/scripts/buildsystems/vcpkg.cmake -DVCPKG_TARGET_TRIPLET=$(buildArch)-windows-static"
python setup.py bdist_wheel
Get-ChildItem -Path dist/*.whl | foreach {pip --disable-pip-version-check install --upgrade $_.fullname}
workingDirectory: '$(Build.SourcesDirectory)\cmake\external\onnx'
displayName: 'Install ONNX'

- template: templates/set-test-data-variables-step.yml
- template: templates/set-version-number-variables-step.yml

- task: PythonScript@0
displayName: 'Generate cmake config'
inputs:
scriptPath: '$(Build.SourcesDirectory)\tools\ci_build\build.py'
arguments: '--config RelWithDebInfo --build_dir $(Build.BinariesDirectory) --skip_submodule_sync --build_java --build_shared_lib --update --cmake_generator "Visual Studio 16 2019" --enable_lto --use_openmp --build_shared_lib --enable_onnx_tests $(buildparameter)'
workingDirectory: '$(Build.BinariesDirectory)'


- task: VSBuild@1
displayName: 'Build'
inputs:
solution: '$(Build.BinariesDirectory)\RelWithDebInfo\onnxruntime.sln'
platform: $(msbuildPlatform)
configuration: RelWithDebInfo
msbuildArchitecture: $(buildArch)
maximumCpuCount: true
logProjectEvents: true
workingFolder: '$(Build.BinariesDirectory)\RelWithDebInfo'
createLogFile: true

- task: PythonScript@0
displayName: 'test'
inputs:
scriptPath: '$(Build.SourcesDirectory)\tools\ci_build\build.py'
arguments: '--config RelWithDebInfo --build_dir $(Build.BinariesDirectory) --skip_submodule_sync --build_shared_lib --build_java --test --cmake_generator "Visual Studio 16 2019" --enable_lto --use_openmp --build_shared_lib --enable_onnx_tests $(buildparameter)'
workingDirectory: '$(Build.BinariesDirectory)'

- template: templates/java-api-artifacts-package-and-publish-steps-windows.yml
parameters:
buildConfig: RelWithDebInfo
artifactName: 'onnxruntime-java-win-$(buildArch)-gpu'
version: '$(OnnxRuntimeVersion)'
commitId: $(OnnxRuntimeGitCommitHash)

- template: templates/component-governance-component-detection-steps.yml
parameters :
condition : 'succeeded'

- template: templates/clean-agent-build-directory-step.yml

- job: Jar_Packaging
workspace:
clean: all
pool: 'Win-CPU-2019'
dependsOn:
- Windows_Java_API_Build_GPU_x64
- Linux_Java_API_Build_GPU_x64
condition: succeeded()
steps:
- template: templates/set-version-number-variables-step.yml

- task: DownloadPipelineArtifact@2
displayName: 'Download Pipeline Artifact - Win x64'
inputs:
buildType: 'current'
artifactName: 'drop-onnxruntime-java-win-x64-gpu'
targetPath: '$(Build.BinariesDirectory)\java-artifact'

- task: DownloadPipelineArtifact@2
displayName: 'Download Pipeline Artifact - Linux x64'
inputs:
buildType: 'current'
artifactName: 'drop-onnxruntime-java-linux-x64-gpu'
targetPath: '$(Build.BinariesDirectory)\java-artifact'

- task: ExtractFiles@1
inputs:
archiveFilePatterns: '$(Build.BinariesDirectory)\java-artifact\onnxruntime-java-win-x64-gpu.zip'
destinationFolder: '$(Build.BinariesDirectory)\java-artifact'
cleanDestinationFolder: false

- task: ExtractFiles@1
inputs:
archiveFilePatterns: '$(Build.BinariesDirectory)\java-artifact\onnxruntime-java-linux-x64-gpu.zip'
destinationFolder: '$(Build.BinariesDirectory)\java-artifact'
cleanDestinationFolder: false

- task: CmdLine@2
inputs:
script: |
pushd onnxruntime-java-linux-x64-gpu
jar uf $(Build.BinariesDirectory)\java-artifact\onnxruntime-java-win-x64-gpu\testing.jar libcustom_op_library.so
del /F /Q libcustom_op_library.so
jar uf $(Build.BinariesDirectory)\java-artifact\onnxruntime-java-win-x64-gpu\onnxruntime-$(OnnxRuntimeVersion).jar .
popd
pushd onnxruntime-java-win-x64-gpu
ren onnxruntime-$(OnnxRuntimeVersion).jar onnxruntime-gpu-$(OnnxRuntimeVersion).jar
ren onnxruntime-$(OnnxRuntimeVersion)-javadoc.jar onnxruntime-gpu-$(OnnxRuntimeVersion)-javadoc.jar
ren onnxruntime-$(OnnxRuntimeVersion)-sources.jar onnxruntime-gpu-$(OnnxRuntimeVersion)-sources.jar
ren onnxruntime-$(OnnxRuntimeVersion).pom onnxruntime-gpu-$(OnnxRuntimeVersion).pom
popd
workingDirectory: '$(Build.BinariesDirectory)\java-artifact'
displayName: 'Create final GPU Jar'

- task: PublishPipelineArtifact@1
inputs:
targetPath: '$(Build.BinariesDirectory)\java-artifact\onnxruntime-java-win-x64-gpu'
artifact: 'onnxruntime-java-gpu'
publishLocation: 'pipeline'

- template: templates/component-governance-component-detection-steps.yml
parameters :
condition : 'succeeded'


- job: Final_Jar_Testing_Windows
workspace:
clean: all
pool: 'Win-GPU-2019'
timeoutInMinutes: 60
dependsOn:
Jar_Packaging
steps:
- template: templates/set-version-number-variables-step.yml

- task: DownloadPipelineArtifact@2
displayName: 'Download Final Jar'
inputs:
buildType: 'current'
artifactName: 'onnxruntime-java-gpu'
targetPath: '$(Build.BinariesDirectory)\final-jar'

- task: BatchScript@1
displayName: 'Setup CUDA Env'
inputs:
filename: '$(Build.SourcesDirectory)\tools\ci_build\github\windows\setup_env_cuda.bat'
modifyEnvironment: true
workingFolder: '$(Build.BinariesDirectory)'

- task: CmdLine@2
inputs:
script: |
mkdir test
pushd test
jar xf $(Build.BinariesDirectory)\final-jar\testing.jar
popd
powershell -Command "Invoke-WebRequest https://oss.sonatype.org/service/local/repositories/releases/content/org/junit/platform/junit-platform-console-standalone/1.6.2/junit-platform-console-standalone-1.6.2.jar -OutFile junit-platform-console-standalone-1.6.2.jar"
powershell -Command "Invoke-WebRequest https://oss.sonatype.org/service/local/repositories/google-releases/content/com/google/protobuf/protobuf-java/3.9.2/protobuf-java-3.9.2.jar -OutFile protobuf-java-3.9.2.jar"
java -DUSE_CUDA=1 -jar junit-platform-console-standalone-1.6.2.jar -cp .;.\test;protobuf-java-3.9.2.jar;onnxruntime-gpu-$(OnnxRuntimeVersion).jar --scan-class-path --fail-if-no-tests --disable-banner
workingDirectory: '$(Build.BinariesDirectory)\final-jar'

- job: Final_Jar_Testing_Linux
workspace:
clean: all
pool: 'Linux-GPU-CUDA10'
timeoutInMinutes: 60
dependsOn:
Jar_Packaging
steps:
- template: templates/set-version-number-variables-step.yml
- task: DownloadPipelineArtifact@2
displayName: 'Download Final Jar'
inputs:
buildType: 'current'
artifactName: 'onnxruntime-java-gpu'
targetPath: '$(Build.BinariesDirectory)/final-jar'

- task: CmdLine@2
inputs:
script: |
sudo docker build --pull -t onnxruntime-centos6-gpu --build-arg BUILD_USER=onnxruntimedev --build-arg BUILD_UID=$(id -u) --build-arg PYTHON_VERSION=$(python.version) -f Dockerfile.centos6_gpu .
workingDirectory: $(Build.SourcesDirectory)/tools/ci_build/github/linux/docker

- task: CmdLine@2
inputs:
script: |
sudo docker run --gpus all -e NVIDIA_VISIBLE_DEVICES=all --rm --volume $(Build.SourcesDirectory):/onnxruntime_src --volume $(Build.BinariesDirectory):/build -e NIGHTLY_BUILD onnxruntime-centos6-gpu /onnxruntime_src/tools/ci_build/github/linux/java_linux_final_test.sh -v $(OnnxRuntimeVersion) -r /build
workingDirectory: $(Build.BinariesDirectory)/final-jar
Loading