From b540f97a5d5e4ac5992355aad518484216ecbb0a Mon Sep 17 00:00:00 2001 From: Yi Huang Date: Mon, 18 Aug 2025 16:37:53 +0800 Subject: [PATCH 01/49] ci: change commitlint footer-max-line-length to warning level to allow long url in messages Signed-off-by: Yi Huang --- .commitlintrc.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.commitlintrc.yml b/.commitlintrc.yml index c05bbc6..7c81c41 100644 --- a/.commitlintrc.yml +++ b/.commitlintrc.yml @@ -5,3 +5,4 @@ extends: rules: header-max-length: [1, 'always', 100] body-max-line-length: [1, 'always', 100] + footer-max-line-length: [1, 'always', 100] From 952df44707db82d5534e82cb5775dee9e3d711cb Mon Sep 17 00:00:00 2001 From: YiYing He Date: Tue, 12 Jul 2022 04:03:41 +0800 Subject: [PATCH 02/49] feat(scripts): separate the openVINO installation and WasmEdge building Signed-off-by: YiYing He Signed-off-by: Yi Huang --- scripts/wasi-nn/install-openvino.sh | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100755 scripts/wasi-nn/install-openvino.sh diff --git a/scripts/wasi-nn/install-openvino.sh b/scripts/wasi-nn/install-openvino.sh new file mode 100755 index 0000000..7c13f26 --- /dev/null +++ b/scripts/wasi-nn/install-openvino.sh @@ -0,0 +1,22 @@ +#!/usr/bin/env bash +# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +# SPDX-FileCopyrightText: 2019-2022 Second State INC + +if [[ ! -v "${OPENVINO_VERSION}" ]]; then + OPENVINO_VERSION="2021.4.582" +fi +if [[ ! -v "${OPENVINO_YEAR}" ]]; then + OPENVINO_YEAR="2021" +fi +if [[ ! -v "${CMAKE_BUILD_TYPE}" ]]; then + CMAKE_BUILD_TYPE=Release +fi + +set -e +echo "Installing OpenVINO with version ${OPENVINO_VERSION}" +curl -sSL https://apt.repos.intel.com/openvino/$OPENVINO_YEAR/GPG-PUB-KEY-INTEL-OPENVINO-$OPENVINO_YEAR | gpg --dearmor > /usr/share/keyrings/GPG-PUB-KEY-INTEL-OPENVINO-$OPENVINO_YEAR.gpg +echo "deb [signed-by=/usr/share/keyrings/GPG-PUB-KEY-INTEL-OPENVINO-$OPENVINO_YEAR.gpg] https://apt.repos.intel.com/openvino/$OPENVINO_YEAR all main" | tee /etc/apt/sources.list.d/intel-openvino-$OPENVINO_YEAR.list +apt update +apt install -y intel-openvino-runtime-ubuntu20-$OPENVINO_VERSION +source /opt/intel/openvino_2021/bin/setupvars.sh +ldconfig From f5a7b4eef9ea8b17c9c8200275acec4c2d1a7d3f Mon Sep 17 00:00:00 2001 From: YiYing He Date: Tue, 19 Jul 2022 08:37:09 +0800 Subject: [PATCH 03/49] feat(scripts): add dependencies for wasi-crypto testing Signed-off-by: YiYing He Signed-off-by: Yi Huang --- scripts/wasi-crypto/build-openssl.sh | 29 ++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100755 scripts/wasi-crypto/build-openssl.sh diff --git a/scripts/wasi-crypto/build-openssl.sh b/scripts/wasi-crypto/build-openssl.sh new file mode 100755 index 0000000..547170a --- /dev/null +++ b/scripts/wasi-crypto/build-openssl.sh @@ -0,0 +1,29 @@ +#!/usr/bin/env bash +# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +# SPDX-FileCopyrightText: 2019-2022 Second State INC + +echo "Building OpenSSL for wasi-crypto..." +# Get OpenSSL source +curl -s -L -O --remote-name-all https://www.openssl.org/source/openssl-1.1.1n.tar.gz +echo "40dceb51a4f6a5275bde0e6bf20ef4b91bfc32ed57c0552e2e8e15463372b17a openssl-1.1.1n.tar.gz" | sha256sum -c +tar -xf openssl-1.1.1n.tar.gz +cd ./openssl-1.1.1n +# OpenSSL configure need newer perl +curl -s -L -O --remote-name-all https://www.cpan.org/src/5.0/perl-5.34.0.tar.gz +tar -xf perl-5.34.0.tar.gz +cd perl-5.34.0 +mkdir localperl +./Configure -des -Dprefix=$(pwd)/localperl/ +make -j +# too long! +# make test +make install +export PATH="$(pwd)/localperl/bin/:$PATH" +cd .. +# Configure by previous perl +mkdir openssl +./perl-5.34.0/localperl/bin/perl ./config --prefix=$(pwd)/openssl --openssldir=$(pwd)/openssl +make -j +make test +make install +cd .. From b1541adea4dfe110ef484a0a4fd05c07e7327fa2 Mon Sep 17 00:00:00 2001 From: Gustavo Ye Date: Mon, 22 Aug 2022 17:04:22 +0800 Subject: [PATCH 04/49] feat(scripts): support PyTorch Backend of WASI-NN proposal Signed-off-by: Gustavo Ye --------- [WasmEdge#1654](https://github.com/WasmEdge/WasmEdge/pull/1654) Signed-off-by: Yi Huang --- scripts/wasi-nn/install-pytorch.sh | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 scripts/wasi-nn/install-pytorch.sh diff --git a/scripts/wasi-nn/install-pytorch.sh b/scripts/wasi-nn/install-pytorch.sh new file mode 100644 index 0000000..36d7551 --- /dev/null +++ b/scripts/wasi-nn/install-pytorch.sh @@ -0,0 +1,5 @@ +if [ ! -d ./libtorch ]; then + curl -s -L -O --remote-name-all https://download.pytorch.org/libtorch/lts/1.8/cpu/libtorch-cxx11-abi-shared-with-deps-1.8.2%2Bcpu.zip + echo "b76d6dd4380e2233ce6f7654e672e13aae7c871231d223a4267ef018dcbfb616 libtorch-cxx11-abi-shared-with-deps-1.8.2%2Bcpu.zip" | sha256sum -c + unzip -q "libtorch-cxx11-abi-shared-with-deps-1.8.2%2Bcpu.zip" +fi From 1385c6f9410e842889f85538034dbee526084aa7 Mon Sep 17 00:00:00 2001 From: YiYing He Date: Wed, 14 Sep 2022 21:49:59 +0800 Subject: [PATCH 05/49] chore(scripts): refine the WASI-NN pytorch scripts Signed-off-by: YiYing He Signed-off-by: Yi Huang --- scripts/wasi-nn/install-openvino.sh | 3 --- scripts/wasi-nn/install-pytorch.sh | 34 +++++++++++++++++++++++++---- 2 files changed, 30 insertions(+), 7 deletions(-) mode change 100644 => 100755 scripts/wasi-nn/install-pytorch.sh diff --git a/scripts/wasi-nn/install-openvino.sh b/scripts/wasi-nn/install-openvino.sh index 7c13f26..00d3c13 100755 --- a/scripts/wasi-nn/install-openvino.sh +++ b/scripts/wasi-nn/install-openvino.sh @@ -8,9 +8,6 @@ fi if [[ ! -v "${OPENVINO_YEAR}" ]]; then OPENVINO_YEAR="2021" fi -if [[ ! -v "${CMAKE_BUILD_TYPE}" ]]; then - CMAKE_BUILD_TYPE=Release -fi set -e echo "Installing OpenVINO with version ${OPENVINO_VERSION}" diff --git a/scripts/wasi-nn/install-pytorch.sh b/scripts/wasi-nn/install-pytorch.sh old mode 100644 new mode 100755 index 36d7551..2c8a3a7 --- a/scripts/wasi-nn/install-pytorch.sh +++ b/scripts/wasi-nn/install-pytorch.sh @@ -1,5 +1,31 @@ -if [ ! -d ./libtorch ]; then - curl -s -L -O --remote-name-all https://download.pytorch.org/libtorch/lts/1.8/cpu/libtorch-cxx11-abi-shared-with-deps-1.8.2%2Bcpu.zip - echo "b76d6dd4380e2233ce6f7654e672e13aae7c871231d223a4267ef018dcbfb616 libtorch-cxx11-abi-shared-with-deps-1.8.2%2Bcpu.zip" | sha256sum -c - unzip -q "libtorch-cxx11-abi-shared-with-deps-1.8.2%2Bcpu.zip" +#!/usr/bin/env bash +# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +# SPDX-FileCopyrightText: 2019-2022 Second State INC + +if [[ ! -n ${PYTORCH_VERSION} ]]; then + PYTORCH_VERSION="1.8.2" +fi + +if [[ ! -n ${PYTORCH_INSTALL_TO} ]]; then + PYTORCH_INSTALL_TO=. +fi + +PYTORCH_LINK="libtorch-cxx11-abi" +PYTORCH_SHA="b76d6dd4380e2233ce6f7654e672e13aae7c871231d223a4267ef018dcbfb616" + +for i in "$@"; do + case $i in + --disable-cxx11-abi) + PYTORCH_LINK="libtorch" + PYTORCH_SHA="b5ddadc9addc054d8503f4086546f0cbcfdc3fc70087863bbd7b0e3300e3247f" + shift + ;; + esac +done + +if [ ! -d ${PYTORCH_INSTALL_TO}/libtorch ]; then + curl -s -L -O --remote-name-all https://download.pytorch.org/libtorch/lts/1.8/cpu/${PYTORCH_LINK}-shared-with-deps-${PYTORCH_VERSION}%2Bcpu.zip + echo "${PYTORCH_SHA} ${PYTORCH_LINK}-shared-with-deps-${PYTORCH_VERSION}%2Bcpu.zip" | sha256sum -c + unzip -q "${PYTORCH_LINK}-shared-with-deps-${PYTORCH_VERSION}%2Bcpu.zip" -d ${PYTORCH_INSTALL_TO} + rm -f "${PYTORCH_LINK}-shared-with-deps-${PYTORCH_VERSION}%2Bcpu.zip" fi From 5700afdaf65e75a2932bf2a4fc719fa91acc9efd Mon Sep 17 00:00:00 2001 From: Gustavo Ye Date: Thu, 20 Oct 2022 13:51:01 +0800 Subject: [PATCH 06/49] feat(scripts): support tensorflow lite backend for WASI-NN Signed-off-by: Gustavo Ye --------- [WasmEdge#1846](https://github.com/WasmEdge/WasmEdge/pull/1846) Signed-off-by: Yi Huang --- scripts/wasi-nn/install-pytorch.sh | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/scripts/wasi-nn/install-pytorch.sh b/scripts/wasi-nn/install-pytorch.sh index 2c8a3a7..faec86f 100755 --- a/scripts/wasi-nn/install-pytorch.sh +++ b/scripts/wasi-nn/install-pytorch.sh @@ -15,17 +15,17 @@ PYTORCH_SHA="b76d6dd4380e2233ce6f7654e672e13aae7c871231d223a4267ef018dcbfb616" for i in "$@"; do case $i in - --disable-cxx11-abi) - PYTORCH_LINK="libtorch" - PYTORCH_SHA="b5ddadc9addc054d8503f4086546f0cbcfdc3fc70087863bbd7b0e3300e3247f" - shift - ;; + --disable-cxx11-abi) + PYTORCH_LINK="libtorch" + PYTORCH_SHA="b5ddadc9addc054d8503f4086546f0cbcfdc3fc70087863bbd7b0e3300e3247f" + shift + ;; esac done if [ ! -d ${PYTORCH_INSTALL_TO}/libtorch ]; then - curl -s -L -O --remote-name-all https://download.pytorch.org/libtorch/lts/1.8/cpu/${PYTORCH_LINK}-shared-with-deps-${PYTORCH_VERSION}%2Bcpu.zip - echo "${PYTORCH_SHA} ${PYTORCH_LINK}-shared-with-deps-${PYTORCH_VERSION}%2Bcpu.zip" | sha256sum -c - unzip -q "${PYTORCH_LINK}-shared-with-deps-${PYTORCH_VERSION}%2Bcpu.zip" -d ${PYTORCH_INSTALL_TO} - rm -f "${PYTORCH_LINK}-shared-with-deps-${PYTORCH_VERSION}%2Bcpu.zip" + curl -s -L -O --remote-name-all https://download.pytorch.org/libtorch/lts/1.8/cpu/${PYTORCH_LINK}-shared-with-deps-${PYTORCH_VERSION}%2Bcpu.zip + echo "${PYTORCH_SHA} ${PYTORCH_LINK}-shared-with-deps-${PYTORCH_VERSION}%2Bcpu.zip" | sha256sum -c + unzip -q "${PYTORCH_LINK}-shared-with-deps-${PYTORCH_VERSION}%2Bcpu.zip" -d ${PYTORCH_INSTALL_TO} + rm -f "${PYTORCH_LINK}-shared-with-deps-${PYTORCH_VERSION}%2Bcpu.zip" fi From 799b334a6a4e489cd79de2b1bbb703a052888797 Mon Sep 17 00:00:00 2001 From: Divyanshu Gupta <114072061+Mash707@users.noreply.github.com> Date: Tue, 18 Jul 2023 15:36:05 +0530 Subject: [PATCH 07/49] chore(scripts): update to OpenVINO 2023.0.0 * Changed Openvino version to 2023.0.0 * Changed InferenceEngine to OpenVINO Signed-off-by: Divyanshu GUpta --------- [WasmEdge#2636](https://github.com/WasmEdge/WasmEdge/pull/2636) Signed-off-by: Yi Huang --- scripts/wasi-nn/install-openvino.sh | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/scripts/wasi-nn/install-openvino.sh b/scripts/wasi-nn/install-openvino.sh index 00d3c13..c15b6e9 100755 --- a/scripts/wasi-nn/install-openvino.sh +++ b/scripts/wasi-nn/install-openvino.sh @@ -2,18 +2,11 @@ # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception # SPDX-FileCopyrightText: 2019-2022 Second State INC -if [[ ! -v "${OPENVINO_VERSION}" ]]; then - OPENVINO_VERSION="2021.4.582" -fi -if [[ ! -v "${OPENVINO_YEAR}" ]]; then - OPENVINO_YEAR="2021" -fi - set -e -echo "Installing OpenVINO with version ${OPENVINO_VERSION}" -curl -sSL https://apt.repos.intel.com/openvino/$OPENVINO_YEAR/GPG-PUB-KEY-INTEL-OPENVINO-$OPENVINO_YEAR | gpg --dearmor > /usr/share/keyrings/GPG-PUB-KEY-INTEL-OPENVINO-$OPENVINO_YEAR.gpg -echo "deb [signed-by=/usr/share/keyrings/GPG-PUB-KEY-INTEL-OPENVINO-$OPENVINO_YEAR.gpg] https://apt.repos.intel.com/openvino/$OPENVINO_YEAR all main" | tee /etc/apt/sources.list.d/intel-openvino-$OPENVINO_YEAR.list +echo "Installing OpenVINO with version 2023.0.0" +wget https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB +apt-key add GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB +echo "deb https://apt.repos.intel.com/openvino/2023 ubuntu20 main" | tee /etc/apt/sources.list.d/intel-openvino-2023.list apt update -apt install -y intel-openvino-runtime-ubuntu20-$OPENVINO_VERSION -source /opt/intel/openvino_2021/bin/setupvars.sh +apt-get -y install openvino ldconfig From 5373c8b500b45e51223422f346edbcc440c564fd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=AEm=20Ts=C3=BA-thu=C3=A0n?= Date: Tue, 25 Jul 2023 12:32:36 +0800 Subject: [PATCH 08/49] feat(scripts): implement OpenCV-mini MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * first draft to setup opencvmini plugin Signed-off-by: Lîm Tsú-thuàn * fix porting name Signed-off-by: Lîm Tsú-thuàn * missing include Signed-off-by: Lîm Tsú-thuàn * update to 2023 Signed-off-by: Lîm Tsú-thuàn * link opencv into plugin Signed-off-by: Lîm Tsú-thuàn * implements three functions 1. imdecode 2. imshow 3. waitkey The `cv::Mat` will be cached in a map & wasm module will only get handle instead of passing huge multi-dim array (`cv::Mat`) around the host & wasm. Signed-off-by: Lîm Tsú-thuàn * opencvmini has no need add options Signed-off-by: Lîm Tsú-thuàn * fix to be workable Signed-off-by: Lîm Tsú-thuàn * add opencvmini option Signed-off-by: Lîm Tsú-thuàn * formatting Signed-off-by: Lîm Tsú-thuàn * fixing linter problem Signed-off-by: Lîm Tsú-thuàn * add `blur` function & `imwrite` `imwrite` will put matrix into a file, and hence. we can check the transformer result `blur` do simple blurring, this is the first transformer we introduce Signed-off-by: Lîm Tsú-thuàn * implements `imencode` The function will write compressed image back into instance's buffer Signed-off-by: Lîm Tsú-thuàn * normalize function NOTE, this is a normalize function from https://github.com/WasmEdge/WasmEdge/commit/77051da4995d7318d91a82102a72ce2557151764#diff-3333d926ca87cf4285bfcd6deae45ee310307be66fca8a4ca6f0f8a946743fccR50-R54 not `cv::normalize` Signed-off-by: Lîm Tsú-thuàn * add function bilinear sampling Signed-off-by: Lîm Tsú-thuàn * release adding opencvmini Signed-off-by: Lîm Tsú-thuàn * build extensions Signed-off-by: Lîm Tsú-thuàn * add test Signed-off-by: Lîm Tsú-thuàn * cmake track testing Signed-off-by: Lîm Tsú-thuàn * metas Signed-off-by: Lîm Tsú-thuàn * install opencv Signed-off-by: Lîm Tsú-thuàn * fix release name Signed-off-by: Lîm Tsú-thuàn * fix dependencies Signed-off-by: Lîm Tsú-thuàn * fix typo in CI configuration Signed-off-by: Lîm Tsú-thuàn * fix name Signed-off-by: Lîm Tsú-thuàn * fix export functions number test Signed-off-by: Lîm Tsú-thuàn * try newer g++ Signed-off-by: Lîm Tsú-thuàn * install libopencv-dev on ubuntu Signed-off-by: Lîm Tsú-thuàn * yum can install opencv Signed-off-by: Lîm Tsú-thuàn * build and limit build thread Signed-off-by: Lîm Tsú-thuàn * retry with no sudo Signed-off-by: Lîm Tsú-thuàn * independent Signed-off-by: Lîm Tsú-thuàn * ninja Signed-off-by: Lîm Tsú-thuàn * ubuntu also use build Signed-off-by: Lîm Tsú-thuàn * extra module Signed-off-by: Lîm Tsú-thuàn * add platform exclusive, and fix naming Signed-off-by: Lîm Tsú-thuàn * remove contrib Signed-off-by: Lîm Tsú-thuàn * fix binary name Signed-off-by: Lîm Tsú-thuàn * macos missing opencv installation Signed-off-by: Lîm Tsú-thuàn * install certain version Signed-off-by: Lîm Tsú-thuàn * fix install script Signed-off-by: Lîm Tsú-thuàn * fix upload name Signed-off-by: Lîm Tsú-thuàn * fix wrong format Signed-off-by: Lîm Tsú-thuàn * outdated trick Signed-off-by: Lîm Tsú-thuàn * test if we remove devtoolset-8 Signed-off-by: Lîm Tsú-thuàn * there has no http plugin now Signed-off-by: Lîm Tsú-thuàn * remove do nothing configuration Signed-off-by: Lîm Tsú-thuàn * blur export kernel parameters Signed-off-by: Lîm Tsú-thuàn * let user can assign extension Signed-off-by: Lîm Tsú-thuàn --------- Signed-off-by: Lîm Tsú-thuàn --------- [WasmEdge#2648](https://github.com/WasmEdge/WasmEdge/pull/2648) Signed-off-by: Yi Huang --- scripts/opencvmini/install-opencvmini.sh | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 scripts/opencvmini/install-opencvmini.sh diff --git a/scripts/opencvmini/install-opencvmini.sh b/scripts/opencvmini/install-opencvmini.sh new file mode 100644 index 0000000..ac5128e --- /dev/null +++ b/scripts/opencvmini/install-opencvmini.sh @@ -0,0 +1,16 @@ +#!/usr/bin/env bash +# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +# SPDX-FileCopyrightText: 2019-2023 Second State INC + +wget -O opencv.zip https://github.com/opencv/opencv/archive/refs/tags/4.8.0.zip + +unzip opencv.zip +mv opencv-4.8.0 opencv + +mkdir -p opencv/build && cd opencv/build +# Configure +cmake -GNinja .. +# Build +cmake --build . +# Install to system +cmake --install . From 034f41295876d5a681531403bad6c608b7877f3c Mon Sep 17 00:00:00 2001 From: dm4 Date: Thu, 21 Sep 2023 17:44:16 +0800 Subject: [PATCH 09/49] fix(scripts): fix OpenVINO dependencies Signed-off-by: dm4 Signed-off-by: Yi Huang --- scripts/wasi-nn/install-openvino.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/wasi-nn/install-openvino.sh b/scripts/wasi-nn/install-openvino.sh index c15b6e9..a662437 100755 --- a/scripts/wasi-nn/install-openvino.sh +++ b/scripts/wasi-nn/install-openvino.sh @@ -8,5 +8,5 @@ wget https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS.PU apt-key add GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB echo "deb https://apt.repos.intel.com/openvino/2023 ubuntu20 main" | tee /etc/apt/sources.list.d/intel-openvino-2023.list apt update -apt-get -y install openvino +apt-get -y install openvino-2023.0.2 ldconfig From 4be4d3a08adebae210e2db316c5f4cf57cb12e1b Mon Sep 17 00:00:00 2001 From: hydai Date: Tue, 17 Oct 2023 06:46:01 +0800 Subject: [PATCH 10/49] chore(scripts): enable OpenVINO target again Signed-off-by: hydai --------- [WasmEdge#2940](https://github.com/WasmEdge/WasmEdge/pull/2940) Signed-off-by: Yi Huang --- scripts/wasi-nn/install-openvino.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/wasi-nn/install-openvino.sh b/scripts/wasi-nn/install-openvino.sh index a662437..15a8fcc 100755 --- a/scripts/wasi-nn/install-openvino.sh +++ b/scripts/wasi-nn/install-openvino.sh @@ -3,7 +3,7 @@ # SPDX-FileCopyrightText: 2019-2022 Second State INC set -e -echo "Installing OpenVINO with version 2023.0.0" +echo "Installing OpenVINO with version 2023.0.2" wget https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB apt-key add GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB echo "deb https://apt.repos.intel.com/openvino/2023 ubuntu20 main" | tee /etc/apt/sources.list.d/intel-openvino-2023.list From 94292184adcc08631e9240d5314559fbf9f099ee Mon Sep 17 00:00:00 2001 From: vincent Date: Sun, 21 Jan 2024 19:59:24 +0800 Subject: [PATCH 11/49] chore(scripts): upgrade OpenVINO to 2.0 Signed-off-by: vincent --------- [WasmEdge#3140](https://github.com/WasmEdge/WasmEdge/issues/3140) Signed-off-by: Yi Huang --- scripts/wasi-nn/install-openvino.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/wasi-nn/install-openvino.sh b/scripts/wasi-nn/install-openvino.sh index 15a8fcc..761b6a2 100755 --- a/scripts/wasi-nn/install-openvino.sh +++ b/scripts/wasi-nn/install-openvino.sh @@ -8,5 +8,5 @@ wget https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS.PU apt-key add GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB echo "deb https://apt.repos.intel.com/openvino/2023 ubuntu20 main" | tee /etc/apt/sources.list.d/intel-openvino-2023.list apt update -apt-get -y install openvino-2023.0.2 +apt-get -y install openvino-2023.2.0 ldconfig From 4a93a9521990107bb590fd5e79fa15ade6d302a0 Mon Sep 17 00:00:00 2001 From: vincent Date: Sun, 4 Feb 2024 01:02:03 +0800 Subject: [PATCH 12/49] fix(scripts): update the printed messages to match the actual installed version of OpenVINO Signed-off-by: vincent --------- [WasmEdge#3193](https://github.com/WasmEdge/WasmEdge/pull/3193) Signed-off-by: Yi Huang --- scripts/wasi-nn/install-openvino.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/wasi-nn/install-openvino.sh b/scripts/wasi-nn/install-openvino.sh index 761b6a2..57afdee 100755 --- a/scripts/wasi-nn/install-openvino.sh +++ b/scripts/wasi-nn/install-openvino.sh @@ -3,7 +3,7 @@ # SPDX-FileCopyrightText: 2019-2022 Second State INC set -e -echo "Installing OpenVINO with version 2023.0.2" +echo "Installing OpenVINO with version 2023.2.0" wget https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB apt-key add GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB echo "deb https://apt.repos.intel.com/openvino/2023 ubuntu20 main" | tee /etc/apt/sources.list.d/intel-openvino-2023.list From c4386e76854b274f2abc93fe2c50fdc8528f96a6 Mon Sep 17 00:00:00 2001 From: Hrushikesh Date: Tue, 12 Mar 2024 10:00:32 +0530 Subject: [PATCH 13/49] feat(scripts): initial support for FFmpeg * added ffmpeg to cmake Signed-off-by: Hrushi20 * error.h and avformat.h file functions Signed-off-by: Hrushi20 * fix compile error Signed-off-by: Hrushi20 * avFormatContext, avInputFormat struct fields Signed-off-by: Hrushi20 * av_best_stream, stream, mediaType Signed-off-by: Hrushi20 * avCodec, avCodecParameters, AVCodecID Signed-off-by: Hrushi20 * avRational Signed-off-by: Hrushi20 * AVPixelFormat,AVFrame Signed-off-by: Hrushi20 * clean code, refactor Signed-off-by: Hrushi20 refactor Signed-off-by: Hrushi20 * avfilter, swscale Signed-off-by: Hrushi20 * bug fix Signed-off-by: Hrushi20 * init test Signed-off-by: Hrushi20 * naming plugin Signed-off-by: Hrushi20 * AVSample Signed-off-by: Hrushi20 * AVFrame, ChannelLayout Signed-off-by: Hrushi20 * added index while fetching data AVFrame Signed-off-by: Hrushi20 * AVRational Tests Signed-off-by: Hrushi20 * swscale tests init Signed-off-by: Hrushi20 * SwsFilter, SwsVector Signed-off-by: Hrushi20 swsvector Signed-off-by: Hrushi20 * swscale tests Signed-off-by: Hrushi20 * bug fix Signed-off-by: Hrushi20 * swresample init, swresample funcs Signed-off-by: Hrushi20 added swresample funcs Signed-off-by: Hrushi20 * swresample test Signed-off-by: Hrushikesh Rao Signed-off-by: Hrushi20 * refactor based on code style, add ffmpeg to github workflow Signed-off-by: Hrushi20 added plugin to workflow Signed-off-by: Hrushi20 added option Signed-off-by: Hrushi20 * swresample util functions Signed-off-by: Hrushi20 * added avChapters, avfilter version Signed-off-by: Hrushi20 * init avDictionary Signed-off-by: Hrushi20 * build ffmpeg, liniting, add ffmpeg dependencies Signed-off-by: Hrushi20 build ffmpeg Signed-off-by: Hrushi20 added ffmpeg dependency Signed-off-by: Hrushi20 added ffmpeg dependency Signed-off-by: Hrushi20 * AvDictionary functions Signed-off-by: Hrushi20 * download sample_video_file for test Signed-off-by: Hrushi20 * AVDictionary tests Signed-off-by: Hrushi20 * init avdevice Signed-off-by: Hrushi20 * AVInputFormat, AVOutputFormat funcs Signed-off-by: Hrushi20 * avformat tests init Signed-off-by: Hrushi20 * AvChapter tests Signed-off-by: Hrushi20 * AVChapterMut functions Signed-off-by: Hrushi20 * fixed AVChapter Metatdata bug Signed-off-by: Hrushi20 * AVStream, AVStreamMut functions Signed-off-by: Hrushi20 * init/deinit network func Signed-off-by: Hrushi20 * AVStream and AVStreamMut functions Signed-off-by: Hrushi20 * AVFormatCtx Input/Output functions Signed-off-by: Hrushi20 * AvFormatCtxStruct Test funcs Signed-off-by: Hrushi20 * AVFormat Functions test Signed-off-by: Hrushi20 * Bindings for AVPictureType, AVOptionType, AVRounding, AVColor, AVChromaLocation Signed-off-by: Hrushi20 * AVTime funcs Signed-off-by: Hrushi20 * AVFrame funcs Signed-off-by: Hrushi20 * AVRounding funcs Signed-off-by: Hrushi20 * Util to initialize AVFrame in test, AVFrame tests Init Signed-off-by: Hrushi20 * AVUtil Tests added Signed-off-by: Hrushi20 * install ffmpeg dependency, nasm Signed-off-by: Hrushi20 nasm dependency Signed-off-by: Hrushi20 * update ffmpeg cmake file Signed-off-by: Hrushi20 * AVcodecCtx Video Encoder funcs Signed-off-by: Hrushi20 * AVCodecCtx Video funcs, AVSendFrame Funcs, AVReceivePkt funcs Signed-off-by: Hrushi20 * AVCodec funs Signed-off-by: Hrushi20 * AVPacket funcs, Remux funcs Signed-off-by: Hrushi20 * null checks when setting AVDict Signed-off-by: Hrushi20 * AVCodecCtx funs for Encoder Signed-off-by: Hrushi20 * AVCodecCtx decoder funcs Signed-off-by: Hrushi20 * version, config, license, fetching strings(color, pixfmt,samplefmt) Signed-off-by: Hrushi20 * AVPacket Data, AVColorPrimaries bindings Signed-off-by: Hrushi20 * AVDict Null checks, AVUtil tests Signed-off-by: Hrushi20 * Swscale tests refactor Signed-off-by: Hrushi20 * AVCodec,AVCodecParameters Test Signed-off-by: Hrushi20 * AVPacket tests Signed-off-by: Hrushi20 * AVCodec funcs test init Signed-off-by: Hrushi20 * AVCodecCtx tests Signed-off-by: Hrushi20 AVCodecCtx tests Signed-off-by: Hrushi20 * AVcodec tests Signed-off-by: Hrushi20 * AVFilter funcs Signed-off-by: Hrushi20 * AVCodecId bindings updated Signed-off-by: Hrushi20 * Enhancements/bug fixes Signed-off-by: Hrushi20 * refactor swresample tests Signed-off-by: Hrushi20 * AVFilter tests Signed-off-by: Hrushi20 Filter module tests added Signed-off-by: Hrushi20 * uncomment cmake files Signed-off-by: Hrushi20 * ffmpeg tests refactor Signed-off-by: Hrushi20 * Update install-ffmpeg script, remove relative imports, update workflow Signed-off-by: Hrushi20 import header files utils.cpp Signed-off-by: Hrushi20 brew to install ffmpeg, indentation Signed-off-by: Hrushi20 update install-ffmpeg script Signed-off-by: Hrushi20 attempt to fix PKG_CONFIG_PATH Signed-off-by: Hrushi20 attempt to fix install-ffmpeg.sh script Signed-off-by: Hrushi20 attempt to fix install-ffmpeg.sh script Signed-off-by: Hrushi20 avformat_func tests, install-ffmpeg bash script Signed-off-by: Hrushi20 update workflow file, cmake styles Signed-off-by: Hrushi20 remove relative path in tests Signed-off-by: Hrushi20 * AVFrame Audio Funcs, AVCodecFuncs Signed-off-by: Hrushi20 * Added mutex lock Signed-off-by: Hrushi20 * comment avcodec_func tests, added AVInputFormat Tests Signed-off-by: Hrushi20 * fix swscale test Signed-off-by: Hrushi20 * ChLayoutMask, SampleFmtMask, PixelMask, AVCodecFunc tests uncommented Signed-off-by: Hrushi20 * Fix CI build Signed-off-by: Hrushi20 comment avcodec_open2 test Signed-off-by: Hrushi20 comment few avcodec_func tests Signed-off-by: Hrushi20 size of malloc function, replace avdict malloc to calloc Signed-off-by: Hrushi20 attempt to fix linux build Signed-off-by: Hrushi20 fix ffmpeg lib path error Signed-off-by: Hrushi20 uncomment send packet/receive frame test, added dummy file video Signed-off-by: Hrushi20 disable gmock, fix spell-check Signed-off-by: Hrushi20 fix linter bug Signed-off-by: Hrushi20 attempt fix linux build error Signed-off-by: Hrushi20 attempt fix linux build error Signed-off-by: Hrushi20 * swscale, sampleFmt, avCodec tests Signed-off-by: Hrushi20 * use nullptr, added sv to end of string, remove unwanted spaces, update code style Signed-off-by: Hrushi20 * initialize length with 0, type casting using const_cast, uncomment avframe_data test Signed-off-by: Hrushi20 * replace memmove() with std::copy_n() Signed-off-by: Hrushi20 * replace malloc -> av_malloc, calloc -> av_mallocz Signed-off-by: Hrushi20 * fix code format Signed-off-by: Hrushi20 * added TODO to missing tests Signed-off-by: Hrushi20 * update github workflow file Signed-off-by: Hrushi20 * fix ffmpeg CI build in release mode Signed-off-by: Hrushi20 * added yasm dependency Signed-off-by: Hrushi20 * remove yasm dependency arch Signed-off-by: Hrushi20 * enable gmock Signed-off-by: Hrushi20 * comment avcodec tests Signed-off-by: Hrushi20 * uncomment avfilter tests Signed-off-by: Hrushi20 * uncomment swresample/swscale Signed-off-by: Hrushi20 * uncomment avformat tests Signed-off-by: Hrushi20 * uncomment avPacket/avCodecCtx/avCodecParameters Signed-off-by: Hrushi20 * uncomment avcodec_func Signed-off-by: Hrushi20 * attempt to fix avcodec_func tests Signed-off-by: Hrushi20 * attempt to fix avCodec tests Signed-off-by: Hrushi20 * uncomment avcodec_func tests Signed-off-by: Hrushi20 * fix coding style, decouple plugin registration Signed-off-by: Hrushi20 * build fix manylinux Signed-off-by: Hrushi20 * reasoning for av_guess_codec Signed-off-by: Hrushi20 * fix variable format, initialize variable value, append sv to string literals Signed-off-by: Hrushi20 * Trigger Build Signed-off-by: Hrushi20 * fix code style, remove redundant imports Signed-off-by: Hrushi20 * fix av_read_frame test, logging in av_format test Signed-off-by: Hrushi20 * credit for sample_video in test Signed-off-by: Hrushi20 --------- Signed-off-by: Hrushi20 Signed-off-by: Hrushikesh Rao --------- [WasmEdge#2885](https://github.com/WasmEdge/WasmEdge/pull/2885) Signed-off-by: Yi Huang --- scripts/ffmpeg/install-ffmpeg-v6.0.sh | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100755 scripts/ffmpeg/install-ffmpeg-v6.0.sh diff --git a/scripts/ffmpeg/install-ffmpeg-v6.0.sh b/scripts/ffmpeg/install-ffmpeg-v6.0.sh new file mode 100755 index 0000000..72ac145 --- /dev/null +++ b/scripts/ffmpeg/install-ffmpeg-v6.0.sh @@ -0,0 +1,13 @@ +#!/usr/bin/env bash +rm -rf FFmpeg-n6.0 ffmpeg.zip +echo $(pwd) + +curl -sL https://github.com/FFmpeg/FFmpeg/archive/refs/tags/n6.0.zip -o ffmpeg.zip + +unzip ffmpeg.zip + +mkdir -p FFmpeg-n6.0/output +cd FFmpeg-n6.0 +./configure --prefix=$(pwd)/output --enable-gpl --enable-nonfree --enable-shared --disable-static +make && make install +cd .. \ No newline at end of file From 414b580304fac60446da48e7e55c6241bbf9a3ce Mon Sep 17 00:00:00 2001 From: Yi Huang Date: Wed, 22 May 2024 18:07:55 +0800 Subject: [PATCH 14/49] chore(scripts): remove duplicated files Signed-off-by: Yi Huang --- scripts/opencvmini/install-opencvmini.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/scripts/opencvmini/install-opencvmini.sh b/scripts/opencvmini/install-opencvmini.sh index ac5128e..bd95a90 100644 --- a/scripts/opencvmini/install-opencvmini.sh +++ b/scripts/opencvmini/install-opencvmini.sh @@ -1,11 +1,12 @@ #!/usr/bin/env bash # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception # SPDX-FileCopyrightText: 2019-2023 Second State INC +OPENCV_VERSION=${OPENCV_VERSION:-4.8.0} -wget -O opencv.zip https://github.com/opencv/opencv/archive/refs/tags/4.8.0.zip +wget -O opencv.zip https://github.com/opencv/opencv/archive/refs/tags/${OPENCV_VERSION}.zip unzip opencv.zip -mv opencv-4.8.0 opencv +mv opencv-${OPENCV_VERSION} opencv mkdir -p opencv/build && cd opencv/build # Configure From b17246be4169893a90ba1267bc0874e2d9d0f7b0 Mon Sep 17 00:00:00 2001 From: Elmira <95964498+PrabhuUdurg@users.noreply.github.com> Date: Mon, 24 Jun 2024 08:05:11 +0000 Subject: [PATCH 15/49] chore(scripts): upgrade OpenVino to 2024.2.0 * Upgraded the WASI-NN OpenVino backend to 2024.2.0 Signed-off-by: Yehor Pishyi * Fixes Signed-off-by: Pishyi Yehor * Fixes Signed-off-by: Pishyi Yehor --------- Signed-off-by: Yehor Pishyi Signed-off-by: Pishyi Yehor Co-authored-by: Pishyi Yehor --------- [WasmEdge#3494](https://github.com/WasmEdge/WasmEdge/pull/3494) Signed-off-by: Yi Huang --- scripts/wasi-nn/install-openvino.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/wasi-nn/install-openvino.sh b/scripts/wasi-nn/install-openvino.sh index 57afdee..fcc9e27 100755 --- a/scripts/wasi-nn/install-openvino.sh +++ b/scripts/wasi-nn/install-openvino.sh @@ -3,10 +3,10 @@ # SPDX-FileCopyrightText: 2019-2022 Second State INC set -e -echo "Installing OpenVINO with version 2023.2.0" +echo "Installing OpenVINO with version 2024.2.0" wget https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB apt-key add GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB -echo "deb https://apt.repos.intel.com/openvino/2023 ubuntu20 main" | tee /etc/apt/sources.list.d/intel-openvino-2023.list +echo "deb https://apt.repos.intel.com/openvino/2024 ubuntu20 main" | tee /etc/apt/sources.list.d/intel-openvino-2024.list apt update -apt-get -y install openvino-2023.2.0 +apt-get -y install openvino-2024.2.0 ldconfig From 1fdd22071334893c457c28185c4456c2fd118a4c Mon Sep 17 00:00:00 2001 From: Yi Huang Date: Tue, 9 Jul 2024 17:58:55 +0800 Subject: [PATCH 16/49] feat(docker): refactor manylinux_2_28 with docker bake Signed-off-by: Yi Huang --- Dockerfile.manylinux_2_28-base | 62 ++++++++++++++++++++++++++ Dockerfile.manylinux_2_28-plugins-deps | 41 +++++++++++++++++ docker-bake.manylinux.hcl | 55 +++++++++++++++++++++++ 3 files changed, 158 insertions(+) create mode 100644 Dockerfile.manylinux_2_28-base create mode 100644 Dockerfile.manylinux_2_28-plugins-deps create mode 100644 docker-bake.manylinux.hcl diff --git a/Dockerfile.manylinux_2_28-base b/Dockerfile.manylinux_2_28-base new file mode 100644 index 0000000..ae2ea37 --- /dev/null +++ b/Dockerfile.manylinux_2_28-base @@ -0,0 +1,62 @@ +# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +# SPDX-FileCopyrightText: 2019-2022 Second State INC + +ARG BASE_IMAGE +FROM ${BASE_IMAGE} + +MAINTAINER hydai hydai@secondstate.io + +ADD SHA256SUM.manylinux_2_28 /root/ + +# See /opt/rh/gcc-toolset-13/enable +ENV PATH=/opt/rh/gcc-toolset-13/root/usr/bin${PATH:+:${PATH}} +ENV MANPATH=/opt/rh/gcc-toolset-13/root/usr/share/man${MANPATH:+:${MANPATH}} +ENV INFOPATH=/opt/rh/gcc-toolset-13/root/usr/share/info${INFOPATH:+:${INFOPATH}} +ENV LD_LIBRARY_PATH=/opt/rh/gcc-toolset-13/root/usr/lib64:/opt/rh/gcc-toolset-13/root/usr/lib:${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}} +ENV PKG_CONFIG_PATH=/opt/rh/gcc-toolset-13/root/usr/lib64/pkgconfig${PKG_CONFIG_PATH:+:${PKG_CONFIG_PATH}} + +ARG LLVM_TARGETS LLVM_TRIPLE + +RUN cd && (yum check-update || true) && yum install -y openssl-devel rpm-build cmake yum-utils && \ + yum-config-manager --add-repo https://cli.github.com/packages/rpm/gh-cli.repo && \ + yum install -y gcc-toolset-13 && \ + export CPU=$(/opt/python/cp311-cp311/bin/python3 -c \ + 'import multiprocessing; print(multiprocessing.cpu_count())') && \ + export CFGFLAGS="--prefix=/opt/rh/gcc-toolset-13/root/usr --disable-shared --libdir=/opt/rh/gcc-toolset-13/root/usr/lib64" && \ + curl -s -L -O --remote-name-all \ + https://github.com/ninja-build/ninja/archive/refs/tags/v1.11.1.tar.gz \ + https://github.com/llvm/llvm-project/releases/download/llvmorg-17.0.6/llvm-17.0.6.src.tar.xz \ + https://github.com/llvm/llvm-project/releases/download/llvmorg-17.0.6/lld-17.0.6.src.tar.xz \ + https://github.com/llvm/llvm-project/releases/download/llvmorg-17.0.6/libunwind-17.0.6.src.tar.xz \ + https://github.com/llvm/llvm-project/releases/download/llvmorg-17.0.6/cmake-17.0.6.src.tar.xz \ + https://github.com/llvm/llvm-project/releases/download/llvmorg-17.0.6/third-party-17.0.6.src.tar.xz \ + https://github.com/llvm/llvm-project/releases/download/llvmorg-17.0.6/clang-17.0.6.src.tar.xz && \ + sha256sum -c SHA256SUM.manylinux_2_28 && \ + gzip -dc v1.11.1.tar.gz | tar -xf - && \ + xz -dc llvm-17.0.6.src.tar.xz | tar -xf - && \ + xz -dc lld-17.0.6.src.tar.xz | tar -xf - && \ + xz -dc libunwind-17.0.6.src.tar.xz | tar -xf - && \ + xz -dc cmake-17.0.6.src.tar.xz | tar -xf - && \ + xz -dc third-party-17.0.6.src.tar.xz | tar -xf - && \ + xz -dc clang-17.0.6.src.tar.xz | tar -xf - && \ + export ZSTDFLAGS=(PREFIX=/opt/rh/gcc-toolset-13/root/usr LIBDIR=/opt/rh/gcc-toolset-13/root/usr/lib64 SED_ERE_OPT=--regexp-extended MOREFLAGS="-std=c17 -O3 -fPIC -fPIE -fvisibility=hidden") && \ + mkdir build && cd build && /opt/python/cp311-cp311/bin/python \ + ../ninja-1.11.1/configure.py --bootstrap \ + --with-python=/opt/python/cp311-cp311/bin/python && \ + cp -v ninja /opt/rh/gcc-toolset-13/root/usr/bin/ninja && cd - && rm -rf build && \ + mv -v llvm-17.0.6.src llvm && \ + mv -v lld-17.0.6.src lld && \ + mv -v libunwind-17.0.6.src libunwind && \ + mv -v cmake-17.0.6.src cmake && \ + mv -v third-party-17.0.6.src third-party && \ + mv -v clang-17.0.6.src clang && \ + cmake -Bbuild -GNinja -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_INSTALL_PREFIX=/opt/rh/gcc-toolset-13/root/usr \ + -DPython3_ROOT_DIR=/opt/python/cp311-cp311 -DLLVM_LIBDIR_SUFFIX=64 \ + -DLLVM_TARGETS_TO_BUILD="${LLVM_TARGETS}" -DLLVM_ENABLE_PROJECTS="lld;clang" \ + -DLLVM_DEFAULT_TARGET_TRIPLE="${LLVM_TRIPLE}" \ + -DBUILD_SHARED_LIBS=OFF llvm && \ + cmake --build build --target install && \ + rm -rf build && rm -rf * + +RUN yum clean all diff --git a/Dockerfile.manylinux_2_28-plugins-deps b/Dockerfile.manylinux_2_28-plugins-deps new file mode 100644 index 0000000..066d2d9 --- /dev/null +++ b/Dockerfile.manylinux_2_28-plugins-deps @@ -0,0 +1,41 @@ +ARG BASE_IMAGE +FROM ${BASE_IMAGE} as base + +WORKDIR /root + +### deps for x86_64 ### +FROM base AS deps-amd64 +RUN cd && (yum check-update || true) && \ + yum install -y wget unzip zlib-devel zlib-static elfutils-libelf-devel + +COPY wasi-nn/install-pytorch.sh . +ENV PYTORCH_VERSION="1.8.2" +ENV PYTORCH_INSTALL_TO="/root" +ENV Torch_DIR="/root/libtorch" +RUN [ "/bin/bash", "install-pytorch.sh" ] + +### deps for aarch64 ### +FROM base AS deps-arm64 +RUN cd && (yum check-update || true) && \ + yum install -y wget unzip zlib-devel zlib-static + +### deps for all ### +FROM deps-${TARGETARCH} as final + +COPY opencvmini/install-opencvmini.sh . +ENV OPENCV_VERSION="4.8.0" +RUN [ "/bin/bash", "install-opencvmini.sh" ] + +COPY wasi-crypto/build-openssl.sh . +ENV OpenSSL_DIR="/root/openssl-1.1.1n/openssl" +RUN [ "/bin/bash", "build-openssl.sh" ] + +COPY ffmpeg/install-ffmpeg-v6.0.sh . +RUN [ "/bin/bash", "install-ffmpeg-v6.0.sh" ] +ENV PKG_CONFIG_PATH=/root/FFmpeg-n6.0/output/lib/pkgconfig${PKG_CONFIG_PATH:+:${PKG_CONFIG_PATH}} +ENV LD_LIBRARY_PATH=/root/FFmpeg-n6.0/output/lib${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}} + +ENV OPENVINO_VERSION="2024.2.0" +ENV OPENVINO_YEAR="2024" + +RUN yum clean all diff --git a/docker-bake.manylinux.hcl b/docker-bake.manylinux.hcl new file mode 100644 index 0000000..306081c --- /dev/null +++ b/docker-bake.manylinux.hcl @@ -0,0 +1,55 @@ +target "base" { + dockerfile = "Dockerfile.manylinux_2_28-base" + context = "./utils/docker" +} + +target "plugins-base" { + dockerfile = "./docker/Dockerfile.manylinux_2_28-plugins-deps" + context = "./utils" +} + +target "x86_64" { + inherits = ["base"] + platforms = ["linux/amd64"] + tags = ["wasmedge/wasmedge:manylinux_2_28_x86_64"] + args = { + BASE_IMAGE = "quay.io/pypa/manylinux_2_28_x86_64", + LLVM_TARGETS = "X86;BPF", + LLVM_TRIPLE = "x86_64-pc-linux-gnu" + } +} + +target "x86_64-plugins" { + inherits = ["plugins-base"] + platforms = ["linux/amd64"] + tags = ["wasmedge/wasmedge:manylinux_2_28_x86_64-plugins-deps"] + contexts = { + "wasmedge/wasmedge:manylinux_2_28_x86_64"= "target:x86_64" + } + args = { + BASE_IMAGE = "wasmedge/wasmedge:manylinux_2_28_x86_64" + } +} + +target "aarch64" { + inherits = ["base"] + platforms = ["linux/arm64"] + tags = ["wasmedge/wasmedge:manylinux_2_28_aarch64"] + args = { + BASE_IMAGE = "quay.io/pypa/manylinux_2_28_aarch64", + LLVM_TARGETS = "AArch64;BPF", + LLVM_TRIPLE = "aarch64-redhat-linux-gnu" + } +} + +target "aarch64-plugins" { + inherits = ["plugins-base"] + platforms = ["linux/arm64"] + tags = ["wasmedge/wasmedge:manylinux_2_28_aarch64-plugins-deps"] + contexts = { + "wasmedge/wasmedge:manylinux_2_28_aarch64" = "target:aarch64" + } + args = { + BASE_IMAGE = "wasmedge/wasmedge:manylinux_2_28_aarch64" + } +} From c45df8994ed075f6bffbd4060d3109c56f0598a0 Mon Sep 17 00:00:00 2001 From: hydai Date: Sat, 27 Jul 2024 06:14:27 +0800 Subject: [PATCH 17/49] chore(lint): append EOF via linelint Signed-off-by: hydai Signed-off-by: Yi Huang --- scripts/ffmpeg/install-ffmpeg-v6.0.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/ffmpeg/install-ffmpeg-v6.0.sh b/scripts/ffmpeg/install-ffmpeg-v6.0.sh index 72ac145..479908c 100755 --- a/scripts/ffmpeg/install-ffmpeg-v6.0.sh +++ b/scripts/ffmpeg/install-ffmpeg-v6.0.sh @@ -10,4 +10,4 @@ mkdir -p FFmpeg-n6.0/output cd FFmpeg-n6.0 ./configure --prefix=$(pwd)/output --enable-gpl --enable-nonfree --enable-shared --disable-static make && make install -cd .. \ No newline at end of file +cd .. From 707076779dbc1d75044da7fa35e736ef1ab04524 Mon Sep 17 00:00:00 2001 From: PeterD1524 <53310459+PeterD1524@users.noreply.github.com> Date: Tue, 30 Jul 2024 15:55:21 +0800 Subject: [PATCH 18/49] chore(scripts): fix piper dependencies * update piper patch to support static linking piper-phonemize and espeak-ng and support using system onnxruntime Signed-off-by: PeterD1524 * force BUILD_SHARED_LIBS OFF and CMAKE_POSITION_INDEPENDENT_CODE ON for piper Signed-off-by: PeterD1524 * avoid unwanted targets from piper Signed-off-by: PeterD1524 * add onnxruntime install script Signed-off-by: PeterD1524 * update piper patch to use PRIVATE scope for target-specific commands to avoid include and link pollution Signed-off-by: PeterD1524 * add clean include directory for piper disable tests for piper_phonemize use normal variable instead of CACHE for piper FetchContent Signed-off-by: PeterD1524 * remove unnecessary target_include_directories Signed-off-by: PeterD1524 * install onnxruntime in workflow Signed-off-by: PeterD1524 * remove the `-ubuntu` suffix because this should also be used in the manylinux(CentOS) distributions Signed-off-by: PeterD1524 * remove redundant lines will be done later by `wasmedge_setup_wasinn_target(wasmedgePluginWasiNN)` Signed-off-by: PeterD1524 * find onnxruntime early and fail if not found Signed-off-by: PeterD1524 --------- Signed-off-by: PeterD1524 --------- [WasmEdge#3583](https://github.com/WasmEdge/WasmEdge/pull/3583) Signed-off-by: Yi Huang --- scripts/wasi-nn/install-onnxruntime.sh | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 scripts/wasi-nn/install-onnxruntime.sh diff --git a/scripts/wasi-nn/install-onnxruntime.sh b/scripts/wasi-nn/install-onnxruntime.sh new file mode 100644 index 0000000..61c2acb --- /dev/null +++ b/scripts/wasi-nn/install-onnxruntime.sh @@ -0,0 +1,14 @@ +#!/usr/bin/env bash + +set -e + +: ${ONNXRUNTIME_VERSION:=1.14.1} + +ONNXRUNTIME_NAME="onnxruntime-linux-x64-${ONNXRUNTIME_VERSION}" +ONNXRUNTIME_TGZ="${ONNXRUNTIME_NAME}.tgz" + +curl -LO "https://github.com/microsoft/onnxruntime/releases/download/v${ONNXRUNTIME_VERSION}/${ONNXRUNTIME_TGZ}" +tar zxf "${ONNXRUNTIME_TGZ}" +mv "${ONNXRUNTIME_NAME}/include/"* /usr/local/include/ +mv "${ONNXRUNTIME_NAME}/lib/"* /usr/local/lib/ +rm -rf "${ONNXRUNTIME_TGZ}" "${ONNXRUNTIME_NAME}" From ffa2171ef3a68a40eb58aced5f27c1d39c49f48f Mon Sep 17 00:00:00 2001 From: PeterD1524 <53310459+PeterD1524@users.noreply.github.com> Date: Mon, 5 Aug 2024 14:39:18 +0800 Subject: [PATCH 19/49] feat(scripts): install onnxruntime in manylinux_2_28-plugins-deps for WASI-NN Piper * install onnxruntime in manylinux_2_28-plugins-deps for WASI-NN Piper CI Signed-off-by: PeterD1524 * update utils/wasi-nn/install-onnxruntime.sh to support both x86_64 and aarch64 Signed-off-by: PeterD1524 --------- Signed-off-by: PeterD1524 --------- [WasmEdge#3622](https://github.com/WasmEdge/WasmEdge/pull/3622) Signed-off-by: Yi Huang --- Dockerfile.manylinux_2_28-plugins-deps | 3 +++ scripts/wasi-nn/install-onnxruntime.sh | 13 ++++++++++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/Dockerfile.manylinux_2_28-plugins-deps b/Dockerfile.manylinux_2_28-plugins-deps index 066d2d9..1f907cb 100644 --- a/Dockerfile.manylinux_2_28-plugins-deps +++ b/Dockerfile.manylinux_2_28-plugins-deps @@ -38,4 +38,7 @@ ENV LD_LIBRARY_PATH=/root/FFmpeg-n6.0/output/lib${LD_LIBRARY_PATH:+:${LD_LIBRARY ENV OPENVINO_VERSION="2024.2.0" ENV OPENVINO_YEAR="2024" +COPY wasi-nn/install-onnxruntime.sh . +RUN [ "/bin/bash", "install-onnxruntime.sh" ] + RUN yum clean all diff --git a/scripts/wasi-nn/install-onnxruntime.sh b/scripts/wasi-nn/install-onnxruntime.sh index 61c2acb..3ff011e 100644 --- a/scripts/wasi-nn/install-onnxruntime.sh +++ b/scripts/wasi-nn/install-onnxruntime.sh @@ -2,9 +2,18 @@ set -e +case "$(uname -m)" in + 'x86_64') ARCH='x64' ;; + 'aarch64') ARCH='aarch64' ;; + *) + echo 'Cannot determine architecture for onnxruntime' >&2 + exit 1 + ;; +esac + : ${ONNXRUNTIME_VERSION:=1.14.1} -ONNXRUNTIME_NAME="onnxruntime-linux-x64-${ONNXRUNTIME_VERSION}" +ONNXRUNTIME_NAME="onnxruntime-linux-${ARCH}-${ONNXRUNTIME_VERSION}" ONNXRUNTIME_TGZ="${ONNXRUNTIME_NAME}.tgz" curl -LO "https://github.com/microsoft/onnxruntime/releases/download/v${ONNXRUNTIME_VERSION}/${ONNXRUNTIME_TGZ}" @@ -12,3 +21,5 @@ tar zxf "${ONNXRUNTIME_TGZ}" mv "${ONNXRUNTIME_NAME}/include/"* /usr/local/include/ mv "${ONNXRUNTIME_NAME}/lib/"* /usr/local/lib/ rm -rf "${ONNXRUNTIME_TGZ}" "${ONNXRUNTIME_NAME}" + +ldconfig From 253f51aad81b3d49f48b622be0179383cab60b70 Mon Sep 17 00:00:00 2001 From: Yi-Ying He Date: Wed, 7 Aug 2024 22:53:22 +0800 Subject: [PATCH 20/49] chore(scripts): update the file copyright text and lint Signed-off-by: YiYing He --------- [WasmEdge#3629](https://github.com/WasmEdge/WasmEdge/pull/3629) Signed-off-by: Yi Huang --- Dockerfile.manylinux_2_28-base | 2 +- scripts/opencvmini/install-opencvmini.sh | 2 +- scripts/wasi-crypto/build-openssl.sh | 2 +- scripts/wasi-nn/install-onnxruntime.sh | 2 ++ scripts/wasi-nn/install-openvino.sh | 2 +- scripts/wasi-nn/install-pytorch.sh | 2 +- 6 files changed, 7 insertions(+), 5 deletions(-) diff --git a/Dockerfile.manylinux_2_28-base b/Dockerfile.manylinux_2_28-base index ae2ea37..7166f1f 100644 --- a/Dockerfile.manylinux_2_28-base +++ b/Dockerfile.manylinux_2_28-base @@ -1,5 +1,5 @@ # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -# SPDX-FileCopyrightText: 2019-2022 Second State INC +# SPDX-FileCopyrightText: 2019-2024 Second State INC ARG BASE_IMAGE FROM ${BASE_IMAGE} diff --git a/scripts/opencvmini/install-opencvmini.sh b/scripts/opencvmini/install-opencvmini.sh index bd95a90..799f738 100644 --- a/scripts/opencvmini/install-opencvmini.sh +++ b/scripts/opencvmini/install-opencvmini.sh @@ -1,6 +1,6 @@ #!/usr/bin/env bash # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -# SPDX-FileCopyrightText: 2019-2023 Second State INC +# SPDX-FileCopyrightText: 2019-2024 Second State INC OPENCV_VERSION=${OPENCV_VERSION:-4.8.0} wget -O opencv.zip https://github.com/opencv/opencv/archive/refs/tags/${OPENCV_VERSION}.zip diff --git a/scripts/wasi-crypto/build-openssl.sh b/scripts/wasi-crypto/build-openssl.sh index 547170a..45d628b 100755 --- a/scripts/wasi-crypto/build-openssl.sh +++ b/scripts/wasi-crypto/build-openssl.sh @@ -1,6 +1,6 @@ #!/usr/bin/env bash # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -# SPDX-FileCopyrightText: 2019-2022 Second State INC +# SPDX-FileCopyrightText: 2019-2024 Second State INC echo "Building OpenSSL for wasi-crypto..." # Get OpenSSL source diff --git a/scripts/wasi-nn/install-onnxruntime.sh b/scripts/wasi-nn/install-onnxruntime.sh index 3ff011e..dad1fb5 100644 --- a/scripts/wasi-nn/install-onnxruntime.sh +++ b/scripts/wasi-nn/install-onnxruntime.sh @@ -1,4 +1,6 @@ #!/usr/bin/env bash +# SPDX-License-Identifier: Apache-2.0 +# SPDX-FileCopyrightText: 2019-2024 Second State INC set -e diff --git a/scripts/wasi-nn/install-openvino.sh b/scripts/wasi-nn/install-openvino.sh index fcc9e27..10a3d08 100755 --- a/scripts/wasi-nn/install-openvino.sh +++ b/scripts/wasi-nn/install-openvino.sh @@ -1,6 +1,6 @@ #!/usr/bin/env bash # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -# SPDX-FileCopyrightText: 2019-2022 Second State INC +# SPDX-FileCopyrightText: 2019-2024 Second State INC set -e echo "Installing OpenVINO with version 2024.2.0" diff --git a/scripts/wasi-nn/install-pytorch.sh b/scripts/wasi-nn/install-pytorch.sh index faec86f..f3fd070 100755 --- a/scripts/wasi-nn/install-pytorch.sh +++ b/scripts/wasi-nn/install-pytorch.sh @@ -1,6 +1,6 @@ #!/usr/bin/env bash # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -# SPDX-FileCopyrightText: 2019-2022 Second State INC +# SPDX-FileCopyrightText: 2019-2024 Second State INC if [[ ! -n ${PYTORCH_VERSION} ]]; then PYTORCH_VERSION="1.8.2" From 6383097b3768f048931c65a75261eb2b4cc43105 Mon Sep 17 00:00:00 2001 From: Yi Huang Date: Wed, 21 Aug 2024 20:42:12 +0800 Subject: [PATCH 21/49] feat(docker,ubuntu): refactor with docker bake Signed-off-by: Yi Huang --- Dockerfile.ubuntu-base | 43 ++++++++++++++++++++++++++ Dockerfile.ubuntu-plugins-deps | 13 ++++++++ docker-bake.ubuntu.hcl | 56 ++++++++++++++++++++++++++++++++++ 3 files changed, 112 insertions(+) create mode 100644 Dockerfile.ubuntu-base create mode 100644 Dockerfile.ubuntu-plugins-deps create mode 100644 docker-bake.ubuntu.hcl diff --git a/Dockerfile.ubuntu-base b/Dockerfile.ubuntu-base new file mode 100644 index 0000000..18009a7 --- /dev/null +++ b/Dockerfile.ubuntu-base @@ -0,0 +1,43 @@ +ARG TOOLCHAIN=clang +FROM ubuntu:22.04 AS base + +ENV DEBIAN_FRONTEND=noninteractive +RUN apt-get update && \ + apt-get upgrade -y && \ + apt-get install -y \ + cmake \ + curl \ + dpkg-dev \ + git \ + llvm-15-dev \ + liblld-15-dev \ + ninja-build \ + software-properties-common \ + wget \ + zlib1g-dev + +### deps for clang ### +FROM base AS deps-clang + +RUN apt-get update && \ + apt-get install -y \ + clang-15 + +ENV CC=/usr/bin/clang-15 +ENV CXX=/usr/bin/clang++-15 + +### deps for gcc ### +FROM base AS deps-gcc + +RUN apt-get update && \ + apt-get install -y \ + gcc \ + g++ + +ENV CC=gcc +ENV CXX=g++ + +### deps for all ### +FROM deps-${TOOLCHAIN} AS final + +RUN rm -rf /var/lib/apt/lists/* diff --git a/Dockerfile.ubuntu-plugins-deps b/Dockerfile.ubuntu-plugins-deps new file mode 100644 index 0000000..a10ccec --- /dev/null +++ b/Dockerfile.ubuntu-plugins-deps @@ -0,0 +1,13 @@ +ARG BASE_IMAGE=wasmedge/wasmedge:latest +FROM ${BASE_IMAGE} AS base + +RUN apt-get update && \ + apt-get install -y \ + unzip \ + wget + +COPY opencvmini/install-opencvmini.sh . +ENV OPENCV_VERSION="4.8.0" +RUN [ "/bin/bash", "install-opencvmini.sh" ] + +RUN rm -rf /var/lib/apt/lists/* diff --git a/docker-bake.ubuntu.hcl b/docker-bake.ubuntu.hcl new file mode 100644 index 0000000..eb3a534 --- /dev/null +++ b/docker-bake.ubuntu.hcl @@ -0,0 +1,56 @@ +group "default" { + targets = [ + "clang", + "clang-plugins", + "gcc", + "gcc-plugins" + ] +} + +target "base" { + dockerfile = "Dockerfile.ubuntu-base" + context = "./utils/docker" +} + +target "plugins-base" { + dockerfile = "./docker/Dockerfile.ubuntu-plugins-deps" + context = "./utils" +} + +target "clang" { + inherits = ["base"] + tags = [ + "wasmedge/wasmedge:latest", + "wasmedge/wasmedge:ubuntu-build-clang" + ] +} + +target "clang-plugins" { + inherits = ["plugins-base"] + tags = ["wasmedge/wasmedge:ubuntu-build-clang-plugins-deps"] + contexts = { + "wasmedge/wasmedge:ubuntu-build-clang" = "target:base" + } + args = { + BASE_IMAGE = "wasmedge/wasmedge:ubuntu-build-clang" + } +} + +target "gcc" { + inherits = ["base"] + tags = ["wasmedge/wasmedge:ubuntu-build-gcc"] + args = { + TOOLCHAIN = "gcc" + } +} + +target "gcc-plugins" { + inherits = ["plugins-base"] + tags = ["wasmedge/wasmedge:ubuntu-build-gcc-plugins-deps"] + contexts = { + "wasmedge/wasmedge:ubuntu-build-gcc" = "target:base" + } + args = { + BASE_IMAGE = "wasmedge/wasmedge:ubuntu-build-gcc" + } +} From 6108c0ade68863f337eac47e64fa4a9e402978cd Mon Sep 17 00:00:00 2001 From: Yi Huang Date: Wed, 21 Aug 2024 19:43:16 +0800 Subject: [PATCH 22/49] fix(docker,manylinux): fix warnings - FromAsCasing - InvalidDefaultArgInFrom - MaintainerDeprecated Signed-off-by: Yi Huang --- Dockerfile.manylinux_2_28-base | 5 +---- Dockerfile.manylinux_2_28-plugins-deps | 6 +++--- docker-bake.manylinux.hcl | 4 ---- 3 files changed, 4 insertions(+), 11 deletions(-) diff --git a/Dockerfile.manylinux_2_28-base b/Dockerfile.manylinux_2_28-base index 7166f1f..30b64c3 100644 --- a/Dockerfile.manylinux_2_28-base +++ b/Dockerfile.manylinux_2_28-base @@ -1,11 +1,8 @@ # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception # SPDX-FileCopyrightText: 2019-2024 Second State INC - -ARG BASE_IMAGE +ARG BASE_IMAGE="quay.io/pypa/manylinux_2_28_x86_64" FROM ${BASE_IMAGE} -MAINTAINER hydai hydai@secondstate.io - ADD SHA256SUM.manylinux_2_28 /root/ # See /opt/rh/gcc-toolset-13/enable diff --git a/Dockerfile.manylinux_2_28-plugins-deps b/Dockerfile.manylinux_2_28-plugins-deps index 1f907cb..ec7be56 100644 --- a/Dockerfile.manylinux_2_28-plugins-deps +++ b/Dockerfile.manylinux_2_28-plugins-deps @@ -1,5 +1,5 @@ -ARG BASE_IMAGE -FROM ${BASE_IMAGE} as base +ARG BASE_IMAGE="wasmedge/wasmedge:manylinux_2_28_x86_64" +FROM ${BASE_IMAGE} AS base WORKDIR /root @@ -20,7 +20,7 @@ RUN cd && (yum check-update || true) && \ yum install -y wget unzip zlib-devel zlib-static ### deps for all ### -FROM deps-${TARGETARCH} as final +FROM deps-${TARGETARCH} AS final COPY opencvmini/install-opencvmini.sh . ENV OPENCV_VERSION="4.8.0" diff --git a/docker-bake.manylinux.hcl b/docker-bake.manylinux.hcl index 306081c..0d122ff 100644 --- a/docker-bake.manylinux.hcl +++ b/docker-bake.manylinux.hcl @@ -13,7 +13,6 @@ target "x86_64" { platforms = ["linux/amd64"] tags = ["wasmedge/wasmedge:manylinux_2_28_x86_64"] args = { - BASE_IMAGE = "quay.io/pypa/manylinux_2_28_x86_64", LLVM_TARGETS = "X86;BPF", LLVM_TRIPLE = "x86_64-pc-linux-gnu" } @@ -26,9 +25,6 @@ target "x86_64-plugins" { contexts = { "wasmedge/wasmedge:manylinux_2_28_x86_64"= "target:x86_64" } - args = { - BASE_IMAGE = "wasmedge/wasmedge:manylinux_2_28_x86_64" - } } target "aarch64" { From 70e9f0528ea85c996b55d828c28ea8de6ecdd04e Mon Sep 17 00:00:00 2001 From: Yi Date: Tue, 27 Aug 2024 02:21:34 +0800 Subject: [PATCH 23/49] feat(docker,ubuntu): add ubuntu 20.04 to bake list Signed-off-by: Yi Huang --------- [WasmEdge#3694](https://github.com/WasmEdge/WasmEdge/pull/3694) Signed-off-by: Yi Huang --- docker-bake.ubuntu.hcl | 80 ++++++++++++++++++++++++------------------ 1 file changed, 45 insertions(+), 35 deletions(-) diff --git a/docker-bake.ubuntu.hcl b/docker-bake.ubuntu.hcl index eb3a534..6f6a5af 100644 --- a/docker-bake.ubuntu.hcl +++ b/docker-bake.ubuntu.hcl @@ -1,56 +1,66 @@ group "default" { targets = [ - "clang", - "clang-plugins", - "gcc", - "gcc-plugins" + "base", + "latest", + "plugins" ] } +function "name" { + params = [toolchain, ubuntu] + result = "${toolchain}-ubuntu${replace(ubuntu, ".", "")}" +} + +function "tag" { + params = [toolchain, ubuntu] + result = equal(ubuntu, "22.04") ? "ubuntu-build-${toolchain}" : "ubuntu-${ubuntu}-build-${toolchain}" +} + +variable "matrix" { + default = { + toolchain = ["clang", "gcc"] + ubuntu = ["20.04", "22.04"] + } +} + target "base" { + matrix = matrix + name = name(toolchain, ubuntu) + dockerfile = "Dockerfile.ubuntu-base" context = "./utils/docker" + + tags = ["wasmedge/wasmedge:${tag(toolchain, ubuntu)}"] + args = { + TOOLCHAIN = toolchain + } } -target "plugins-base" { +target "plugins" { + matrix = matrix + name = "${name(toolchain, ubuntu)}-plugins" + dockerfile = "./docker/Dockerfile.ubuntu-plugins-deps" context = "./utils" -} - -target "clang" { - inherits = ["base"] - tags = [ - "wasmedge/wasmedge:latest", - "wasmedge/wasmedge:ubuntu-build-clang" - ] -} -target "clang-plugins" { - inherits = ["plugins-base"] - tags = ["wasmedge/wasmedge:ubuntu-build-clang-plugins-deps"] - contexts = { - "wasmedge/wasmedge:ubuntu-build-clang" = "target:base" - } - args = { - BASE_IMAGE = "wasmedge/wasmedge:ubuntu-build-clang" + contexts = { + "wasmedge/wasmedge:${tag(toolchain, ubuntu)}" = "target:${name(toolchain, ubuntu)}" } -} -target "gcc" { - inherits = ["base"] - tags = ["wasmedge/wasmedge:ubuntu-build-gcc"] - args = { - TOOLCHAIN = "gcc" + tags = ["wasmedge/wasmedge:${tag(toolchain, ubuntu)}-plugins-deps"] + args = { + BASE_IMAGE = "wasmedge/wasmedge:${tag(toolchain, ubuntu)}" } } -target "gcc-plugins" { - inherits = ["plugins-base"] - tags = ["wasmedge/wasmedge:ubuntu-build-gcc-plugins-deps"] - contexts = { - "wasmedge/wasmedge:ubuntu-build-gcc" = "target:base" +target "latest" { + matrix = { + toolchain = ["clang"] + ubuntu = ["22.04"] } - args = { - BASE_IMAGE = "wasmedge/wasmedge:ubuntu-build-gcc" + inherits = ["${name(toolchain, ubuntu)}"] + contexts = { + "wasmedge/wasmedge:${tag(toolchain, ubuntu)}" = "target:${name(toolchain, ubuntu)}" } + tags = ["wasmedge/wasmedge:latest"] } From 44e2aa825f6ba7dd800d8269aa732bb2b23ee0b8 Mon Sep 17 00:00:00 2001 From: Yi Date: Wed, 28 Aug 2024 21:17:38 +0800 Subject: [PATCH 24/49] feat(docker,ubuntu): apply ubuntu version from bake file Signed-off-by: Yi Huang --------- [WasmEdge#3703](https://github.com/WasmEdge/WasmEdge/pull/3703) Signed-off-by: Yi Huang --- Dockerfile.ubuntu-base | 54 ++++++++++++++++++++++++++++++++---------- docker-bake.ubuntu.hcl | 3 ++- 2 files changed, 44 insertions(+), 13 deletions(-) diff --git a/Dockerfile.ubuntu-base b/Dockerfile.ubuntu-base index 18009a7..195dd4a 100644 --- a/Dockerfile.ubuntu-base +++ b/Dockerfile.ubuntu-base @@ -1,5 +1,6 @@ +ARG UBUNTU_VER=22 ARG TOOLCHAIN=clang -FROM ubuntu:22.04 AS base +FROM ubuntu:${UBUNTU_VER}.04 AS base ENV DEBIAN_FRONTEND=noninteractive RUN apt-get update && \ @@ -9,28 +10,57 @@ RUN apt-get update && \ curl \ dpkg-dev \ git \ - llvm-15-dev \ - liblld-15-dev \ ninja-build \ software-properties-common \ wget \ zlib1g-dev -### deps for clang ### -FROM base AS deps-clang +### deps for ubuntu 20.04 ### +FROM base AS deps-20 -RUN apt-get update && \ - apt-get install -y \ +RUN apt-get install -y \ + llvm-12-dev \ + liblld-12-dev + +### deps for ubuntu 22.04 ### +FROM base AS deps-22 + +RUN apt-get install -y \ + llvm-15-dev \ + liblld-15-dev + +### deps for clang / ubuntu 20.04 ### +FROM deps-20 AS deps-20-clang + +RUN apt-get install -y \ + clang-12 + +ENV CC=/usr/bin/clang-12 +ENV CXX=/usr/bin/clang++-12 + +### deps for clang / ubuntu 22.04 ### +FROM deps-22 AS deps-22-clang + +RUN apt-get install -y \ clang-15 ENV CC=/usr/bin/clang-15 ENV CXX=/usr/bin/clang++-15 -### deps for gcc ### -FROM base AS deps-gcc +### deps for gcc / ubuntu 20.04 ### +FROM deps-20 AS deps-20-gcc -RUN apt-get update && \ - apt-get install -y \ +RUN apt-get install -y \ + gcc \ + g++ + +ENV CC=gcc +ENV CXX=g++ + +### deps for gcc / ubuntu 22.04 ### +FROM deps-22 AS deps-22-gcc + +RUN apt-get install -y \ gcc \ g++ @@ -38,6 +68,6 @@ ENV CC=gcc ENV CXX=g++ ### deps for all ### -FROM deps-${TOOLCHAIN} AS final +FROM deps-${UBUNTU_VER}-${TOOLCHAIN} AS final RUN rm -rf /var/lib/apt/lists/* diff --git a/docker-bake.ubuntu.hcl b/docker-bake.ubuntu.hcl index 6f6a5af..9232c75 100644 --- a/docker-bake.ubuntu.hcl +++ b/docker-bake.ubuntu.hcl @@ -32,7 +32,8 @@ target "base" { tags = ["wasmedge/wasmedge:${tag(toolchain, ubuntu)}"] args = { - TOOLCHAIN = toolchain + TOOLCHAIN = toolchain + UBUNTU_VER = replace(ubuntu, ".04", "") } } From 02cdebb37fd4db78e879fa264118a6f380de93c2 Mon Sep 17 00:00:00 2001 From: Yi Huang Date: Thu, 29 Aug 2024 16:12:38 +0800 Subject: [PATCH 25/49] feat(docker,ubuntu): add aarch64 for ubuntu 20.04 Signed-off-by: Yi Huang --- docker-bake.ubuntu.hcl | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/docker-bake.ubuntu.hcl b/docker-bake.ubuntu.hcl index 9232c75..68b9b87 100644 --- a/docker-bake.ubuntu.hcl +++ b/docker-bake.ubuntu.hcl @@ -65,3 +65,17 @@ target "latest" { } tags = ["wasmedge/wasmedge:latest"] } + +target "clang-ubuntu2004-aarch64" { + matrix = { + toolchain = ["clang"] + ubuntu = ["20.04"] + } + inherits = ["${name(toolchain, ubuntu)}"] + contexts = { + "wasmedge/wasmedge:${tag(toolchain, ubuntu)}" = "target:${name(toolchain, ubuntu)}" + } + + tags = ["wasmedge/wasmedge:${tag(toolchain, ubuntu)}-aarch64"] + platforms = ["linux/arm64"] +} From 5039d35467ebe12dac8c60206fdc7828e6a9d2dc Mon Sep 17 00:00:00 2001 From: Yi Huang Date: Thu, 12 Sep 2024 18:33:36 +0800 Subject: [PATCH 26/49] feat(docker,ubuntu): add plugin dependencies Signed-off-by: Yi Huang --- Dockerfile.ubuntu-base | 24 ++++++++++++++---------- Dockerfile.ubuntu-plugins-deps | 17 ++++++++++++++++- 2 files changed, 30 insertions(+), 11 deletions(-) diff --git a/Dockerfile.ubuntu-base b/Dockerfile.ubuntu-base index 195dd4a..385af5e 100644 --- a/Dockerfile.ubuntu-base +++ b/Dockerfile.ubuntu-base @@ -9,6 +9,8 @@ RUN apt-get update && \ cmake \ curl \ dpkg-dev \ + g++ \ + gcc \ git \ ninja-build \ software-properties-common \ @@ -20,14 +22,24 @@ FROM base AS deps-20 RUN apt-get install -y \ llvm-12-dev \ - liblld-12-dev + liblld-12-dev \ + clang-12 + +RUN update-alternatives --install /usr/bin/clang clang /usr/bin/clang-12 100 && \ + update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-12 100 && \ + update-alternatives --install /usr/bin/llvm-strip llvm-strip /usr/bin/llvm-strip-12 100 ### deps for ubuntu 22.04 ### FROM base AS deps-22 RUN apt-get install -y \ llvm-15-dev \ - liblld-15-dev + liblld-15-dev \ + clang-15 + +RUN update-alternatives --install /usr/bin/clang clang /usr/bin/clang-15 100 && \ + update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-15 100 && \ + update-alternatives --install /usr/bin/llvm-strip llvm-strip /usr/bin/llvm-strip-15 100 ### deps for clang / ubuntu 20.04 ### FROM deps-20 AS deps-20-clang @@ -50,20 +62,12 @@ ENV CXX=/usr/bin/clang++-15 ### deps for gcc / ubuntu 20.04 ### FROM deps-20 AS deps-20-gcc -RUN apt-get install -y \ - gcc \ - g++ - ENV CC=gcc ENV CXX=g++ ### deps for gcc / ubuntu 22.04 ### FROM deps-22 AS deps-22-gcc -RUN apt-get install -y \ - gcc \ - g++ - ENV CC=gcc ENV CXX=g++ diff --git a/Dockerfile.ubuntu-plugins-deps b/Dockerfile.ubuntu-plugins-deps index a10ccec..dcff0c5 100644 --- a/Dockerfile.ubuntu-plugins-deps +++ b/Dockerfile.ubuntu-plugins-deps @@ -1,13 +1,28 @@ ARG BASE_IMAGE=wasmedge/wasmedge:latest FROM ${BASE_IMAGE} AS base +WORKDIR /root + RUN apt-get update && \ apt-get install -y \ + cargo \ + libelf-dev \ + libomp-dev \ + libssl-dev \ + pkg-config \ unzip \ - wget + yasm COPY opencvmini/install-opencvmini.sh . ENV OPENCV_VERSION="4.8.0" RUN [ "/bin/bash", "install-opencvmini.sh" ] +COPY ffmpeg/install-ffmpeg-v6.0.sh . +RUN [ "/bin/bash", "install-ffmpeg-v6.0.sh" ] +ENV PKG_CONFIG_PATH=/root/FFmpeg-n6.0/output/lib/pkgconfig${PKG_CONFIG_PATH:+:${PKG_CONFIG_PATH}} +ENV LD_LIBRARY_PATH=/root/FFmpeg-n6.0/output/lib${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}} + +### cleanup +FROM base AS clean-apt + RUN rm -rf /var/lib/apt/lists/* From e66c25dcee169d5c864094f8dffc2ebd894da022 Mon Sep 17 00:00:00 2001 From: Yi Huang Date: Thu, 12 Sep 2024 18:29:29 +0800 Subject: [PATCH 27/49] refactor(docker): refine for caching Signed-off-by: Yi Huang --- Dockerfile.ubuntu-base | 35 ++---------- docker-bake.ubuntu.hcl | 126 +++++++++++++++++++++++++++-------------- 2 files changed, 90 insertions(+), 71 deletions(-) diff --git a/Dockerfile.ubuntu-base b/Dockerfile.ubuntu-base index 385af5e..8dc3f7b 100644 --- a/Dockerfile.ubuntu-base +++ b/Dockerfile.ubuntu-base @@ -1,5 +1,4 @@ ARG UBUNTU_VER=22 -ARG TOOLCHAIN=clang FROM ubuntu:${UBUNTU_VER}.04 AS base ENV DEBIAN_FRONTEND=noninteractive @@ -29,6 +28,9 @@ RUN update-alternatives --install /usr/bin/clang clang /usr/bin/clang-12 100 && update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-12 100 && \ update-alternatives --install /usr/bin/llvm-strip llvm-strip /usr/bin/llvm-strip-12 100 +ENV CC=/usr/bin/clang-12 +ENV CXX=/usr/bin/clang++-12 + ### deps for ubuntu 22.04 ### FROM base AS deps-22 @@ -41,37 +43,10 @@ RUN update-alternatives --install /usr/bin/clang clang /usr/bin/clang-15 100 && update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-15 100 && \ update-alternatives --install /usr/bin/llvm-strip llvm-strip /usr/bin/llvm-strip-15 100 -### deps for clang / ubuntu 20.04 ### -FROM deps-20 AS deps-20-clang - -RUN apt-get install -y \ - clang-12 - -ENV CC=/usr/bin/clang-12 -ENV CXX=/usr/bin/clang++-12 - -### deps for clang / ubuntu 22.04 ### -FROM deps-22 AS deps-22-clang - -RUN apt-get install -y \ - clang-15 - ENV CC=/usr/bin/clang-15 ENV CXX=/usr/bin/clang++-15 -### deps for gcc / ubuntu 20.04 ### -FROM deps-20 AS deps-20-gcc - -ENV CC=gcc -ENV CXX=g++ - -### deps for gcc / ubuntu 22.04 ### -FROM deps-22 AS deps-22-gcc - -ENV CC=gcc -ENV CXX=g++ - -### deps for all ### -FROM deps-${UBUNTU_VER}-${TOOLCHAIN} AS final +### cleanup +FROM deps-${UBUNTU_VER} AS clean-apt RUN rm -rf /var/lib/apt/lists/* diff --git a/docker-bake.ubuntu.hcl b/docker-bake.ubuntu.hcl index 68b9b87..fb9bf95 100644 --- a/docker-bake.ubuntu.hcl +++ b/docker-bake.ubuntu.hcl @@ -1,81 +1,125 @@ group "default" { targets = [ - "base", - "latest", - "plugins" + "clang", + "gcc" ] } -function "name" { - params = [toolchain, ubuntu] - result = "${toolchain}-ubuntu${replace(ubuntu, ".", "")}" +function "no-dot" { + params = [ubuntu] + result = replace(ubuntu, ".", "") } -function "tag" { - params = [toolchain, ubuntu] - result = equal(ubuntu, "22.04") ? "ubuntu-build-${toolchain}" : "ubuntu-${ubuntu}-build-${toolchain}" +function "major" { + params = [ubuntu] + result = regex("^[[:digit:]]+", ubuntu) } -variable "matrix" { - default = { - toolchain = ["clang", "gcc"] - ubuntu = ["20.04", "22.04"] - } +function "tags-latest" { + params = [target, ubuntu, toolchain] + result = target == "base" && ubuntu == "22.04" && toolchain == "clang" ? "latest" : "" } -target "base" { - matrix = matrix - name = name(toolchain, ubuntu) +function "tags-backports" { + params = [target, ubuntu, toolchain] + result = join("-", compact([ + "ubuntu", + ubuntu != "22.04" ? ubuntu : "", + "build", + toolchain, + target == "plugins" ? "plugins-deps" : "", + ])) +} + +function "tags-simplified" { + params = [target, ubuntu, toolchain] + result = target == "base" && toolchain == "clang" ? "ubuntu-${ubuntu}" : "" +} + +function "tags" { + params = [target, ubuntu, toolchain] + result = [for tag in compact([ + tags-latest(target, ubuntu, toolchain), + tags-backports(target, ubuntu, toolchain), + tags-simplified(target, ubuntu, toolchain), + ]) : "wasmedge/wasmedge:${tag}"] +} +target "base" { dockerfile = "Dockerfile.ubuntu-base" context = "./utils/docker" - tags = ["wasmedge/wasmedge:${tag(toolchain, ubuntu)}"] + matrix = { + ubuntu = ["20.04", "22.04"] + } + + name = "base-${no-dot(ubuntu)}" + tags = ["local/tmp:base-${ubuntu}"] args = { - TOOLCHAIN = toolchain - UBUNTU_VER = replace(ubuntu, ".04", "") + UBUNTU_VER = major(ubuntu) } } target "plugins" { - matrix = matrix - name = "${name(toolchain, ubuntu)}-plugins" - dockerfile = "./docker/Dockerfile.ubuntu-plugins-deps" context = "./utils" - contexts = { - "wasmedge/wasmedge:${tag(toolchain, ubuntu)}" = "target:${name(toolchain, ubuntu)}" + matrix = { + ubuntu = ["20.04", "22.04"] } - tags = ["wasmedge/wasmedge:${tag(toolchain, ubuntu)}-plugins-deps"] + inherits = ["base-${no-dot(ubuntu)}"] + name = "plugins-${no-dot(ubuntu)}" + contexts = { + "local/tmp:base-${ubuntu}" = "target:base-${no-dot(ubuntu)}" + } + tags = ["local/tmp:plugins-${ubuntu}"] args = { - BASE_IMAGE = "wasmedge/wasmedge:${tag(toolchain, ubuntu)}" + BASE_IMAGE = "local/tmp:base-${ubuntu}" + UBUNTU_VER = major(ubuntu) } } -target "latest" { +target "clang" { matrix = { - toolchain = ["clang"] - ubuntu = ["22.04"] + parent = ["base", "plugins"] + ubuntu = ["20.04", "22.04"] } - inherits = ["${name(toolchain, ubuntu)}"] - contexts = { - "wasmedge/wasmedge:${tag(toolchain, ubuntu)}" = "target:${name(toolchain, ubuntu)}" + + inherits = ["${parent}-${no-dot(ubuntu)}"] + name = "${parent}-${no-dot(ubuntu)}-clang" + contexts = { + "local/tmp:${parent}-${ubuntu}" = "target:${parent}-${no-dot(ubuntu)}" } - tags = ["wasmedge/wasmedge:latest"] + tags = tags(parent, ubuntu, "clang") } -target "clang-ubuntu2004-aarch64" { +target "gcc" { + dockerfile = "Dockerfile.ubuntu-gcc" + context = "./utils/docker" + matrix = { - toolchain = ["clang"] - ubuntu = ["20.04"] + parent = ["base", "plugins"] + ubuntu = ["20.04", "22.04"] } - inherits = ["${name(toolchain, ubuntu)}"] - contexts = { - "wasmedge/wasmedge:${tag(toolchain, ubuntu)}" = "target:${name(toolchain, ubuntu)}" + + inherits = ["${parent}-${no-dot(ubuntu)}"] + name = "${parent}-${no-dot(ubuntu)}-gcc" + contexts = { + "local/tmp:${parent}-${ubuntu}" = "target:${parent}-${no-dot(ubuntu)}" + } + tags = tags(parent, ubuntu, "gcc") + args = { + BASE_IMAGE = "local/tmp:${parent}-${ubuntu}" } +} - tags = ["wasmedge/wasmedge:${tag(toolchain, ubuntu)}-aarch64"] +# TODO: Refactor with multi-arch image +target "base-2004-clang-aarch64" { + inherits = ["base-2004"] + contexts = { + "local/tmp:base-2004" = "target:base-2004" + } + tags = [for tag in tags("base", "20.04", "clang") : "${tag}-aarch64"] platforms = ["linux/arm64"] } From 50911f488d9d2d6c5f68ba88af54ac40fa954d87 Mon Sep 17 00:00:00 2001 From: PeterD1524 Date: Sun, 22 Sep 2024 02:41:42 +0800 Subject: [PATCH 28/49] feat(docker,ubuntu): install latest CMake from Kitware APT Repository for Ubuntu 20.04 * Kitware APT Repository: https://apt.kitware.com/ Signed-off-by: PeterD1524 Signed-off-by: Yi Huang --- Dockerfile.ubuntu-base | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Dockerfile.ubuntu-base b/Dockerfile.ubuntu-base index 8dc3f7b..416b661 100644 --- a/Dockerfile.ubuntu-base +++ b/Dockerfile.ubuntu-base @@ -5,7 +5,6 @@ ENV DEBIAN_FRONTEND=noninteractive RUN apt-get update && \ apt-get upgrade -y && \ apt-get install -y \ - cmake \ curl \ dpkg-dev \ g++ \ @@ -19,6 +18,9 @@ RUN apt-get update && \ ### deps for ubuntu 20.04 ### FROM base AS deps-20 +RUN curl -sSf https://apt.kitware.com/kitware-archive.sh | sh +RUN apt-get install -y cmake + RUN apt-get install -y \ llvm-12-dev \ liblld-12-dev \ @@ -34,6 +36,8 @@ ENV CXX=/usr/bin/clang++-12 ### deps for ubuntu 22.04 ### FROM base AS deps-22 +RUN apt-get install -y cmake + RUN apt-get install -y \ llvm-15-dev \ liblld-15-dev \ From daf88e74506afce55cb500c50c2371e9cdbaf350 Mon Sep 17 00:00:00 2001 From: Yi Date: Mon, 23 Sep 2024 17:03:49 +0800 Subject: [PATCH 29/49] feat(docker,ubuntu): refactor Ubuntu plugins * [CI] Ubuntu: Rename 22.04 to latest Signed-off-by: Yi Huang * [Docker] Ubuntu: Tag 22.04 Signed-off-by: Yi Huang * [Docker] Ubuntu: Add WASI-NN dependencies Signed-off-by: Yi Huang * [Docker] Ubuntu: Clean-up files after installations Signed-off-by: Yi Huang * [CI] Plugins: Add ubuntu 20.04 and 22.04 to matrix - wasi_nn-ggml - wasi_nn-openvino - wasi_nn-piper - wasi_nn-pytorch - wasi_nn-tensorflowlite - wasi_nn-whisper Signed-off-by: Yi Huang * [CI] Plugins: Remove ubuntu plugins refactored with matrix - wasi_nn-ggml - wasi_nn-openvino - wasi_nn-piper - wasi_nn-pytorch - wasi_nn-tensorflowlite - wasi_nn-whisper Signed-off-by: Yi Huang --------- [WasmEdge#3786](https://github.com/WasmEdge/WasmEdge/pull/3786) Signed-off-by: Yi Huang --- Dockerfile.ubuntu-plugins-deps | 27 ++++++++++++++++++++++++ docker-bake.ubuntu.hcl | 19 ++++++++++++++++- scripts/ffmpeg/install-ffmpeg-v6.0.sh | 5 +++-- scripts/opencvmini/install-opencvmini.sh | 2 ++ scripts/wasi-nn/install-openvino.sh | 6 ++++-- 5 files changed, 54 insertions(+), 5 deletions(-) diff --git a/Dockerfile.ubuntu-plugins-deps b/Dockerfile.ubuntu-plugins-deps index dcff0c5..eaa2fd8 100644 --- a/Dockerfile.ubuntu-plugins-deps +++ b/Dockerfile.ubuntu-plugins-deps @@ -8,11 +8,17 @@ RUN apt-get update && \ cargo \ libelf-dev \ libomp-dev \ + libopenblas-dev \ libssl-dev \ pkg-config \ unzip \ yasm +RUN apt-get install -y \ + libgrpc++-dev \ + libgrpc-dev \ + protobuf-compiler-grpc + COPY opencvmini/install-opencvmini.sh . ENV OPENCV_VERSION="4.8.0" RUN [ "/bin/bash", "install-opencvmini.sh" ] @@ -22,7 +28,28 @@ RUN [ "/bin/bash", "install-ffmpeg-v6.0.sh" ] ENV PKG_CONFIG_PATH=/root/FFmpeg-n6.0/output/lib/pkgconfig${PKG_CONFIG_PATH:+:${PKG_CONFIG_PATH}} ENV LD_LIBRARY_PATH=/root/FFmpeg-n6.0/output/lib${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}} +COPY wasi-nn/install-pytorch.sh . +ENV PYTORCH_VERSION="1.8.2" +ENV PYTORCH_INSTALL_TO="/root" +ENV Torch_DIR="/root/libtorch" +RUN [ "/bin/bash", "install-pytorch.sh" ] + +COPY wasi-nn/install-openvino.sh . +ENV OPENVINO_VERSION="2024.2.0" +ENV OPENVINO_YEAR="2024" +RUN [ "/bin/bash", "install-openvino.sh" ] + +COPY wasi-nn/install-onnxruntime.sh . +RUN [ "/bin/bash", "install-onnxruntime.sh" ] + ### cleanup FROM base AS clean-apt +RUN rm -f \ + install-opencvmini.sh \ + install-ffmpeg-v6.0.sh \ + install-pytorch.sh \ + install-openvino.sh \ + install-onnxruntime.sh + RUN rm -rf /var/lib/apt/lists/* diff --git a/docker-bake.ubuntu.hcl b/docker-bake.ubuntu.hcl index fb9bf95..42f7c9d 100644 --- a/docker-bake.ubuntu.hcl +++ b/docker-bake.ubuntu.hcl @@ -5,6 +5,12 @@ group "default" { ] } +group "latest" { + targets = [ + "base-2204-clang", + ] +} + function "no-dot" { params = [ubuntu] result = replace(ubuntu, ".", "") @@ -20,11 +26,21 @@ function "tags-latest" { result = target == "base" && ubuntu == "22.04" && toolchain == "clang" ? "latest" : "" } +function "tags-latest-backports" { + params = [target, ubuntu, toolchain] + result = ubuntu == "22.04" ? join("-", compact([ + "ubuntu", + "build", + toolchain, + target == "plugins" ? "plugins-deps" : "", + ])) : "" +} + function "tags-backports" { params = [target, ubuntu, toolchain] result = join("-", compact([ "ubuntu", - ubuntu != "22.04" ? ubuntu : "", + ubuntu, "build", toolchain, target == "plugins" ? "plugins-deps" : "", @@ -40,6 +56,7 @@ function "tags" { params = [target, ubuntu, toolchain] result = [for tag in compact([ tags-latest(target, ubuntu, toolchain), + tags-latest-backports(target, ubuntu, toolchain), tags-backports(target, ubuntu, toolchain), tags-simplified(target, ubuntu, toolchain), ]) : "wasmedge/wasmedge:${tag}"] diff --git a/scripts/ffmpeg/install-ffmpeg-v6.0.sh b/scripts/ffmpeg/install-ffmpeg-v6.0.sh index 479908c..d02dc73 100755 --- a/scripts/ffmpeg/install-ffmpeg-v6.0.sh +++ b/scripts/ffmpeg/install-ffmpeg-v6.0.sh @@ -1,6 +1,5 @@ #!/usr/bin/env bash -rm -rf FFmpeg-n6.0 ffmpeg.zip -echo $(pwd) +set -e curl -sL https://github.com/FFmpeg/FFmpeg/archive/refs/tags/n6.0.zip -o ffmpeg.zip @@ -11,3 +10,5 @@ cd FFmpeg-n6.0 ./configure --prefix=$(pwd)/output --enable-gpl --enable-nonfree --enable-shared --disable-static make && make install cd .. + +rm -rf ffmpeg.zip diff --git a/scripts/opencvmini/install-opencvmini.sh b/scripts/opencvmini/install-opencvmini.sh index 799f738..6e47fd9 100644 --- a/scripts/opencvmini/install-opencvmini.sh +++ b/scripts/opencvmini/install-opencvmini.sh @@ -15,3 +15,5 @@ cmake -GNinja .. cmake --build . # Install to system cmake --install . + +rm -f opencv.zip diff --git a/scripts/wasi-nn/install-openvino.sh b/scripts/wasi-nn/install-openvino.sh index 10a3d08..cd4030c 100755 --- a/scripts/wasi-nn/install-openvino.sh +++ b/scripts/wasi-nn/install-openvino.sh @@ -4,8 +4,10 @@ set -e echo "Installing OpenVINO with version 2024.2.0" -wget https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB -apt-key add GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB +KEY_FILE=GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB +wget https://apt.repos.intel.com/intel-gpg-keys/$KEY_FILE && \ + apt-key add $KEY_FILE && \ + rm -f $KEY_FILE echo "deb https://apt.repos.intel.com/openvino/2024 ubuntu20 main" | tee /etc/apt/sources.list.d/intel-openvino-2024.list apt update apt-get -y install openvino-2024.2.0 From faeeb24fdec0a771672844b86f3cd89ff1bb27d9 Mon Sep 17 00:00:00 2001 From: Yi Huang Date: Tue, 24 Sep 2024 15:44:46 +0800 Subject: [PATCH 30/49] feat(docker,ubuntu): pre-install CUDA Signed-off-by: Yi Huang --- Dockerfile.ubuntu-cuda | 24 ++++++++++++++++++++++++ docker-bake.ubuntu.hcl | 20 ++++++++++++++++++++ 2 files changed, 44 insertions(+) create mode 100644 Dockerfile.ubuntu-cuda diff --git a/Dockerfile.ubuntu-cuda b/Dockerfile.ubuntu-cuda new file mode 100644 index 0000000..f10b8b5 --- /dev/null +++ b/Dockerfile.ubuntu-cuda @@ -0,0 +1,24 @@ +ARG BASE_IMAGE=wasmedge/wasmedge:latest +FROM ${BASE_IMAGE} AS base + +WORKDIR /root + +ARG CUDA_KEYRING=cuda-keyring_1.1-1_all.deb +RUN wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86_64/${CUDA_KEYRING} && \ + dpkg -i ${CUDA_KEYRING} && \ + rm -f ${CUDA_KEYRING} + +ARG NVCC_VER=12-0 +RUN apt-get update && \ + apt-get install -y \ + cuda-nvcc-${NVCC_VER} \ + libcublas-dev-${NVCC_VER} \ + pkg-config \ + unzip + +ENV CXXFLAGS="-Wno-error" + +### cleanup +FROM base AS clean-apt + +RUN rm -rf /var/lib/apt/lists/* diff --git a/docker-bake.ubuntu.hcl b/docker-bake.ubuntu.hcl index 42f7c9d..1c7ad29 100644 --- a/docker-bake.ubuntu.hcl +++ b/docker-bake.ubuntu.hcl @@ -1,5 +1,6 @@ group "default" { targets = [ + "cuda", "clang", "gcc" ] @@ -131,6 +132,25 @@ target "gcc" { } } +target "cuda" { + dockerfile = "Dockerfile.ubuntu-cuda" + context = "./utils/docker" + + matrix = { + cuda = ["11.3", "12.0"] + } + + name = "base-2004-gcc-cuda${major(cuda)}" + contexts = { + "wasmedge/wasmedge:ubuntu-20.04-build-gcc" = "target:base-2004-gcc" + } + tags = ["wasmedge/wasmedge:ubuntu-20.04-build-gcc-cuda${major(cuda)}"] + args = { + BASE_IMAGE = "wasmedge/wasmedge:ubuntu-20.04-build-gcc" + NVCC_VER = replace(cuda, ".", "-") + } +} + # TODO: Refactor with multi-arch image target "base-2004-clang-aarch64" { inherits = ["base-2004"] From 444f533caa9ec85d35a5d6c9b011f40297985c5e Mon Sep 17 00:00:00 2001 From: LFsWang <7088579+LFsWang@users.noreply.github.com> Date: Mon, 7 Oct 2024 18:41:50 +0800 Subject: [PATCH 31/49] chore(scripts): update pytorch version Signed-off-by: Sylveon --------- [WasmEdge#3818](https://github.com/WasmEdge/WasmEdge/pull/3818) Signed-off-by: Yi Huang --- Dockerfile.manylinux_2_28-plugins-deps | 2 +- Dockerfile.ubuntu-plugins-deps | 2 +- scripts/wasi-nn/install-pytorch.sh | 8 ++++---- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Dockerfile.manylinux_2_28-plugins-deps b/Dockerfile.manylinux_2_28-plugins-deps index ec7be56..d983fcb 100644 --- a/Dockerfile.manylinux_2_28-plugins-deps +++ b/Dockerfile.manylinux_2_28-plugins-deps @@ -9,7 +9,7 @@ RUN cd && (yum check-update || true) && \ yum install -y wget unzip zlib-devel zlib-static elfutils-libelf-devel COPY wasi-nn/install-pytorch.sh . -ENV PYTORCH_VERSION="1.8.2" +ENV PYTORCH_VERSION="2.4.1" ENV PYTORCH_INSTALL_TO="/root" ENV Torch_DIR="/root/libtorch" RUN [ "/bin/bash", "install-pytorch.sh" ] diff --git a/Dockerfile.ubuntu-plugins-deps b/Dockerfile.ubuntu-plugins-deps index eaa2fd8..3684c46 100644 --- a/Dockerfile.ubuntu-plugins-deps +++ b/Dockerfile.ubuntu-plugins-deps @@ -29,7 +29,7 @@ ENV PKG_CONFIG_PATH=/root/FFmpeg-n6.0/output/lib/pkgconfig${PKG_CONFIG_PATH:+:${ ENV LD_LIBRARY_PATH=/root/FFmpeg-n6.0/output/lib${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}} COPY wasi-nn/install-pytorch.sh . -ENV PYTORCH_VERSION="1.8.2" +ENV PYTORCH_VERSION="2.4.1" ENV PYTORCH_INSTALL_TO="/root" ENV Torch_DIR="/root/libtorch" RUN [ "/bin/bash", "install-pytorch.sh" ] diff --git a/scripts/wasi-nn/install-pytorch.sh b/scripts/wasi-nn/install-pytorch.sh index f3fd070..1f6ac1d 100755 --- a/scripts/wasi-nn/install-pytorch.sh +++ b/scripts/wasi-nn/install-pytorch.sh @@ -3,7 +3,7 @@ # SPDX-FileCopyrightText: 2019-2024 Second State INC if [[ ! -n ${PYTORCH_VERSION} ]]; then - PYTORCH_VERSION="1.8.2" + PYTORCH_VERSION="2.4.1" fi if [[ ! -n ${PYTORCH_INSTALL_TO} ]]; then @@ -11,20 +11,20 @@ if [[ ! -n ${PYTORCH_INSTALL_TO} ]]; then fi PYTORCH_LINK="libtorch-cxx11-abi" -PYTORCH_SHA="b76d6dd4380e2233ce6f7654e672e13aae7c871231d223a4267ef018dcbfb616" +PYTORCH_SHA="415c3ed51c766a6ef20dc10b2e60fae7f10a3ae8aa62223d6f4bccc1fc98740b" for i in "$@"; do case $i in --disable-cxx11-abi) PYTORCH_LINK="libtorch" - PYTORCH_SHA="b5ddadc9addc054d8503f4086546f0cbcfdc3fc70087863bbd7b0e3300e3247f" + PYTORCH_SHA="f49d55df661c566c29a7a75bcae2fad69177eaebd330618d42ca162eb3a1fad1" shift ;; esac done if [ ! -d ${PYTORCH_INSTALL_TO}/libtorch ]; then - curl -s -L -O --remote-name-all https://download.pytorch.org/libtorch/lts/1.8/cpu/${PYTORCH_LINK}-shared-with-deps-${PYTORCH_VERSION}%2Bcpu.zip + curl -s -L -O --remote-name-all https://download.pytorch.org/libtorch/cpu/${PYTORCH_LINK}-shared-with-deps-${PYTORCH_VERSION}%2Bcpu.zip echo "${PYTORCH_SHA} ${PYTORCH_LINK}-shared-with-deps-${PYTORCH_VERSION}%2Bcpu.zip" | sha256sum -c unzip -q "${PYTORCH_LINK}-shared-with-deps-${PYTORCH_VERSION}%2Bcpu.zip" -d ${PYTORCH_INSTALL_TO} rm -f "${PYTORCH_LINK}-shared-with-deps-${PYTORCH_VERSION}%2Bcpu.zip" From afb9ed6afb9fa9da37168426b3dc59c2ad90210b Mon Sep 17 00:00:00 2001 From: Yi Date: Tue, 8 Oct 2024 14:27:30 +0800 Subject: [PATCH 32/49] feat(docker,ubuntu): fix OpenVINO apt source Signed-off-by: Yi Huang --------- [WasmEdge#3819](https://github.com/WasmEdge/WasmEdge/pull/3819) Signed-off-by: Yi Huang --- Dockerfile.ubuntu-env | 15 +++++++++++++++ Dockerfile.ubuntu-plugins-deps | 4 ++++ docker-bake.ubuntu.hcl | 29 +++++++---------------------- scripts/wasi-nn/install-openvino.sh | 4 ++-- 4 files changed, 28 insertions(+), 24 deletions(-) create mode 100644 Dockerfile.ubuntu-env diff --git a/Dockerfile.ubuntu-env b/Dockerfile.ubuntu-env new file mode 100644 index 0000000..dde599e --- /dev/null +++ b/Dockerfile.ubuntu-env @@ -0,0 +1,15 @@ +ARG BASE_IMAGE=wasmedge/wasmedge:latest +ARG TOOLCHAIN=clang +FROM ${BASE_IMAGE} AS base + +### env for clang +FROM base AS deps-clang + +### env for gcc +FROM base AS deps-gcc + +ENV CC=/usr/bin/gcc +ENV CXX=/usr/bin/g++ + +### final +FROM deps-${TOOLCHAIN} AS final diff --git a/Dockerfile.ubuntu-plugins-deps b/Dockerfile.ubuntu-plugins-deps index 3684c46..1ba0da6 100644 --- a/Dockerfile.ubuntu-plugins-deps +++ b/Dockerfile.ubuntu-plugins-deps @@ -1,4 +1,5 @@ ARG BASE_IMAGE=wasmedge/wasmedge:latest +ARG UBUNTU_VER=20 FROM ${BASE_IMAGE} AS base WORKDIR /root @@ -34,7 +35,10 @@ ENV PYTORCH_INSTALL_TO="/root" ENV Torch_DIR="/root/libtorch" RUN [ "/bin/bash", "install-pytorch.sh" ] +ARG UBUNTU_VER + COPY wasi-nn/install-openvino.sh . +ENV OPENVINO_UBUNTU_VERSION=${UBUNTU_VER} ENV OPENVINO_VERSION="2024.2.0" ENV OPENVINO_YEAR="2024" RUN [ "/bin/bash", "install-openvino.sh" ] diff --git a/docker-bake.ubuntu.hcl b/docker-bake.ubuntu.hcl index 1c7ad29..d7ae601 100644 --- a/docker-bake.ubuntu.hcl +++ b/docker-bake.ubuntu.hcl @@ -1,8 +1,7 @@ group "default" { targets = [ "cuda", - "clang", - "gcc" + "final" ] } @@ -86,7 +85,6 @@ target "plugins" { ubuntu = ["20.04", "22.04"] } - inherits = ["base-${no-dot(ubuntu)}"] name = "plugins-${no-dot(ubuntu)}" contexts = { "local/tmp:base-${ubuntu}" = "target:base-${no-dot(ubuntu)}" @@ -98,37 +96,24 @@ target "plugins" { } } -target "clang" { +target "final" { matrix = { parent = ["base", "plugins"] ubuntu = ["20.04", "22.04"] + toolchain = ["clang", "gcc"] } - inherits = ["${parent}-${no-dot(ubuntu)}"] - name = "${parent}-${no-dot(ubuntu)}-clang" - contexts = { - "local/tmp:${parent}-${ubuntu}" = "target:${parent}-${no-dot(ubuntu)}" - } - tags = tags(parent, ubuntu, "clang") -} - -target "gcc" { - dockerfile = "Dockerfile.ubuntu-gcc" + dockerfile = "Dockerfile.ubuntu-env" context = "./utils/docker" - matrix = { - parent = ["base", "plugins"] - ubuntu = ["20.04", "22.04"] - } - - inherits = ["${parent}-${no-dot(ubuntu)}"] - name = "${parent}-${no-dot(ubuntu)}-gcc" + name = "${parent}-${no-dot(ubuntu)}-${toolchain}" contexts = { "local/tmp:${parent}-${ubuntu}" = "target:${parent}-${no-dot(ubuntu)}" } - tags = tags(parent, ubuntu, "gcc") + tags = tags(parent, ubuntu, toolchain) args = { BASE_IMAGE = "local/tmp:${parent}-${ubuntu}" + TOOLCHAIN = toolchain } } diff --git a/scripts/wasi-nn/install-openvino.sh b/scripts/wasi-nn/install-openvino.sh index cd4030c..9950cac 100755 --- a/scripts/wasi-nn/install-openvino.sh +++ b/scripts/wasi-nn/install-openvino.sh @@ -1,14 +1,14 @@ #!/usr/bin/env bash # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception # SPDX-FileCopyrightText: 2019-2024 Second State INC - set -e echo "Installing OpenVINO with version 2024.2.0" KEY_FILE=GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB wget https://apt.repos.intel.com/intel-gpg-keys/$KEY_FILE && \ apt-key add $KEY_FILE && \ rm -f $KEY_FILE -echo "deb https://apt.repos.intel.com/openvino/2024 ubuntu20 main" | tee /etc/apt/sources.list.d/intel-openvino-2024.list +UBUNTU_VERSION="ubuntu${OPENVINO_UBUNTU_VERSION:-20}" +echo "deb https://apt.repos.intel.com/openvino/2024 ${UBUNTU_VERSION} main" | tee /etc/apt/sources.list.d/intel-openvino-2024.list apt update apt-get -y install openvino-2024.2.0 ldconfig From f2d509938bca5ec51eaccc0e650e87284d971ca5 Mon Sep 17 00:00:00 2001 From: LFsWang <7088579+LFsWang@users.noreply.github.com> Date: Mon, 14 Oct 2024 16:32:49 +0800 Subject: [PATCH 33/49] feat(docker,manylinux): disable pytorch c++11 abi on manylinux_2_28 Signed-off-by: Sylveon --------- [WasmEdge#3826](https://github.com/WasmEdge/WasmEdge/pull/3826) Signed-off-by: Yi Huang --- Dockerfile.manylinux_2_28-plugins-deps | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile.manylinux_2_28-plugins-deps b/Dockerfile.manylinux_2_28-plugins-deps index d983fcb..5db5227 100644 --- a/Dockerfile.manylinux_2_28-plugins-deps +++ b/Dockerfile.manylinux_2_28-plugins-deps @@ -12,7 +12,7 @@ COPY wasi-nn/install-pytorch.sh . ENV PYTORCH_VERSION="2.4.1" ENV PYTORCH_INSTALL_TO="/root" ENV Torch_DIR="/root/libtorch" -RUN [ "/bin/bash", "install-pytorch.sh" ] +RUN [ "/bin/bash", "install-pytorch.sh", "--disable-cxx11-abi" ] ### deps for aarch64 ### FROM base AS deps-arm64 From ffb66b55d6b293eda2a9164f850e46869551de32 Mon Sep 17 00:00:00 2001 From: Yi Huang Date: Wed, 18 Sep 2024 16:31:01 +0800 Subject: [PATCH 34/49] feat(docker,ubuntu): add Ubuntu 24.04 Signed-off-by: Yi Huang --- Dockerfile.ubuntu-base | 18 ++++++++++++++++++ docker-bake.ubuntu.hcl | 37 ++++++++++++++++++++++++++++++++----- 2 files changed, 50 insertions(+), 5 deletions(-) diff --git a/Dockerfile.ubuntu-base b/Dockerfile.ubuntu-base index 416b661..a6ed627 100644 --- a/Dockerfile.ubuntu-base +++ b/Dockerfile.ubuntu-base @@ -50,6 +50,24 @@ RUN update-alternatives --install /usr/bin/clang clang /usr/bin/clang-15 100 && ENV CC=/usr/bin/clang-15 ENV CXX=/usr/bin/clang++-15 +### deps for ubuntu 24.04 ### +FROM base AS deps-24 + +RUN apt-get install -y cmake + +RUN apt-get install -y \ + llvm-18-dev \ + liblld-18-dev \ + libpolly-18-dev \ + clang-18 + +RUN update-alternatives --install /usr/bin/clang clang /usr/bin/clang-18 100 && \ + update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-18 100 && \ + update-alternatives --install /usr/bin/llvm-strip llvm-strip /usr/bin/llvm-strip-18 100 + +ENV CC=/usr/bin/clang-18 +ENV CXX=/usr/bin/clang++-18 + ### cleanup FROM deps-${UBUNTU_VER} AS clean-apt diff --git a/docker-bake.ubuntu.hcl b/docker-bake.ubuntu.hcl index d7ae601..f37c51d 100644 --- a/docker-bake.ubuntu.hcl +++ b/docker-bake.ubuntu.hcl @@ -6,8 +6,35 @@ group "default" { } group "latest" { + targets = [ + "base-2404-clang", + ] +} + +group "focal" { + targets = [ + "base-2004-clang", + "base-2004-gcc", + "plugins-2004-clang", + "plugins-2004-gcc", + ] +} + +group "jammy" { targets = [ "base-2204-clang", + "base-2204-gcc", + "plugins-2204-clang", + "plugins-2204-gcc", + ] +} + +group "noble" { + targets = [ + "base-2404-clang", + "base-2404-gcc", + "plugins-2404-clang", + "plugins-2404-gcc", ] } @@ -23,12 +50,12 @@ function "major" { function "tags-latest" { params = [target, ubuntu, toolchain] - result = target == "base" && ubuntu == "22.04" && toolchain == "clang" ? "latest" : "" + result = target == "base" && ubuntu == "24.04" && toolchain == "clang" ? "latest" : "" } function "tags-latest-backports" { params = [target, ubuntu, toolchain] - result = ubuntu == "22.04" ? join("-", compact([ + result = ubuntu == "24.04" ? join("-", compact([ "ubuntu", "build", toolchain, @@ -67,7 +94,7 @@ target "base" { context = "./utils/docker" matrix = { - ubuntu = ["20.04", "22.04"] + ubuntu = ["20.04", "22.04", "24.04"] } name = "base-${no-dot(ubuntu)}" @@ -82,7 +109,7 @@ target "plugins" { context = "./utils" matrix = { - ubuntu = ["20.04", "22.04"] + ubuntu = ["20.04", "22.04", "24.04"] } name = "plugins-${no-dot(ubuntu)}" @@ -99,7 +126,7 @@ target "plugins" { target "final" { matrix = { parent = ["base", "plugins"] - ubuntu = ["20.04", "22.04"] + ubuntu = ["20.04", "22.04", "24.04"] toolchain = ["clang", "gcc"] } From d31233475295cdbabb1286d325810c352d078619 Mon Sep 17 00:00:00 2001 From: Yi Huang Date: Mon, 4 Nov 2024 17:44:45 +0800 Subject: [PATCH 35/49] feat(docker,ubuntu): install FFmpeg 6.1 via apt on Ubuntu 24.04 Signed-off-by: Yi Huang --- Dockerfile.ubuntu-plugins-deps | 28 ++++++++++++++++++++++++---- 1 file changed, 24 insertions(+), 4 deletions(-) diff --git a/Dockerfile.ubuntu-plugins-deps b/Dockerfile.ubuntu-plugins-deps index 1ba0da6..04c3694 100644 --- a/Dockerfile.ubuntu-plugins-deps +++ b/Dockerfile.ubuntu-plugins-deps @@ -20,15 +20,35 @@ RUN apt-get install -y \ libgrpc-dev \ protobuf-compiler-grpc -COPY opencvmini/install-opencvmini.sh . -ENV OPENCV_VERSION="4.8.0" -RUN [ "/bin/bash", "install-opencvmini.sh" ] +# FFmpeg 6.1 (ubuntu 24.04) +FROM base AS deps-24 + +RUN apt-get install -y \ + libavcodec-dev \ + libavdevice-dev \ + libavfilter-dev \ + libavformat-dev \ + libavutil-dev \ + libswresample-dev \ + libswscale-dev + +# FFmpeg 6.0 (ubuntu 20.04, 22.04) +FROM base AS deps-20 COPY ffmpeg/install-ffmpeg-v6.0.sh . RUN [ "/bin/bash", "install-ffmpeg-v6.0.sh" ] ENV PKG_CONFIG_PATH=/root/FFmpeg-n6.0/output/lib/pkgconfig${PKG_CONFIG_PATH:+:${PKG_CONFIG_PATH}} ENV LD_LIBRARY_PATH=/root/FFmpeg-n6.0/output/lib${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}} +FROM deps-20 AS deps-22 + +# Other dependencies +FROM deps-${UBUNTU_VER} AS deps-all + +COPY opencvmini/install-opencvmini.sh . +ENV OPENCV_VERSION="4.8.0" +RUN [ "/bin/bash", "install-opencvmini.sh" ] + COPY wasi-nn/install-pytorch.sh . ENV PYTORCH_VERSION="2.4.1" ENV PYTORCH_INSTALL_TO="/root" @@ -47,7 +67,7 @@ COPY wasi-nn/install-onnxruntime.sh . RUN [ "/bin/bash", "install-onnxruntime.sh" ] ### cleanup -FROM base AS clean-apt +FROM deps-all AS clean-apt RUN rm -f \ install-opencvmini.sh \ From 757617659448d51e809014092e22997a82a0531b Mon Sep 17 00:00:00 2001 From: Yi Huang Date: Tue, 5 Nov 2024 15:34:06 +0800 Subject: [PATCH 36/49] feat(docker): install deps to /usr/local instead of /root * Install FFmpeg 6.0 to /usr/local * Install PyTorch to /usr/local * Fix clean-up files for install-opencvmini.sh Signed-off-by: Yi Huang --- Dockerfile.ubuntu-plugins-deps | 14 ++++++++------ scripts/opencvmini/install-opencvmini.sh | 2 +- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/Dockerfile.ubuntu-plugins-deps b/Dockerfile.ubuntu-plugins-deps index 04c3694..4b321f2 100644 --- a/Dockerfile.ubuntu-plugins-deps +++ b/Dockerfile.ubuntu-plugins-deps @@ -2,8 +2,6 @@ ARG BASE_IMAGE=wasmedge/wasmedge:latest ARG UBUNTU_VER=20 FROM ${BASE_IMAGE} AS base -WORKDIR /root - RUN apt-get update && \ apt-get install -y \ cargo \ @@ -35,24 +33,28 @@ RUN apt-get install -y \ # FFmpeg 6.0 (ubuntu 20.04, 22.04) FROM base AS deps-20 +WORKDIR /usr/local + COPY ffmpeg/install-ffmpeg-v6.0.sh . RUN [ "/bin/bash", "install-ffmpeg-v6.0.sh" ] -ENV PKG_CONFIG_PATH=/root/FFmpeg-n6.0/output/lib/pkgconfig${PKG_CONFIG_PATH:+:${PKG_CONFIG_PATH}} -ENV LD_LIBRARY_PATH=/root/FFmpeg-n6.0/output/lib${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}} +ENV PKG_CONFIG_PATH=/usr/local/FFmpeg-n6.0/output/lib/pkgconfig${PKG_CONFIG_PATH:+:${PKG_CONFIG_PATH}} +ENV LD_LIBRARY_PATH=/usr/local/FFmpeg-n6.0/output/lib${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}} FROM deps-20 AS deps-22 # Other dependencies FROM deps-${UBUNTU_VER} AS deps-all +WORKDIR /root + COPY opencvmini/install-opencvmini.sh . ENV OPENCV_VERSION="4.8.0" RUN [ "/bin/bash", "install-opencvmini.sh" ] COPY wasi-nn/install-pytorch.sh . ENV PYTORCH_VERSION="2.4.1" -ENV PYTORCH_INSTALL_TO="/root" -ENV Torch_DIR="/root/libtorch" +ENV PYTORCH_INSTALL_TO="/usr/local" +ENV Torch_DIR="/usr/local/libtorch" RUN [ "/bin/bash", "install-pytorch.sh" ] ARG UBUNTU_VER diff --git a/scripts/opencvmini/install-opencvmini.sh b/scripts/opencvmini/install-opencvmini.sh index 6e47fd9..43afef9 100644 --- a/scripts/opencvmini/install-opencvmini.sh +++ b/scripts/opencvmini/install-opencvmini.sh @@ -16,4 +16,4 @@ cmake --build . # Install to system cmake --install . -rm -f opencv.zip +cd - && rm -rf opencv opencv.zip From 26f42e02aeaf3bdef753f76c1b98366f85d906f0 Mon Sep 17 00:00:00 2001 From: LFsWang <7088579+LFsWang@users.noreply.github.com> Date: Wed, 4 Dec 2024 13:52:33 +0800 Subject: [PATCH 37/49] chore(docker): update pytorch version Signed-off-by: Sylveon --------- [WasmEdge#3901](https://github.com/WasmEdge/WasmEdge/pull/3901) Signed-off-by: Yi Huang --- Dockerfile.manylinux_2_28-plugins-deps | 2 +- Dockerfile.ubuntu-plugins-deps | 2 +- scripts/wasi-nn/install-pytorch.sh | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Dockerfile.manylinux_2_28-plugins-deps b/Dockerfile.manylinux_2_28-plugins-deps index 5db5227..ac6791f 100644 --- a/Dockerfile.manylinux_2_28-plugins-deps +++ b/Dockerfile.manylinux_2_28-plugins-deps @@ -9,7 +9,7 @@ RUN cd && (yum check-update || true) && \ yum install -y wget unzip zlib-devel zlib-static elfutils-libelf-devel COPY wasi-nn/install-pytorch.sh . -ENV PYTORCH_VERSION="2.4.1" +ENV PYTORCH_VERSION="2.5.1" ENV PYTORCH_INSTALL_TO="/root" ENV Torch_DIR="/root/libtorch" RUN [ "/bin/bash", "install-pytorch.sh", "--disable-cxx11-abi" ] diff --git a/Dockerfile.ubuntu-plugins-deps b/Dockerfile.ubuntu-plugins-deps index 4b321f2..940e215 100644 --- a/Dockerfile.ubuntu-plugins-deps +++ b/Dockerfile.ubuntu-plugins-deps @@ -52,7 +52,7 @@ ENV OPENCV_VERSION="4.8.0" RUN [ "/bin/bash", "install-opencvmini.sh" ] COPY wasi-nn/install-pytorch.sh . -ENV PYTORCH_VERSION="2.4.1" +ENV PYTORCH_VERSION="2.5.1" ENV PYTORCH_INSTALL_TO="/usr/local" ENV Torch_DIR="/usr/local/libtorch" RUN [ "/bin/bash", "install-pytorch.sh" ] diff --git a/scripts/wasi-nn/install-pytorch.sh b/scripts/wasi-nn/install-pytorch.sh index 1f6ac1d..55f77ac 100755 --- a/scripts/wasi-nn/install-pytorch.sh +++ b/scripts/wasi-nn/install-pytorch.sh @@ -3,7 +3,7 @@ # SPDX-FileCopyrightText: 2019-2024 Second State INC if [[ ! -n ${PYTORCH_VERSION} ]]; then - PYTORCH_VERSION="2.4.1" + PYTORCH_VERSION="2.5.1" fi if [[ ! -n ${PYTORCH_INSTALL_TO} ]]; then @@ -11,13 +11,13 @@ if [[ ! -n ${PYTORCH_INSTALL_TO} ]]; then fi PYTORCH_LINK="libtorch-cxx11-abi" -PYTORCH_SHA="415c3ed51c766a6ef20dc10b2e60fae7f10a3ae8aa62223d6f4bccc1fc98740b" +PYTORCH_SHA="618ca54eef82a1dca46ff1993d5807d9c0deb0bae147da4974166a147cb562fa" for i in "$@"; do case $i in --disable-cxx11-abi) PYTORCH_LINK="libtorch" - PYTORCH_SHA="f49d55df661c566c29a7a75bcae2fad69177eaebd330618d42ca162eb3a1fad1" + PYTORCH_SHA="21d05ad61935fc70912c779443dba112bda9c9ec1c999345d724935828f81c55" shift ;; esac From f86a4313185bbb95758afc7bdd2da3f75e898dc9 Mon Sep 17 00:00:00 2001 From: Yi Huang Date: Fri, 16 Feb 2024 18:48:54 +0800 Subject: [PATCH 38/49] chore: add sha256sum for manylinux_2_28 Signed-off-by: Yi Huang --- scripts/SHA256SUM.manylinux_2_28 | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 scripts/SHA256SUM.manylinux_2_28 diff --git a/scripts/SHA256SUM.manylinux_2_28 b/scripts/SHA256SUM.manylinux_2_28 new file mode 100644 index 0000000..0b73200 --- /dev/null +++ b/scripts/SHA256SUM.manylinux_2_28 @@ -0,0 +1,7 @@ +31747ae633213f1eda3842686f83c2aa1412e0f5691d1c14dbbcc67fe7400cea v1.11.1.tar.gz +a78f668a726ae1d3d9a7179996d97b12b90fb76ab9442a43110b972ff7ad9029 clang-17.0.6.src.tar.xz +807f069c54dc20cb47b21c1f6acafdd9c649f3ae015609040d6182cab01140f4 cmake-17.0.6.src.tar.xz +9e7535a353aa862730b4ba38df42e06f6856b40c4cc51b57f27b5046dc21d70d libunwind-17.0.6.src.tar.xz +4ac13125616dc44905b85820aa403d27ec1226329b7f674daeb5f5584c6f0b22 lld-17.0.6.src.tar.xz +b638167da139126ca11917b6880207cc6e8f9d1cbb1a48d87d017f697ef78188 llvm-17.0.6.src.tar.xz +3054d0a9c9375dab1a4539cc2cc45ab340341c5d71475f9599ba7752e222947b third-party-17.0.6.src.tar.xz From b7bd1feb8322d2b841e9e1bbdc79873107125313 Mon Sep 17 00:00:00 2001 From: "Shen-Ta Hsieh(BestSteve)" Date: Sun, 29 Dec 2024 23:42:40 +0800 Subject: [PATCH 39/49] chore(docker): update llvm, zstd, ninja, cmake in dockerfile and workflows * Remove unused zstd flags in manylinux_2_28 * Update windows sdk to 26100 Signed-off-by: Shen-Ta Hsieh --------- [WasmEdge#3924](https://github.com/WasmEdge/WasmEdge/pull/3924) Signed-off-by: Yi Huang --- Dockerfile.manylinux_2_28-base | 43 ++++++++++++++++---------------- scripts/SHA256SUM.manylinux_2_28 | 14 +++++------ 2 files changed, 28 insertions(+), 29 deletions(-) diff --git a/Dockerfile.manylinux_2_28-base b/Dockerfile.manylinux_2_28-base index 30b64c3..da7b144 100644 --- a/Dockerfile.manylinux_2_28-base +++ b/Dockerfile.manylinux_2_28-base @@ -21,32 +21,31 @@ RUN cd && (yum check-update || true) && yum install -y openssl-devel rpm-build c 'import multiprocessing; print(multiprocessing.cpu_count())') && \ export CFGFLAGS="--prefix=/opt/rh/gcc-toolset-13/root/usr --disable-shared --libdir=/opt/rh/gcc-toolset-13/root/usr/lib64" && \ curl -s -L -O --remote-name-all \ - https://github.com/ninja-build/ninja/archive/refs/tags/v1.11.1.tar.gz \ - https://github.com/llvm/llvm-project/releases/download/llvmorg-17.0.6/llvm-17.0.6.src.tar.xz \ - https://github.com/llvm/llvm-project/releases/download/llvmorg-17.0.6/lld-17.0.6.src.tar.xz \ - https://github.com/llvm/llvm-project/releases/download/llvmorg-17.0.6/libunwind-17.0.6.src.tar.xz \ - https://github.com/llvm/llvm-project/releases/download/llvmorg-17.0.6/cmake-17.0.6.src.tar.xz \ - https://github.com/llvm/llvm-project/releases/download/llvmorg-17.0.6/third-party-17.0.6.src.tar.xz \ - https://github.com/llvm/llvm-project/releases/download/llvmorg-17.0.6/clang-17.0.6.src.tar.xz && \ + https://github.com/ninja-build/ninja/archive/refs/tags/v1.12.1.tar.gz \ + https://github.com/llvm/llvm-project/releases/download/llvmorg-19.1.5/llvm-19.1.5.src.tar.xz \ + https://github.com/llvm/llvm-project/releases/download/llvmorg-19.1.5/lld-19.1.5.src.tar.xz \ + https://github.com/llvm/llvm-project/releases/download/llvmorg-19.1.5/libunwind-19.1.5.src.tar.xz \ + https://github.com/llvm/llvm-project/releases/download/llvmorg-19.1.5/cmake-19.1.5.src.tar.xz \ + https://github.com/llvm/llvm-project/releases/download/llvmorg-19.1.5/third-party-19.1.5.src.tar.xz \ + https://github.com/llvm/llvm-project/releases/download/llvmorg-19.1.5/clang-19.1.5.src.tar.xz && \ sha256sum -c SHA256SUM.manylinux_2_28 && \ - gzip -dc v1.11.1.tar.gz | tar -xf - && \ - xz -dc llvm-17.0.6.src.tar.xz | tar -xf - && \ - xz -dc lld-17.0.6.src.tar.xz | tar -xf - && \ - xz -dc libunwind-17.0.6.src.tar.xz | tar -xf - && \ - xz -dc cmake-17.0.6.src.tar.xz | tar -xf - && \ - xz -dc third-party-17.0.6.src.tar.xz | tar -xf - && \ - xz -dc clang-17.0.6.src.tar.xz | tar -xf - && \ - export ZSTDFLAGS=(PREFIX=/opt/rh/gcc-toolset-13/root/usr LIBDIR=/opt/rh/gcc-toolset-13/root/usr/lib64 SED_ERE_OPT=--regexp-extended MOREFLAGS="-std=c17 -O3 -fPIC -fPIE -fvisibility=hidden") && \ + gzip -dc v1.12.1.tar.gz | tar -xf - && \ + xz -dc llvm-19.1.5.src.tar.xz | tar -xf - && \ + xz -dc lld-19.1.5.src.tar.xz | tar -xf - && \ + xz -dc libunwind-19.1.5.src.tar.xz | tar -xf - && \ + xz -dc cmake-19.1.5.src.tar.xz | tar -xf - && \ + xz -dc third-party-19.1.5.src.tar.xz | tar -xf - && \ + xz -dc clang-19.1.5.src.tar.xz | tar -xf - && \ mkdir build && cd build && /opt/python/cp311-cp311/bin/python \ - ../ninja-1.11.1/configure.py --bootstrap \ + ../ninja-1.12.1/configure.py --bootstrap \ --with-python=/opt/python/cp311-cp311/bin/python && \ cp -v ninja /opt/rh/gcc-toolset-13/root/usr/bin/ninja && cd - && rm -rf build && \ - mv -v llvm-17.0.6.src llvm && \ - mv -v lld-17.0.6.src lld && \ - mv -v libunwind-17.0.6.src libunwind && \ - mv -v cmake-17.0.6.src cmake && \ - mv -v third-party-17.0.6.src third-party && \ - mv -v clang-17.0.6.src clang && \ + mv -v llvm-19.1.5.src llvm && \ + mv -v lld-19.1.5.src lld && \ + mv -v libunwind-19.1.5.src libunwind && \ + mv -v cmake-19.1.5.src cmake && \ + mv -v third-party-19.1.5.src third-party && \ + mv -v clang-19.1.5.src clang && \ cmake -Bbuild -GNinja -DCMAKE_BUILD_TYPE=Release \ -DCMAKE_INSTALL_PREFIX=/opt/rh/gcc-toolset-13/root/usr \ -DPython3_ROOT_DIR=/opt/python/cp311-cp311 -DLLVM_LIBDIR_SUFFIX=64 \ diff --git a/scripts/SHA256SUM.manylinux_2_28 b/scripts/SHA256SUM.manylinux_2_28 index 0b73200..136490f 100644 --- a/scripts/SHA256SUM.manylinux_2_28 +++ b/scripts/SHA256SUM.manylinux_2_28 @@ -1,7 +1,7 @@ -31747ae633213f1eda3842686f83c2aa1412e0f5691d1c14dbbcc67fe7400cea v1.11.1.tar.gz -a78f668a726ae1d3d9a7179996d97b12b90fb76ab9442a43110b972ff7ad9029 clang-17.0.6.src.tar.xz -807f069c54dc20cb47b21c1f6acafdd9c649f3ae015609040d6182cab01140f4 cmake-17.0.6.src.tar.xz -9e7535a353aa862730b4ba38df42e06f6856b40c4cc51b57f27b5046dc21d70d libunwind-17.0.6.src.tar.xz -4ac13125616dc44905b85820aa403d27ec1226329b7f674daeb5f5584c6f0b22 lld-17.0.6.src.tar.xz -b638167da139126ca11917b6880207cc6e8f9d1cbb1a48d87d017f697ef78188 llvm-17.0.6.src.tar.xz -3054d0a9c9375dab1a4539cc2cc45ab340341c5d71475f9599ba7752e222947b third-party-17.0.6.src.tar.xz +e7dfc8050407b5cc564c1c1afe19517255c9229cccd886dbd5bac9b652828d85 clang-19.1.5.src.tar.xz +a08ae477571fd5e929c27d3d0d28c6168d58dd00b6354c2de3266ae0d86ad44f cmake-19.1.5.src.tar.xz +997b493fb604e5e2c5b11c765a4c42b37acf00a4d6e8a14f8108d5c1051d760f libunwind-19.1.5.src.tar.xz +f71835d49461a15c283aa9030a854abfd7c651a685d711a67158644b043f6f14 lld-19.1.5.src.tar.xz +7d71635948e4da1814ce8e15ec45399e4094a5442e86d352c96ded0f2b3171b6 llvm-19.1.5.src.tar.xz +22b352c35b034a4ab3f2b852b6a2602a4da8971abe459080450d9e3462550d1d third-party-19.1.5.src.tar.xz +821bdff48a3f683bc4bb3b6f0b5fe7b2d647cf65d52aeb63328c91a6c6df285a v1.12.1.tar.gz From e0519264ef28ee46450d82e27caf2934a4020b20 Mon Sep 17 00:00:00 2001 From: LFsWang <7088579+LFsWang@users.noreply.github.com> Date: Tue, 11 Feb 2025 17:46:38 +0800 Subject: [PATCH 40/49] chore(scripts): update OpenVINO to 2025.0.0 Signed-off-by: LFsWang --------- [WasmEdge#4016](https://github.com/WasmEdge/WasmEdge/pull/4016) Signed-off-by: Yi Huang --- Dockerfile.manylinux_2_28-plugins-deps | 4 ++-- Dockerfile.ubuntu-plugins-deps | 4 ++-- scripts/wasi-nn/install-openvino.sh | 14 +++++++++++--- 3 files changed, 15 insertions(+), 7 deletions(-) diff --git a/Dockerfile.manylinux_2_28-plugins-deps b/Dockerfile.manylinux_2_28-plugins-deps index ac6791f..484ee47 100644 --- a/Dockerfile.manylinux_2_28-plugins-deps +++ b/Dockerfile.manylinux_2_28-plugins-deps @@ -35,8 +35,8 @@ RUN [ "/bin/bash", "install-ffmpeg-v6.0.sh" ] ENV PKG_CONFIG_PATH=/root/FFmpeg-n6.0/output/lib/pkgconfig${PKG_CONFIG_PATH:+:${PKG_CONFIG_PATH}} ENV LD_LIBRARY_PATH=/root/FFmpeg-n6.0/output/lib${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}} -ENV OPENVINO_VERSION="2024.2.0" -ENV OPENVINO_YEAR="2024" +ENV OPENVINO_VERSION="2025.0.0" +ENV OPENVINO_YEAR="2025" COPY wasi-nn/install-onnxruntime.sh . RUN [ "/bin/bash", "install-onnxruntime.sh" ] diff --git a/Dockerfile.ubuntu-plugins-deps b/Dockerfile.ubuntu-plugins-deps index 940e215..1b177c5 100644 --- a/Dockerfile.ubuntu-plugins-deps +++ b/Dockerfile.ubuntu-plugins-deps @@ -61,8 +61,8 @@ ARG UBUNTU_VER COPY wasi-nn/install-openvino.sh . ENV OPENVINO_UBUNTU_VERSION=${UBUNTU_VER} -ENV OPENVINO_VERSION="2024.2.0" -ENV OPENVINO_YEAR="2024" +ENV OPENVINO_VERSION="2025.0.0" +ENV OPENVINO_YEAR="2025" RUN [ "/bin/bash", "install-openvino.sh" ] COPY wasi-nn/install-onnxruntime.sh . diff --git a/scripts/wasi-nn/install-openvino.sh b/scripts/wasi-nn/install-openvino.sh index 9950cac..432f1ac 100755 --- a/scripts/wasi-nn/install-openvino.sh +++ b/scripts/wasi-nn/install-openvino.sh @@ -2,13 +2,21 @@ # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception # SPDX-FileCopyrightText: 2019-2024 Second State INC set -e -echo "Installing OpenVINO with version 2024.2.0" + +if [[ ! -v "${OPENVINO_VERSION}" ]]; then + OPENVINO_VERSION="2025.0.0" +fi +if [[ ! -v "${OPENVINO_YEAR}" ]]; then + OPENVINO_YEAR="2025" +fi + +echo "Installing OpenVINO with version ${OPENVINO_VERSION}" KEY_FILE=GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB wget https://apt.repos.intel.com/intel-gpg-keys/$KEY_FILE && \ apt-key add $KEY_FILE && \ rm -f $KEY_FILE UBUNTU_VERSION="ubuntu${OPENVINO_UBUNTU_VERSION:-20}" -echo "deb https://apt.repos.intel.com/openvino/2024 ${UBUNTU_VERSION} main" | tee /etc/apt/sources.list.d/intel-openvino-2024.list +echo "deb https://apt.repos.intel.com/openvino/$OPENVINO_YEAR ${UBUNTU_VERSION} main" | tee /etc/apt/sources.list.d/intel-openvino-$OPENVINO_YEAR.list apt update -apt-get -y install openvino-2024.2.0 +apt-get -y install openvino-$OPENVINO_VERSION ldconfig From 5a599d2eaee7f323fffe1955533760eca609a0e7 Mon Sep 17 00:00:00 2001 From: LFsWang <7088579+LFsWang@users.noreply.github.com> Date: Thu, 6 Mar 2025 20:38:55 +0800 Subject: [PATCH 41/49] feat(scripts): add dependency installer for openvino-genai Signed-off-by: LFsWang --------- [WasmEdge#4032](https://github.com/WasmEdge/WasmEdge/pull/4032) Signed-off-by: Yi Huang --- Dockerfile.ubuntu-plugins-deps | 10 ++++++- scripts/wasi-nn/install-openvino-genai.sh | 36 +++++++++++++++++++++++ 2 files changed, 45 insertions(+), 1 deletion(-) create mode 100644 scripts/wasi-nn/install-openvino-genai.sh diff --git a/Dockerfile.ubuntu-plugins-deps b/Dockerfile.ubuntu-plugins-deps index 1b177c5..c2f48bf 100644 --- a/Dockerfile.ubuntu-plugins-deps +++ b/Dockerfile.ubuntu-plugins-deps @@ -60,10 +60,17 @@ RUN [ "/bin/bash", "install-pytorch.sh" ] ARG UBUNTU_VER COPY wasi-nn/install-openvino.sh . +COPY wasi-nn/install-openvino-genai.sh . ENV OPENVINO_UBUNTU_VERSION=${UBUNTU_VER} ENV OPENVINO_VERSION="2025.0.0" ENV OPENVINO_YEAR="2025" +ENV OPENVINOGEN_VERSION="2025.0.0.0" +ENV OPENVINOGEN_YEAR="2025.0" +ENV OPENVINOGEN_DIRNAME="openvino_genai" RUN [ "/bin/bash", "install-openvino.sh" ] +RUN [ "/bin/bash", "install-openvino-genai.sh" ] +RUN [ "ls", "-al" ] +RUN [ "/bin/bash", "-c", "echo \"source ./openvino_genai/setupvars.sh\" >> .bashrc" ] COPY wasi-nn/install-onnxruntime.sh . RUN [ "/bin/bash", "install-onnxruntime.sh" ] @@ -76,6 +83,7 @@ RUN rm -f \ install-ffmpeg-v6.0.sh \ install-pytorch.sh \ install-openvino.sh \ - install-onnxruntime.sh + install-onnxruntime.sh \ + install-openvino-genai.sh RUN rm -rf /var/lib/apt/lists/* diff --git a/scripts/wasi-nn/install-openvino-genai.sh b/scripts/wasi-nn/install-openvino-genai.sh new file mode 100644 index 0000000..a877ada --- /dev/null +++ b/scripts/wasi-nn/install-openvino-genai.sh @@ -0,0 +1,36 @@ +#!/usr/bin/env bash +# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +# SPDX-FileCopyrightText: 2019-2024 Second State INC +set -e + +if [[ ! -v "${OPENVINOGEN_VERSION}" ]]; then + OPENVINOGEN_VERSION="2025.0.0.0" +fi +if [[ ! -v "${OPENVINOGEN_YEAR}" ]]; then + OPENVINOGEN_YEAR="2025.0" +fi +if [[ ! -v "${OPENVINOGEN_DIRNAME}" ]]; then + OPENVINOGEN_DIRNAME="openvino_genai" +fi + +if [[ ! -v "${OPENVINO_UBUNTU_VERSION}" ]]; then + source /etc/os-release + OPENVINO_UBUNTU_VERSION="${VERSION_ID::2}" +fi + +UBUNTU_VERSION="ubuntu${OPENVINO_UBUNTU_VERSION:-20}" +OPENVINOGEN_TGZ_NAME="openvino_genai_${UBUNTU_VERSION}_${OPENVINOGEN_VERSION}_x86_64" + + +echo "Installing OpenVINO GenAI with version ${OPENVINOGEN_VERSION}" +curl -L https://storage.openvinotoolkit.org/repositories/openvino_genai/packages/${OPENVINOGEN_YEAR}/linux/${OPENVINOGEN_TGZ_NAME}.tar.gz --output ${OPENVINOGEN_TGZ_NAME}.tgz +tar -xf ${OPENVINOGEN_TGZ_NAME}.tgz +mv ${OPENVINOGEN_TGZ_NAME} $OPENVINOGEN_DIRNAME +./${OPENVINOGEN_DIRNAME}/install_dependencies/install_openvino_dependencies.sh -y + +rm ${OPENVINOGEN_TGZ_NAME}.tgz + +echo "OpenVINO GenAI installed at `pwd`/$OPENVINOGEN_DIRNAME" +echo "Please source the setupvars.sh script in the OpenVINO GenAI directory to use the OpenVINO GenAI tools." +echo "# source $PWD/$OPENVINOGEN_DIRNAME/setupvars.sh" + From 1921eb711acb404b9204603b299a446902c45229 Mon Sep 17 00:00:00 2001 From: PeterD1524 <53310459+PeterD1524@users.noreply.github.com> Date: Sat, 12 Apr 2025 11:52:12 +0800 Subject: [PATCH 42/49] feat(scripts): install ChatTTS in ubuntu-plugins-deps for WASI-NN ChatTTS CI install ChatTTS in ubuntu-plugins-deps for WASI-NN ChatTTS CI Signed-off-by: PeterD1524 --------- [WasmEdge#4080](https://github.com/WasmEdge/WasmEdge/pull/4080) Signed-off-by: Yi Huang --- Dockerfile.ubuntu-plugins-deps | 6 +++++- scripts/wasi-nn/install-chattts.sh | 24 ++++++++++++++++++++++++ 2 files changed, 29 insertions(+), 1 deletion(-) create mode 100644 scripts/wasi-nn/install-chattts.sh diff --git a/Dockerfile.ubuntu-plugins-deps b/Dockerfile.ubuntu-plugins-deps index c2f48bf..4aaaffc 100644 --- a/Dockerfile.ubuntu-plugins-deps +++ b/Dockerfile.ubuntu-plugins-deps @@ -75,6 +75,9 @@ RUN [ "/bin/bash", "-c", "echo \"source ./openvino_genai/setupvars.sh\" >> .bash COPY wasi-nn/install-onnxruntime.sh . RUN [ "/bin/bash", "install-onnxruntime.sh" ] +COPY wasi-nn/install-chattts.sh . +RUN [ "/bin/bash", "install-chattts.sh" ] + ### cleanup FROM deps-all AS clean-apt @@ -84,6 +87,7 @@ RUN rm -f \ install-pytorch.sh \ install-openvino.sh \ install-onnxruntime.sh \ - install-openvino-genai.sh + install-openvino-genai.sh \ + install-chattts.sh RUN rm -rf /var/lib/apt/lists/* diff --git a/scripts/wasi-nn/install-chattts.sh b/scripts/wasi-nn/install-chattts.sh new file mode 100644 index 0000000..f406d46 --- /dev/null +++ b/scripts/wasi-nn/install-chattts.sh @@ -0,0 +1,24 @@ +#!/usr/bin/env bash +# SPDX-License-Identifier: Apache-2.0 +# SPDX-FileCopyrightText: 2019-2024 Second State INC + +set -e + +apt-get update +apt-get -y install python3 python3-dev + +# Use latest pip +python3 -m venv chattts_venv +source chattts_venv/bin/activate +pip install --upgrade pip + +# Install PyTorch CPU version to save space +pip --python /usr/bin/python3 install --break-system-packages --index-url https://download.pytorch.org/whl/cpu 'torch<=2.6.0' 'torchaudio<=2.6.0' +pip --python /usr/bin/python3 install --break-system-packages chattts==0.2.3 + +# Remove wheel cache +pip --python /usr/bin/python3 cache purge + +# Clean up +deactivate +rm -rf chattts_venv From 00fdddf5b0ea1e2343ac80aa9ea48a1a358a61e1 Mon Sep 17 00:00:00 2001 From: varunrmallya <100590632+varun-r-mallya@users.noreply.github.com> Date: Fri, 18 Apr 2025 03:45:48 +0530 Subject: [PATCH 43/49] chore(lint): lint install-openvino-genai.sh Signed-off-by: varun-r-mallya --------- [WasmEdge#4087](https://github.com/WasmEdge/WasmEdge/pull/4087) Signed-off-by: Yi Huang --- scripts/wasi-nn/install-openvino-genai.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/scripts/wasi-nn/install-openvino-genai.sh b/scripts/wasi-nn/install-openvino-genai.sh index a877ada..2be3691 100644 --- a/scripts/wasi-nn/install-openvino-genai.sh +++ b/scripts/wasi-nn/install-openvino-genai.sh @@ -33,4 +33,3 @@ rm ${OPENVINOGEN_TGZ_NAME}.tgz echo "OpenVINO GenAI installed at `pwd`/$OPENVINOGEN_DIRNAME" echo "Please source the setupvars.sh script in the OpenVINO GenAI directory to use the OpenVINO GenAI tools." echo "# source $PWD/$OPENVINOGEN_DIRNAME/setupvars.sh" - From 9d848c436e36c913ffb1117e99db3648111d056d Mon Sep 17 00:00:00 2001 From: hydai Date: Wed, 4 Jun 2025 21:30:39 +0800 Subject: [PATCH 44/49] chore(docker,ubuntu): bump the llvm from 12 to 18 on Ubuntu 20.04 Signed-off-by: hydai Signed-off-by: Yi Huang --- Dockerfile.ubuntu-base | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/Dockerfile.ubuntu-base b/Dockerfile.ubuntu-base index a6ed627..8ef2aa4 100644 --- a/Dockerfile.ubuntu-base +++ b/Dockerfile.ubuntu-base @@ -21,17 +21,21 @@ FROM base AS deps-20 RUN curl -sSf https://apt.kitware.com/kitware-archive.sh | sh RUN apt-get install -y cmake +RUN wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | apt-key add - \ + && echo "deb http://apt.llvm.org/focal llvm-toolchain-focal-18 main" | tee /etc/apt/sources.list.d/llvm.list + RUN apt-get install -y \ - llvm-12-dev \ - liblld-12-dev \ - clang-12 + llvm-18-dev \ + liblld-18-dev \ + libpolly-18-dev \ + clang-18 -RUN update-alternatives --install /usr/bin/clang clang /usr/bin/clang-12 100 && \ - update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-12 100 && \ - update-alternatives --install /usr/bin/llvm-strip llvm-strip /usr/bin/llvm-strip-12 100 +RUN update-alternatives --install /usr/bin/clang clang /usr/bin/clang-18 100 && \ + update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-18 100 && \ + update-alternatives --install /usr/bin/llvm-strip llvm-strip /usr/bin/llvm-strip-18 100 -ENV CC=/usr/bin/clang-12 -ENV CXX=/usr/bin/clang++-12 +ENV CC=/usr/bin/clang-18 +ENV CXX=/usr/bin/clang++-18 ### deps for ubuntu 22.04 ### FROM base AS deps-22 From c1724f4fe8133c7639a1b9f914deb1b5b40bcd06 Mon Sep 17 00:00:00 2001 From: Yi Date: Fri, 4 Jul 2025 20:53:21 +0800 Subject: [PATCH 45/49] refactor(docker,ubuntu): simplify image names for plugins Signed-off-by: Yi Huang --------- [WasmEdge#4235](https://github.com/WasmEdge/WasmEdge/pull/4235) Signed-off-by: Yi Huang --- docker-bake.ubuntu.hcl | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/docker-bake.ubuntu.hcl b/docker-bake.ubuntu.hcl index f37c51d..b2012d5 100644 --- a/docker-bake.ubuntu.hcl +++ b/docker-bake.ubuntu.hcl @@ -76,7 +76,11 @@ function "tags-backports" { function "tags-simplified" { params = [target, ubuntu, toolchain] - result = target == "base" && toolchain == "clang" ? "ubuntu-${ubuntu}" : "" + result = toolchain == "clang" ? join("-", compact([ + "ubuntu", + ubuntu, + target == "plugins" ? "plugins" : "", + ])) : "" } function "tags" { From 1b394c44bcca7166dba26a49f442b37d827152cf Mon Sep 17 00:00:00 2001 From: Yi Huang Date: Wed, 20 Aug 2025 18:59:06 +0800 Subject: [PATCH 46/49] chore(docker): fix path changed due to project relocation Signed-off-by: Yi Huang --- Dockerfile.manylinux_2_28-base | 2 +- Dockerfile.manylinux_2_28-plugins-deps | 10 +++++----- Dockerfile.ubuntu-plugins-deps | 14 +++++++------- docker-bake.manylinux.hcl | 6 +++--- docker-bake.ubuntu.hcl | 10 +++++----- 5 files changed, 21 insertions(+), 21 deletions(-) diff --git a/Dockerfile.manylinux_2_28-base b/Dockerfile.manylinux_2_28-base index da7b144..c7fee27 100644 --- a/Dockerfile.manylinux_2_28-base +++ b/Dockerfile.manylinux_2_28-base @@ -3,7 +3,7 @@ ARG BASE_IMAGE="quay.io/pypa/manylinux_2_28_x86_64" FROM ${BASE_IMAGE} -ADD SHA256SUM.manylinux_2_28 /root/ +ADD scripts/SHA256SUM.manylinux_2_28 /root/ # See /opt/rh/gcc-toolset-13/enable ENV PATH=/opt/rh/gcc-toolset-13/root/usr/bin${PATH:+:${PATH}} diff --git a/Dockerfile.manylinux_2_28-plugins-deps b/Dockerfile.manylinux_2_28-plugins-deps index 484ee47..3362f32 100644 --- a/Dockerfile.manylinux_2_28-plugins-deps +++ b/Dockerfile.manylinux_2_28-plugins-deps @@ -8,7 +8,7 @@ FROM base AS deps-amd64 RUN cd && (yum check-update || true) && \ yum install -y wget unzip zlib-devel zlib-static elfutils-libelf-devel -COPY wasi-nn/install-pytorch.sh . +COPY scripts/wasi-nn/install-pytorch.sh . ENV PYTORCH_VERSION="2.5.1" ENV PYTORCH_INSTALL_TO="/root" ENV Torch_DIR="/root/libtorch" @@ -22,15 +22,15 @@ RUN cd && (yum check-update || true) && \ ### deps for all ### FROM deps-${TARGETARCH} AS final -COPY opencvmini/install-opencvmini.sh . +COPY scripts/opencvmini/install-opencvmini.sh . ENV OPENCV_VERSION="4.8.0" RUN [ "/bin/bash", "install-opencvmini.sh" ] -COPY wasi-crypto/build-openssl.sh . +COPY scripts/wasi-crypto/build-openssl.sh . ENV OpenSSL_DIR="/root/openssl-1.1.1n/openssl" RUN [ "/bin/bash", "build-openssl.sh" ] -COPY ffmpeg/install-ffmpeg-v6.0.sh . +COPY scripts/ffmpeg/install-ffmpeg-v6.0.sh . RUN [ "/bin/bash", "install-ffmpeg-v6.0.sh" ] ENV PKG_CONFIG_PATH=/root/FFmpeg-n6.0/output/lib/pkgconfig${PKG_CONFIG_PATH:+:${PKG_CONFIG_PATH}} ENV LD_LIBRARY_PATH=/root/FFmpeg-n6.0/output/lib${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}} @@ -38,7 +38,7 @@ ENV LD_LIBRARY_PATH=/root/FFmpeg-n6.0/output/lib${LD_LIBRARY_PATH:+:${LD_LIBRARY ENV OPENVINO_VERSION="2025.0.0" ENV OPENVINO_YEAR="2025" -COPY wasi-nn/install-onnxruntime.sh . +COPY scripts/wasi-nn/install-onnxruntime.sh . RUN [ "/bin/bash", "install-onnxruntime.sh" ] RUN yum clean all diff --git a/Dockerfile.ubuntu-plugins-deps b/Dockerfile.ubuntu-plugins-deps index 4aaaffc..cb745fb 100644 --- a/Dockerfile.ubuntu-plugins-deps +++ b/Dockerfile.ubuntu-plugins-deps @@ -35,7 +35,7 @@ FROM base AS deps-20 WORKDIR /usr/local -COPY ffmpeg/install-ffmpeg-v6.0.sh . +COPY scripts/ffmpeg/install-ffmpeg-v6.0.sh . RUN [ "/bin/bash", "install-ffmpeg-v6.0.sh" ] ENV PKG_CONFIG_PATH=/usr/local/FFmpeg-n6.0/output/lib/pkgconfig${PKG_CONFIG_PATH:+:${PKG_CONFIG_PATH}} ENV LD_LIBRARY_PATH=/usr/local/FFmpeg-n6.0/output/lib${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}} @@ -47,11 +47,11 @@ FROM deps-${UBUNTU_VER} AS deps-all WORKDIR /root -COPY opencvmini/install-opencvmini.sh . +COPY scripts/opencvmini/install-opencvmini.sh . ENV OPENCV_VERSION="4.8.0" RUN [ "/bin/bash", "install-opencvmini.sh" ] -COPY wasi-nn/install-pytorch.sh . +COPY scripts/wasi-nn/install-pytorch.sh . ENV PYTORCH_VERSION="2.5.1" ENV PYTORCH_INSTALL_TO="/usr/local" ENV Torch_DIR="/usr/local/libtorch" @@ -59,8 +59,8 @@ RUN [ "/bin/bash", "install-pytorch.sh" ] ARG UBUNTU_VER -COPY wasi-nn/install-openvino.sh . -COPY wasi-nn/install-openvino-genai.sh . +COPY scripts/wasi-nn/install-openvino.sh . +COPY scripts/wasi-nn/install-openvino-genai.sh . ENV OPENVINO_UBUNTU_VERSION=${UBUNTU_VER} ENV OPENVINO_VERSION="2025.0.0" ENV OPENVINO_YEAR="2025" @@ -72,10 +72,10 @@ RUN [ "/bin/bash", "install-openvino-genai.sh" ] RUN [ "ls", "-al" ] RUN [ "/bin/bash", "-c", "echo \"source ./openvino_genai/setupvars.sh\" >> .bashrc" ] -COPY wasi-nn/install-onnxruntime.sh . +COPY scripts/wasi-nn/install-onnxruntime.sh . RUN [ "/bin/bash", "install-onnxruntime.sh" ] -COPY wasi-nn/install-chattts.sh . +COPY scripts/wasi-nn/install-chattts.sh . RUN [ "/bin/bash", "install-chattts.sh" ] ### cleanup diff --git a/docker-bake.manylinux.hcl b/docker-bake.manylinux.hcl index 0d122ff..48e0cbf 100644 --- a/docker-bake.manylinux.hcl +++ b/docker-bake.manylinux.hcl @@ -1,11 +1,11 @@ target "base" { dockerfile = "Dockerfile.manylinux_2_28-base" - context = "./utils/docker" + context = "." } target "plugins-base" { - dockerfile = "./docker/Dockerfile.manylinux_2_28-plugins-deps" - context = "./utils" + dockerfile = "Dockerfile.manylinux_2_28-plugins-deps" + context = "." } target "x86_64" { diff --git a/docker-bake.ubuntu.hcl b/docker-bake.ubuntu.hcl index b2012d5..07ef7b8 100644 --- a/docker-bake.ubuntu.hcl +++ b/docker-bake.ubuntu.hcl @@ -95,7 +95,7 @@ function "tags" { target "base" { dockerfile = "Dockerfile.ubuntu-base" - context = "./utils/docker" + context = "." matrix = { ubuntu = ["20.04", "22.04", "24.04"] @@ -109,8 +109,8 @@ target "base" { } target "plugins" { - dockerfile = "./docker/Dockerfile.ubuntu-plugins-deps" - context = "./utils" + dockerfile = "Dockerfile.ubuntu-plugins-deps" + context = "." matrix = { ubuntu = ["20.04", "22.04", "24.04"] @@ -135,7 +135,7 @@ target "final" { } dockerfile = "Dockerfile.ubuntu-env" - context = "./utils/docker" + context = "." name = "${parent}-${no-dot(ubuntu)}-${toolchain}" contexts = { @@ -150,7 +150,7 @@ target "final" { target "cuda" { dockerfile = "Dockerfile.ubuntu-cuda" - context = "./utils/docker" + context = "." matrix = { cuda = ["11.3", "12.0"] From da5f4b506ea1e630b8ed54e16a9887dd7710c5fe Mon Sep 17 00:00:00 2001 From: Yi Huang Date: Thu, 4 Sep 2025 18:04:53 +0800 Subject: [PATCH 47/49] refactor(docker,ubuntu): update targets Signed-off-by: Yi Huang --- docker-bake.ubuntu.hcl | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/docker-bake.ubuntu.hcl b/docker-bake.ubuntu.hcl index 07ef7b8..d856572 100644 --- a/docker-bake.ubuntu.hcl +++ b/docker-bake.ubuntu.hcl @@ -1,13 +1,13 @@ group "default" { targets = [ - "cuda", - "final" + "latest", ] } group "latest" { targets = [ "base-2404-clang", + "plugins-2404-clang", ] } @@ -38,6 +38,12 @@ group "noble" { ] } +group "aarch64" { + targets = [ + "base-2004-clang-aarch64", + ] +} + function "no-dot" { params = [ubuntu] result = replace(ubuntu, ".", "") @@ -127,7 +133,7 @@ target "plugins" { } } -target "final" { +target "all-versions" { matrix = { parent = ["base", "plugins"] ubuntu = ["20.04", "22.04", "24.04"] From aa6959efb1f998153f4baf4a9ec09903e8598922 Mon Sep 17 00:00:00 2001 From: Yi Huang Date: Thu, 4 Sep 2025 18:05:58 +0800 Subject: [PATCH 48/49] ci(docker,ubuntu): add workflows to bake images Signed-off-by: Yi Huang --- .github/workflows/docker-ubuntu.yml | 46 +++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 .github/workflows/docker-ubuntu.yml diff --git a/.github/workflows/docker-ubuntu.yml b/.github/workflows/docker-ubuntu.yml new file mode 100644 index 0000000..f77898b --- /dev/null +++ b/.github/workflows/docker-ubuntu.yml @@ -0,0 +1,46 @@ +--- +name: ubuntu + +on: + pull_request: + branches: [main] + paths: + - 'docker-bake.ubuntu.hcl' + - 'Dockerfile.ubuntu*' + - 'scripts/**' + +permissions: {} + +jobs: + bake: + strategy: + fail-fast: false + matrix: + include: + - arch: x86_64 + targets: focal,jammy,noble,cuda + host_runner: ubuntu-latest + - arch: aarch64 + targets: aarch64 + host_runner: ubuntu-24.04-arm + + name: Ubuntu (${{ matrix.arch }}) + runs-on: ${{ matrix.host_runner }} + + steps: + - if: ${{ github.event_name != 'pull_request' }} + name: Login to DockerHub + uses: docker/login-action@v3 + with: + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_ACCESS_TOKEN }} + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Bake and Push + uses: docker/bake-action@v6 + with: + push: ${{ github.event_name != 'pull_request' }} + files: docker-bake.ubuntu.hcl + targets: ${{ matrix.targets }} From ace9e160ec9698865c242559da489611ead1eac8 Mon Sep 17 00:00:00 2001 From: Yi Huang Date: Thu, 4 Sep 2025 17:44:00 +0800 Subject: [PATCH 49/49] ci(docker,manylinux): add workflows to bake images Signed-off-by: Yi Huang --- .github/workflows/docker-manylinux.yml | 46 ++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 .github/workflows/docker-manylinux.yml diff --git a/.github/workflows/docker-manylinux.yml b/.github/workflows/docker-manylinux.yml new file mode 100644 index 0000000..759ebde --- /dev/null +++ b/.github/workflows/docker-manylinux.yml @@ -0,0 +1,46 @@ +--- +name: manylinux + +on: + pull_request: + branches: [main] + paths: + - 'docker-bake.manylinux.hcl' + - 'Dockerfile.manylinux*' + - 'scripts/**' + +permissions: {} + +jobs: + bake: + strategy: + fail-fast: false + matrix: + include: + - arch: x86_64 + targets: x86_64,x86_64-plugins + host_runner: ubuntu-latest + - arch: aarch64 + targets: aarch64,aarch64-plugins + host_runner: ubuntu-24.04-arm + + name: manylinux_2_28 (${{ matrix.arch }}) + runs-on: ${{ matrix.host_runner }} + + steps: + - if: ${{ github.event_name != 'pull_request' }} + name: Login to DockerHub + uses: docker/login-action@v3 + with: + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_ACCESS_TOKEN }} + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Bake and Push + uses: docker/bake-action@v6 + with: + push: ${{ github.event_name != 'pull_request' }} + files: docker-bake.manylinux.hcl + targets: ${{ matrix.targets }}