diff --git a/.github/workflows/dev.yml b/.github/workflows/dev.yml index 816d40b..687ccd5 100644 --- a/.github/workflows/dev.yml +++ b/.github/workflows/dev.yml @@ -11,10 +11,39 @@ env: GO_VERSION: "1.22.5" jobs: + build-vnpu: + runs-on: ubuntu-22.04-arm + container: + image: ghcr.io/dsfans2014/ascend-device-plugin/ascend-lib:0.2 + steps: + - uses: actions/checkout@v4 + with: + submodules: recursive + - name: Install Rust + uses: dtolnay/rust-toolchain@stable + - name: Cache cargo + uses: Swatinem/rust-cache@v2 + - name: Build + run: cargo build --release + working-directory: ./libvnpu + - name: Prepare artifacts for upload + run: | + mkdir -p ./artifacts + cp libvnpu/target/release/limiter ./artifacts/ + cp libvnpu/target/release/libvnpu.so ./artifacts/ + echo "/vnpu/libvnpu.so" > ./artifacts/ld.so.preload + - name: upload artifacts + uses: actions/upload-artifact@v4 + with: + name: build-artifacts + if-no-files-found: error + path: ./artifacts/* + build: env: IMAGE_NAME: ${{ secrets.IMAGE_NAME || 'projecthami/ascend-device-plugin' }} runs-on: ubuntu-latest + needs: ["build-vnpu"] steps: - uses: actions/checkout@v4 with: @@ -25,6 +54,12 @@ jobs: id: branch-names uses: tj-actions/branch-names@v8 + - name: Download Artifacts + uses: actions/download-artifact@v4 + with: + name: build-artifacts + path: ./lib/hami-vnpu-core/ + - name: Set up QEMU uses: docker/setup-qemu-action@v3 @@ -34,6 +69,7 @@ jobs: - name: Build and push uses: docker/build-push-action@v6 with: + context: . platforms: linux/amd64 push: false build-args: | diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 1f90d7e..fced513 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -14,10 +14,39 @@ env: GO_VERSION: "1.22.5" jobs: + build-vnpu: + runs-on: ubuntu-22.04-arm + container: + image: ghcr.io/dsfans2014/ascend-device-plugin/ascend-lib:0.2 + steps: + - uses: actions/checkout@v4 + with: + submodules: recursive + - name: Install Rust + uses: dtolnay/rust-toolchain@stable + - name: Cache cargo + uses: Swatinem/rust-cache@v2 + - name: Build + run: cargo build --release + working-directory: ./libvnpu + - name: Prepare artifacts for upload + run: | + mkdir -p ./artifacts + cp libvnpu/target/release/limiter ./artifacts/ + cp libvnpu/target/release/libvnpu.so ./artifacts/ + echo "/vnpu/libvnpu.so" > ./artifacts/ld.so.preload + - name: upload artifacts + uses: actions/upload-artifact@v4 + with: + name: build-artifacts + if-no-files-found: error + path: ./artifacts/* + build: env: IMAGE_NAME: ${{ secrets.IMAGE_NAME || 'projecthami/ascend-device-plugin' }} runs-on: ubuntu-latest + needs: ["build-vnpu"] steps: - uses: actions/checkout@v4 with: @@ -28,6 +57,12 @@ jobs: id: branch-names uses: tj-actions/branch-names@v8 + - name: Download Artifacts + uses: actions/download-artifact@v4 + with: + name: build-artifacts + path: ./lib/hami-vnpu-core/ + - name: Set up QEMU uses: docker/setup-qemu-action@v3 @@ -44,6 +79,7 @@ jobs: uses: docker/build-push-action@v6 with: platforms: linux/amd64,linux/arm64 + context: . push: true build-args: | BASE_IMAGE=ubuntu:20.04 diff --git a/.gitmodules b/.gitmodules index eaa5629..370cf62 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,6 @@ [submodule "mind-cluster"] path = mind-cluster url = https://gitcode.com/Ascend/mind-cluster.git +[submodule "libvnpu"] + path = libvnpu + url = https://github.com/Project-HAMi/hami-vnpu-core.git diff --git a/Dockerfile b/Dockerfile index 98a00c5..baa529e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -21,6 +21,6 @@ RUN make all FROM $BASE_IMAGE ENV LD_LIBRARY_PATH=/usr/local/Ascend/driver/lib64:/usr/local/Ascend/driver/lib64/driver:/usr/local/Ascend/driver/lib64/common COPY --from=build /build/ascend-device-plugin /usr/local/bin/ascend-device-plugin -COPY ./lib/hami-vnpu-core/ /usr/local/hami-vnpu-core-assets/ +COPY --from=build /build/lib/hami-vnpu-core/* /usr/local/hami-vnpu-core-assets/ ENTRYPOINT ["ascend-device-plugin"] diff --git a/lib/hami-vnpu-core/ld.so.preload b/lib/hami-vnpu-core/ld.so.preload deleted file mode 100644 index eba2ba3..0000000 --- a/lib/hami-vnpu-core/ld.so.preload +++ /dev/null @@ -1 +0,0 @@ -/vnpu/libvnpu.so \ No newline at end of file diff --git a/lib/hami-vnpu-core/libvnpu.so b/lib/hami-vnpu-core/libvnpu.so deleted file mode 100644 index ccbbe36..0000000 Binary files a/lib/hami-vnpu-core/libvnpu.so and /dev/null differ diff --git a/lib/hami-vnpu-core/limiter b/lib/hami-vnpu-core/limiter deleted file mode 100644 index fc842ea..0000000 Binary files a/lib/hami-vnpu-core/limiter and /dev/null differ diff --git a/libvnpu b/libvnpu new file mode 160000 index 0000000..32b3bd8 --- /dev/null +++ b/libvnpu @@ -0,0 +1 @@ +Subproject commit 32b3bd821e0c513185e8b8657adb4feec9af825b