summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCoprDistGit <infra@openeuler.org>2025-08-20 13:37:28 +0000
committerCoprDistGit <infra@openeuler.org>2025-08-20 13:37:28 +0000
commite58d11067d12b7dae28500eb2cf2e784bb32e6fa (patch)
tree2607d4ede94b093a123d9a21f12eb3f6b93e4703
parent3e527b84d388f7d847d1b22c741e077d79218e38 (diff)
automatic import of ANNC
-rw-r--r--.gitignore4
-rw-r--r--ANNC.spec113
-rw-r--r--sources4
3 files changed, 121 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore
index e69de29..63c06ef 100644
--- a/.gitignore
+++ b/.gitignore
@@ -0,0 +1,4 @@
+/ANNC-v0.0.1-alpha.tar.gz
+/annc_external.tar.gz.aa
+/annc_external.tar.gz.ab
+/annc_external.tar.gz.ac
diff --git a/ANNC.spec b/ANNC.spec
new file mode 100644
index 0000000..42ddf20
--- /dev/null
+++ b/ANNC.spec
@@ -0,0 +1,113 @@
+%global pkg_version %{name}-v%{version}-alpha
+
+%global build_dir %{_builddir}/%{pkg_version}
+
+%global install_libdir %{buildroot}%{_libdir}
+%global install_includedir %{buildroot}%{_includedir}/annc
+
+%global max_jobs 16
+
+%define debug_package %{nil}
+
+Summary: %{name} is an AI compiler designed to optimize and compile ML model into high-performance executable code that can be executed on various targets.
+Name: ANNC
+Version: 0.0.1
+Release: 1
+# Package onnxruntime and SafeInt have MIT License.
+# Package onnx has Apache License 2.0.
+License: MIT and ASL 2.0 and Boost and BSD
+URL: https://gitee.com/openeuler/AI4C
+Source0: %{pkg_version}.tar.gz
+Source1: annc_external.tar.gz.aa
+Source2: annc_external.tar.gz.ab
+Source3: annc_external.tar.gz.ac
+%ifarch x86_64
+Patch1000: x86_64_external_files.patch
+%endif
+
+BuildRequires: cmake >= 3.9.9
+BuildRequires: gcc
+BuildRequires: gcc-c++
+BuildRequires: bzip2
+BuildRequires: python3-devel
+BuildRequires: python3-numpy
+BuildRequires: python3-setuptools
+BuildRequires: python3-pip
+BuildRequires: python3-wheel
+BuildRequires: libstdc++-static
+BuildRequires: git
+BuildRequires: java-11-openjdk
+BuildRequires: java-11-openjdk-devel
+BuildRequires: bazel
+
+%description
+%{name} is is an AI compiler designed to optimize and compile ML model into high-performance executable code that can be executed on various targets.
+
+%prep
+%setup -n %{pkg_version}
+cat %{SOURCE1} %{SOURCE2} %{SOURCE3} > annc_external.tar.gz
+tar -xzf annc_external.tar.gz -C %{_builddir}
+%ifarch x86_64
+%patch 1000 -p1 -d %{_builddir}
+%endif
+
+%build
+cd %{build_dir}
+
+run_bazel_build() {
+ bazel --output_user_root=./output \
+ build -c opt --copt="-DANNC_ENABLED_GRAPH_OPT" \
+ --copt="-DANNC_ENABLED_OPENBLAS" \
+ --copt="-g" \
+ --copt="-DNDBUG" \
+ --jobs=%{max_jobs} \
+ annc/service/cpu:libannc.so
+}
+
+fix_action() {
+ echo "Perfoming fix action..."
+ external_path=$(find . -name "external" | head -n 1)
+ if [ -n "$external_path" ]; then
+ rm -rf $external_path/*
+ cp -r %{_builddir}/external/* $external_path
+ else
+ echo "Not find external directory."
+ fi
+ run_bazel_build
+}
+
+if run_bazel_build; then
+ echo "Build succeeded."
+else
+ echo "Build failed."
+ fix_action
+fi
+
+pushd %{build_dir}/python
+%{__python3} setup.py bdist_wheel
+
+%install
+install -d %{install_includedir}
+install %{build_dir}/annc/service/cpu/kdnn_rewriter.h -t %{install_includedir}
+install %{build_dir}/install/*.patch -t %{install_includedir}
+install %{build_dir}/python/tensorflow/kernels/* -t %{install_includedir}
+install -d %{install_libdir}
+output_path=$(find %{build_dir} -type f -name "libannc.so")
+install ${output_path} -t %{install_libdir}
+
+pushd %{build_dir}/python
+%py3_install
+
+%files
+%{_includedir}/annc/*
+%{_libdir}/*
+%{python3_sitelib}/*
+/usr/bin/annc-opt
+/usr/bin/annc-apply-tf
+
+%changelog
+* Mon May 12 2025 Chenhui Zheng <zhengchenhui1@huawei.com> - 0.0.1-1
+- Type:Init
+- ID:NA
+- SUG:NA
+- DEC:Init ANNC repository
diff --git a/sources b/sources
new file mode 100644
index 0000000..4b882f4
--- /dev/null
+++ b/sources
@@ -0,0 +1,4 @@
+3d3667dd7fe1bdfa620a292d2491aee6 ANNC-v0.0.1-alpha.tar.gz
+e8c54a1e22d33a706f75e2e13cd9351c annc_external.tar.gz.aa
+c93f87cf43828ad4db1d11d882e49c18 annc_external.tar.gz.ab
+0ecfccb382205c728ff5708b6bb94448 annc_external.tar.gz.ac