From 8ea471ed552166b8d11a671bfb823e4b4155ea0c Mon Sep 17 00:00:00 2001 From: Alexey Rivkin Date: Sun, 19 Feb 2023 20:44:27 +0200 Subject: [PATCH] AZP/RELEASE: Add ARM release - Part #3 --- bindings/java/pom.xml.in | 2 +- .../java/org/openucx/jucx/NativeLibs.java | 2 +- buildlib/az-helpers.sh | 13 ++++++ buildlib/azure-pipelines-release.yml | 24 ++++++++--- buildlib/jucx/jucx-build.yml | 41 +++++++++++++++++++ buildlib/jucx/jucx-publish.yml | 33 ++++++++++----- buildlib/jucx/jucx-test.yml | 10 +++++ 7 files changed, 108 insertions(+), 17 deletions(-) create mode 100644 buildlib/jucx/jucx-build.yml diff --git a/bindings/java/pom.xml.in b/bindings/java/pom.xml.in index 1441cf26e8bb..d8d7e995a222 100644 --- a/bindings/java/pom.xml.in +++ b/bindings/java/pom.xml.in @@ -232,7 +232,7 @@ resources - libjucx.so + libjucx_*.so diff --git a/bindings/java/src/main/java/org/openucx/jucx/NativeLibs.java b/bindings/java/src/main/java/org/openucx/jucx/NativeLibs.java index 4cc52fbd3c59..41edb38cde16 100644 --- a/bindings/java/src/main/java/org/openucx/jucx/NativeLibs.java +++ b/bindings/java/src/main/java/org/openucx/jucx/NativeLibs.java @@ -24,7 +24,7 @@ public class NativeLibs { loadLibrary(UCS); // UCS library loadLibrary(UCT); // UCT library loadLibrary(UCP); // UCP library - loadLibrary(JUCX); // JUCX native library + loadLibrary(JUCX + "_" + System.getProperty("os.arch")); // JUCX native library } public static void load() { diff --git a/buildlib/az-helpers.sh b/buildlib/az-helpers.sh index 376a3afc29ed..0e9eb30c2ef0 100644 --- a/buildlib/az-helpers.sh +++ b/buildlib/az-helpers.sh @@ -179,3 +179,16 @@ check_release_build() { echo "##vso[task.setvariable variable=Launch;isOutput=true]${launch}" } + + +# +# Return arch in the same format as Java System.getProperty("os.arch") +# +get_arch() { + arch=$(uname -m) + if [ "$arch" == "x86_64" ]; then + echo "amd64" + else + echo "$arch" + fi +} diff --git a/buildlib/azure-pipelines-release.yml b/buildlib/azure-pipelines-release.yml index 0e8b796ffd11..c2e38063f9db 100644 --- a/buildlib/azure-pipelines-release.yml +++ b/buildlib/azure-pipelines-release.yml @@ -102,9 +102,23 @@ stages: condition: eq(dependencies.Prepare.outputs['CheckRelease.Result.Launch'], 'True') jobs: - template: az-distro-release.yml - - template: jucx/jucx-publish.yml parameters: - ${{ if eq(variables['Build.Reason'], 'IndividualCI') }}: - target: publish-release - ${{ if eq(variables['Build.Reason'], 'PullRequest') }}: - target: package + name: x86_64 + demands: ucx_docker + + - template: az-distro-release.yml + parameters: + name: aarch64 + demands: ucx-arm64 + + - template: jucx/jucx-build.yml + parameters: + name: amd64 # x86_64 + container: centos7_cuda11_x86_64 + demands: ucx_docker + + - template: jucx/jucx-build.yml + parameters: + name: aarch64 # ARM + container: centos8_cuda11_aarch64 + demands: ucx-arm64 diff --git a/buildlib/jucx/jucx-build.yml b/buildlib/jucx/jucx-build.yml new file mode 100644 index 000000000000..3882eb10d32d --- /dev/null +++ b/buildlib/jucx/jucx-build.yml @@ -0,0 +1,41 @@ +parameters: + name: + container: + demands: [] + +jobs: + - job: jucx_build_${{ parameters.name }} + displayName: JUCX build ${{ parameters.name }} + + # we need to use lowest version for compatibility + container: ${{ parameters.container }} + pool: + name: MLNX + demands: ${{ parameters.demands }} + + steps: + - checkout: self + clean: true + fetchDepth: 100 + path: "we/need/to/go/deeper" + # ^workaround agent issue with container in root path + + - bash: | + set -eEx + gcc --version + ./autogen.sh + ./contrib/configure-release --with-java + displayName: Configure + + - bash: | + set -eEx + make -s -j`nproc` + mv $(Build.Repository.LocalPath)/bindings/java/resources/libjucx.so \ + $(Build.Repository.LocalPath)/bindings/java/resources/libjucx_${{ parameters.name }}.so + displayName: Build ucx + + - task: PublishBuildArtifacts@1 + inputs: + pathToPublish: '$(Build.Repository.LocalPath)/bindings/java/resources' + artifactName: libjucx_${{ parameters.name }}.so + displayName: Midterm artifact push diff --git a/buildlib/jucx/jucx-publish.yml b/buildlib/jucx/jucx-publish.yml index 7af582178b47..ca0878b48232 100644 --- a/buildlib/jucx/jucx-publish.yml +++ b/buildlib/jucx/jucx-publish.yml @@ -1,18 +1,22 @@ parameters: - temp_cfg: $(System.DefaultWorkingDirectory)/bindings/java/src/main/native/build-java/tmp-settings.xml + temp_cfg: $(System.DefaultWorkingDirectory)/bindings/java/src/main/native/tmp-settings.xml gpg_dir: $(System.DefaultWorkingDirectory)/bindings/java/src/main/native/build-java/gpg target: package jobs: - - job: jucx_release + - job: jucx_publish + displayName: JUCX publish + dependsOn: + - jucx_build_amd64 + - jucx_build_aarch64 + condition: succeeded() pool: name: MLNX - demands: - - harbor_registry -equals yes + demands: ucx_docker # we need to use lowest version for compatible - container: centos7_cuda11 + container: centos7_cuda11_x86_64 steps: - checkout: self @@ -21,16 +25,24 @@ jobs: path: "we/need/to/go/deeper" # ^workaround agent issue with container in root path + - task: DownloadBuildArtifacts@0 + displayName: Midterm artifacts get + inputs: + downloadType: 'specific' + itemPattern: 'libjucx_*.so/libjucx_*.so' + downloadPath: '$(System.DefaultWorkingDirectory)/bindings/java/resources' + - bash: | set -eEx gcc --version ./autogen.sh ./contrib/configure-release --with-java - displayName: Configure - - - bash: | - set -eEx make -s -j`nproc` + # Keep only libjucx_.so + rm -f $(Build.Repository.LocalPath)/bindings/java/resources/libjucx.so + rm $(System.DefaultWorkingDirectory)/bindings/java/src/main/native/.libs/libjucx.so* + cp $(System.DefaultWorkingDirectory)/bindings/java/resources/libjucx_*.so/libjucx_*.so \ + $(System.DefaultWorkingDirectory)/bindings/java/src/main/native/.libs/ displayName: Build ucx - bash: | @@ -56,13 +68,14 @@ jobs: name: publicKey - bash: | + echo "Build target: ${{ parameters.target }}" source buildlib/az-helpers.sh az_init_modules az_module_load dev/mvn # use the lowest supported Java version for compatibility: az_module_load dev/jdk-1.8 mvn --version - mkdir ${{ parameters.gpg_dir }} + mkdir -p ${{ parameters.gpg_dir }} export GPG_TTY=`tty` chmod 700 ${{ parameters.gpg_dir }} cp $(publicKey.secureFilePath) ${{ parameters.gpg_dir }}/pubring.gpg diff --git a/buildlib/jucx/jucx-test.yml b/buildlib/jucx/jucx-test.yml index 006656aa530f..d3864c395bef 100755 --- a/buildlib/jucx/jucx-test.yml +++ b/buildlib/jucx/jucx-test.yml @@ -32,8 +32,18 @@ jobs: ./contrib/configure-devel --prefix=$(Build.Repository.LocalPath)/install \ --with-java --enable-gtest=no --with-cuda=$have_cuda make -j`nproc` + # Rename libjucx.so per platform and relink + arch=$(get_arch) + mv $(Build.Repository.LocalPath)/bindings/java/resources/libjucx.so \ + $(Build.Repository.LocalPath)/bindings/java/resources/libjucx_"${arch}".so + mv $(Build.Repository.LocalPath)/bindings/java/src/main/native/build-java/test-classes/libjucx.so \ + $(Build.Repository.LocalPath)/bindings/java/src/main/native/build-java/test-classes/libjucx_"${arch}".so + pushd $(Build.Repository.LocalPath)/bindings/java/src/main/native/.libs/ + ln -s libjucx.so.0.0.0 libjucx_"${arch}".so + popd make install displayName: Build UCX + - bash: | set -xeE source buildlib/az-helpers.sh