From d9ab932c59cf1d22f22c19b96619024a76aecc32 Mon Sep 17 00:00:00 2001 From: Arne Juul Date: Wed, 30 Nov 2022 12:40:37 +0000 Subject: add container-onnxruntime-bundle --- standalone-container/pom.xml | 1 + 1 file changed, 1 insertion(+) (limited to 'standalone-container') diff --git a/standalone-container/pom.xml b/standalone-container/pom.xml index 590872282ca..5dad287ab97 100644 --- a/standalone-container/pom.xml +++ b/standalone-container/pom.xml @@ -112,6 +112,7 @@ linguistics-components-jar-with-dependencies.jar, model-evaluation-jar-with-dependencies.jar, model-integration-jar-with-dependencies.jar, + container-onnxruntime-bundle.jar, -- cgit v1.2.3 From 2348208f249f0f56eb73a4c4066422e6c88516d8 Mon Sep 17 00:00:00 2001 From: Arne Juul Date: Thu, 1 Dec 2022 21:35:01 +0000 Subject: rename to just "container-onnxruntime" --- CMakeLists.txt | 2 +- cloud-tenant-base-dependencies-enforcer/pom.xml | 2 +- config-model/pom.xml | 2 +- .../model/container/ContainerModelEvaluation.java | 2 +- container-dev/pom.xml | 2 +- container-onnxruntime-bundle/CMakeLists.txt | 2 - container-onnxruntime-bundle/README.md | 4 - container-onnxruntime-bundle/pom.xml | 86 ---------------------- .../src/main/java/ai/onnxruntime/package-info.java | 8 -- .../ai/onnxruntime/providers/package-info.java | 8 -- .../ai/onnxruntime/vespa/OnnxBundleActivator.java | 51 ------------- .../src/main/javadoc/README | 1 - container-onnxruntime/.gitignore | 1 + container-onnxruntime/CMakeLists.txt | 2 + container-onnxruntime/README.md | 4 + container-onnxruntime/pom.xml | 86 ++++++++++++++++++++++ .../src/main/java/ai/onnxruntime/package-info.java | 8 ++ .../ai/onnxruntime/providers/package-info.java | 8 ++ .../ai/vespa/onnxruntime/OnnxBundleActivator.java | 52 +++++++++++++ container-onnxruntime/src/main/javadoc/README | 1 + dist/vespa.spec | 2 +- model-evaluation/pom.xml | 2 +- model-integration/pom.xml | 2 +- pom.xml | 2 +- standalone-container/pom.xml | 2 +- 25 files changed, 172 insertions(+), 170 deletions(-) delete mode 100644 container-onnxruntime-bundle/CMakeLists.txt delete mode 100644 container-onnxruntime-bundle/README.md delete mode 100644 container-onnxruntime-bundle/pom.xml delete mode 100644 container-onnxruntime-bundle/src/main/java/ai/onnxruntime/package-info.java delete mode 100644 container-onnxruntime-bundle/src/main/java/ai/onnxruntime/providers/package-info.java delete mode 100644 container-onnxruntime-bundle/src/main/java/ai/onnxruntime/vespa/OnnxBundleActivator.java delete mode 100644 container-onnxruntime-bundle/src/main/javadoc/README create mode 100644 container-onnxruntime/.gitignore create mode 100644 container-onnxruntime/CMakeLists.txt create mode 100644 container-onnxruntime/README.md create mode 100644 container-onnxruntime/pom.xml create mode 100644 container-onnxruntime/src/main/java/ai/onnxruntime/package-info.java create mode 100644 container-onnxruntime/src/main/java/ai/onnxruntime/providers/package-info.java create mode 100644 container-onnxruntime/src/main/java/ai/vespa/onnxruntime/OnnxBundleActivator.java create mode 100644 container-onnxruntime/src/main/javadoc/README (limited to 'standalone-container') diff --git a/CMakeLists.txt b/CMakeLists.txt index 2db91166c77..c9d7154f9f1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -88,7 +88,7 @@ add_subdirectory(container-apache-http-client-bundle) add_subdirectory(container-core) add_subdirectory(container-disc) add_subdirectory(container-messagebus) -add_subdirectory(container-onnxruntime-bundle) +add_subdirectory(container-onnxruntime) add_subdirectory(container-search) add_subdirectory(container-search-and-docproc) add_subdirectory(container-spifly) diff --git a/cloud-tenant-base-dependencies-enforcer/pom.xml b/cloud-tenant-base-dependencies-enforcer/pom.xml index 93062c3c037..9a640966f6d 100644 --- a/cloud-tenant-base-dependencies-enforcer/pom.xml +++ b/cloud-tenant-base-dependencies-enforcer/pom.xml @@ -116,7 +116,7 @@ com.yahoo.vespa:container-disc:*:provided com.yahoo.vespa:container-documentapi:*:provided com.yahoo.vespa:container-messagebus:*:provided - com.yahoo.vespa:container-onnxruntime-bundle:*:provided + com.yahoo.vespa:container-onnxruntime:*:provided com.yahoo.vespa:container-search-and-docproc:*:provided com.yahoo.vespa:container-search:*:provided com.yahoo.vespa:container:*:provided diff --git a/config-model/pom.xml b/config-model/pom.xml index 6da8ff5a868..46f7efa20d9 100644 --- a/config-model/pom.xml +++ b/config-model/pom.xml @@ -165,7 +165,7 @@ com.yahoo.vespa - container-onnxruntime-bundle + container-onnxruntime ${project.version} provided diff --git a/config-model/src/main/java/com/yahoo/vespa/model/container/ContainerModelEvaluation.java b/config-model/src/main/java/com/yahoo/vespa/model/container/ContainerModelEvaluation.java index b581ba1fc45..49292bd6df7 100644 --- a/config-model/src/main/java/com/yahoo/vespa/model/container/ContainerModelEvaluation.java +++ b/config-model/src/main/java/com/yahoo/vespa/model/container/ContainerModelEvaluation.java @@ -28,7 +28,7 @@ public class ContainerModelEvaluation implements private final static String EVALUATION_BUNDLE_NAME = "model-evaluation"; private final static String INTEGRATION_BUNDLE_NAME = "model-integration"; - private final static String ONNXRUNTIME_BUNDLE_NAME = "container-onnxruntime-bundle.jar"; + private final static String ONNXRUNTIME_BUNDLE_NAME = "container-onnxruntime.jar"; private final static String EVALUATOR_NAME = ModelsEvaluator.class.getName(); private final static String REST_HANDLER_NAME = "ai.vespa.models.handler.ModelsEvaluationHandler"; diff --git a/container-dev/pom.xml b/container-dev/pom.xml index d016f05b6e2..e088c40e20b 100644 --- a/container-dev/pom.xml +++ b/container-dev/pom.xml @@ -80,7 +80,7 @@ com.yahoo.vespa - container-onnxruntime-bundle + container-onnxruntime ${project.version} diff --git a/container-onnxruntime-bundle/CMakeLists.txt b/container-onnxruntime-bundle/CMakeLists.txt deleted file mode 100644 index f19909e8165..00000000000 --- a/container-onnxruntime-bundle/CMakeLists.txt +++ /dev/null @@ -1,2 +0,0 @@ -# Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -install_jar(container-onnxruntime-bundle.jar) diff --git a/container-onnxruntime-bundle/README.md b/container-onnxruntime-bundle/README.md deleted file mode 100644 index 182695f0023..00000000000 --- a/container-onnxruntime-bundle/README.md +++ /dev/null @@ -1,4 +0,0 @@ - -# container-onnxruntime-bundle - -onnxruntime.ai repackaged as a bundle diff --git a/container-onnxruntime-bundle/pom.xml b/container-onnxruntime-bundle/pom.xml deleted file mode 100644 index eca7aecf343..00000000000 --- a/container-onnxruntime-bundle/pom.xml +++ /dev/null @@ -1,86 +0,0 @@ - - - - 4.0.0 - container-onnxruntime-bundle - container-plugin - 8-SNAPSHOT - - com.yahoo.vespa - parent - 8-SNAPSHOT - ../parent/pom.xml - - - true - - - - - com.yahoo.vespa - annotations - ${project.version} - provided - - - - com.yahoo.vespa - jdisc_core - ${project.version} - provided - - - - com.microsoft.onnxruntime - onnxruntime - compile - - - - - - com.yahoo.vespa - bundle-plugin - true - - - org.apache.maven.plugins - maven-compiler-plugin - - - org.apache.maven.plugins - maven-shade-plugin - - - package - - shade - - - false - - - com.microsoft.onnxruntime:* - - ai/onnxruntime/native/** - META-INF/** - - - - - - - ai.onnxruntime.vespa.OnnxBundleActivator - - - - - - - - - - diff --git a/container-onnxruntime-bundle/src/main/java/ai/onnxruntime/package-info.java b/container-onnxruntime-bundle/src/main/java/ai/onnxruntime/package-info.java deleted file mode 100644 index 8b4b7369115..00000000000 --- a/container-onnxruntime-bundle/src/main/java/ai/onnxruntime/package-info.java +++ /dev/null @@ -1,8 +0,0 @@ -// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -/** - * @author arnej - */ -@ExportPackage -package ai.onnxruntime; - -import com.yahoo.osgi.annotation.ExportPackage; diff --git a/container-onnxruntime-bundle/src/main/java/ai/onnxruntime/providers/package-info.java b/container-onnxruntime-bundle/src/main/java/ai/onnxruntime/providers/package-info.java deleted file mode 100644 index af09aa01661..00000000000 --- a/container-onnxruntime-bundle/src/main/java/ai/onnxruntime/providers/package-info.java +++ /dev/null @@ -1,8 +0,0 @@ -// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -/** - * @author arnej - */ -@ExportPackage -package ai.onnxruntime.providers; - -import com.yahoo.osgi.annotation.ExportPackage; diff --git a/container-onnxruntime-bundle/src/main/java/ai/onnxruntime/vespa/OnnxBundleActivator.java b/container-onnxruntime-bundle/src/main/java/ai/onnxruntime/vespa/OnnxBundleActivator.java deleted file mode 100644 index e6a93c73d99..00000000000 --- a/container-onnxruntime-bundle/src/main/java/ai/onnxruntime/vespa/OnnxBundleActivator.java +++ /dev/null @@ -1,51 +0,0 @@ -// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -package ai.onnxruntime.vespa; - -import org.osgi.framework.BundleActivator; -import org.osgi.framework.BundleContext; - -import java.util.logging.Logger; - -/** * @author arnej - * Loads native libraries when the bundle is activated. - * Use system properties to ensure onnxruntime won't try - * to load them itself. - **/ -public class OnnxBundleActivator implements BundleActivator { - - private static final String SKIP_PREFIX = "onnxruntime.native."; - private static final String SKIP_SUFFIX = ".skip"; - private static final String SKIP_VALUE = "true"; - private static final String[] LIBRARY_NAMES = { "onnxruntime", "onnxruntime4j_jni" }; - private static final Logger log = Logger.getLogger(OnnxBundleActivator.class.getName()); - - @Override - public void start(BundleContext ctx) { - for (String libName : LIBRARY_NAMES) { - String skipProp = SKIP_PREFIX + libName + SKIP_SUFFIX; - if (SKIP_VALUE.equals(System.getProperty(skipProp))) { - log.info("already loaded native library "+libName+", skipping"); - } else { - System.setProperty(skipProp, SKIP_VALUE); - log.info("loading native library: "+libName); - try { - System.loadLibrary(libName); - log.fine("loaded native library OK: "+libName); - } catch (Exception e) { - log.warning("Could not load native library '"+libName+"' because: "+e.getMessage()); - } - } - } - } - - @Override - public void stop(BundleContext ctx) { - // not sure how to test that loading and unloading multiple times actually works, - // but this should in theory do the necessary thing. - for (String libName : LIBRARY_NAMES) { - String skipProp = SKIP_PREFIX + libName + SKIP_SUFFIX; - System.clearProperty(skipProp); - log.info("will unload native library: "+libName); - } - } -} diff --git a/container-onnxruntime-bundle/src/main/javadoc/README b/container-onnxruntime-bundle/src/main/javadoc/README deleted file mode 100644 index 97109fa2cc5..00000000000 --- a/container-onnxruntime-bundle/src/main/javadoc/README +++ /dev/null @@ -1 +0,0 @@ -No javadoc available for module diff --git a/container-onnxruntime/.gitignore b/container-onnxruntime/.gitignore new file mode 100644 index 00000000000..916e17c097a --- /dev/null +++ b/container-onnxruntime/.gitignore @@ -0,0 +1 @@ +dependency-reduced-pom.xml diff --git a/container-onnxruntime/CMakeLists.txt b/container-onnxruntime/CMakeLists.txt new file mode 100644 index 00000000000..4eff1d26e60 --- /dev/null +++ b/container-onnxruntime/CMakeLists.txt @@ -0,0 +1,2 @@ +# Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +install_jar(container-onnxruntime.jar) diff --git a/container-onnxruntime/README.md b/container-onnxruntime/README.md new file mode 100644 index 00000000000..ef332b88ba7 --- /dev/null +++ b/container-onnxruntime/README.md @@ -0,0 +1,4 @@ + +# container-onnxruntime + +onnxruntime.ai repackaged as a bundle diff --git a/container-onnxruntime/pom.xml b/container-onnxruntime/pom.xml new file mode 100644 index 00000000000..854a4571028 --- /dev/null +++ b/container-onnxruntime/pom.xml @@ -0,0 +1,86 @@ + + + + 4.0.0 + container-onnxruntime + container-plugin + 8-SNAPSHOT + + com.yahoo.vespa + parent + 8-SNAPSHOT + ../parent/pom.xml + + + true + + + + + com.yahoo.vespa + annotations + ${project.version} + provided + + + + com.yahoo.vespa + jdisc_core + ${project.version} + provided + + + + com.microsoft.onnxruntime + onnxruntime + compile + + + + + + com.yahoo.vespa + bundle-plugin + true + + + org.apache.maven.plugins + maven-compiler-plugin + + + org.apache.maven.plugins + maven-shade-plugin + + + package + + shade + + + false + + + com.microsoft.onnxruntime:* + + ai/onnxruntime/native/** + META-INF/** + + + + + + + ai.vespa.onnxruntime.OnnxBundleActivator + + + + + + + + + + diff --git a/container-onnxruntime/src/main/java/ai/onnxruntime/package-info.java b/container-onnxruntime/src/main/java/ai/onnxruntime/package-info.java new file mode 100644 index 00000000000..8b4b7369115 --- /dev/null +++ b/container-onnxruntime/src/main/java/ai/onnxruntime/package-info.java @@ -0,0 +1,8 @@ +// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +/** + * @author arnej + */ +@ExportPackage +package ai.onnxruntime; + +import com.yahoo.osgi.annotation.ExportPackage; diff --git a/container-onnxruntime/src/main/java/ai/onnxruntime/providers/package-info.java b/container-onnxruntime/src/main/java/ai/onnxruntime/providers/package-info.java new file mode 100644 index 00000000000..af09aa01661 --- /dev/null +++ b/container-onnxruntime/src/main/java/ai/onnxruntime/providers/package-info.java @@ -0,0 +1,8 @@ +// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +/** + * @author arnej + */ +@ExportPackage +package ai.onnxruntime.providers; + +import com.yahoo.osgi.annotation.ExportPackage; diff --git a/container-onnxruntime/src/main/java/ai/vespa/onnxruntime/OnnxBundleActivator.java b/container-onnxruntime/src/main/java/ai/vespa/onnxruntime/OnnxBundleActivator.java new file mode 100644 index 00000000000..6995c28b124 --- /dev/null +++ b/container-onnxruntime/src/main/java/ai/vespa/onnxruntime/OnnxBundleActivator.java @@ -0,0 +1,52 @@ +// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +package ai.vespa.onnxruntime; + +import org.osgi.framework.BundleActivator; +import org.osgi.framework.BundleContext; + +import java.util.logging.Logger; + +/** + * @author arnej + * Loads native libraries when the bundle is activated. + * Use system properties to ensure onnxruntime won't try + * to load them itself. + **/ +public class OnnxBundleActivator implements BundleActivator { + + private static final String SKIP_PREFIX = "onnxruntime.native."; + private static final String SKIP_SUFFIX = ".skip"; + private static final String SKIP_VALUE = "true"; + private static final String[] LIBRARY_NAMES = { "onnxruntime", "onnxruntime4j_jni" }; + private static final Logger log = Logger.getLogger(OnnxBundleActivator.class.getName()); + + @Override + public void start(BundleContext ctx) { + for (String libName : LIBRARY_NAMES) { + String skipProp = SKIP_PREFIX + libName + SKIP_SUFFIX; + if (SKIP_VALUE.equals(System.getProperty(skipProp))) { + log.info("already loaded native library "+libName+", skipping"); + } else { + System.setProperty(skipProp, SKIP_VALUE); + log.info("loading native library: "+libName); + try { + System.loadLibrary(libName); + log.fine("loaded native library OK: "+libName); + } catch (Exception e) { + log.warning("Could not load native library '"+libName+"' because: "+e.getMessage()); + } + } + } + } + + @Override + public void stop(BundleContext ctx) { + // not sure how to test that loading and unloading multiple times actually works, + // but this should in theory do the necessary thing. + for (String libName : LIBRARY_NAMES) { + String skipProp = SKIP_PREFIX + libName + SKIP_SUFFIX; + System.clearProperty(skipProp); + log.info("will unload native library: "+libName); + } + } +} diff --git a/container-onnxruntime/src/main/javadoc/README b/container-onnxruntime/src/main/javadoc/README new file mode 100644 index 00000000000..97109fa2cc5 --- /dev/null +++ b/container-onnxruntime/src/main/javadoc/README @@ -0,0 +1 @@ +No javadoc available for module diff --git a/dist/vespa.spec b/dist/vespa.spec index c58516a9ed8..fc965a3166c 100644 --- a/dist/vespa.spec +++ b/dist/vespa.spec @@ -778,7 +778,7 @@ fi %{_prefix}/lib/jars/config-provisioning-jar-with-dependencies.jar %{_prefix}/lib/jars/container-apache-http-client-bundle-jar-with-dependencies.jar %{_prefix}/lib/jars/container-disc-jar-with-dependencies.jar -%{_prefix}/lib/jars/container-onnxruntime-bundle.jar +%{_prefix}/lib/jars/container-onnxruntime.jar %{_prefix}/lib/jars/container-search-and-docproc-jar-with-dependencies.jar %{_prefix}/lib/jars/container-spifly.jar %{_prefix}/lib/jars/docprocs-jar-with-dependencies.jar diff --git a/model-evaluation/pom.xml b/model-evaluation/pom.xml index 444595bd000..7c2ee046556 100644 --- a/model-evaluation/pom.xml +++ b/model-evaluation/pom.xml @@ -75,7 +75,7 @@ com.yahoo.vespa - container-onnxruntime-bundle + container-onnxruntime ${project.version} provided diff --git a/model-integration/pom.xml b/model-integration/pom.xml index d2d547bce86..43f24301d9a 100644 --- a/model-integration/pom.xml +++ b/model-integration/pom.xml @@ -53,7 +53,7 @@ com.yahoo.vespa - container-onnxruntime-bundle + container-onnxruntime ${project.version} provided diff --git a/pom.xml b/pom.xml index 774fbef7117..bba691a8feb 100644 --- a/pom.xml +++ b/pom.xml @@ -58,7 +58,7 @@ container-disc container-documentapi container-messagebus - container-onnxruntime-bundle + container-onnxruntime container-search-and-docproc container-search container-spifly diff --git a/standalone-container/pom.xml b/standalone-container/pom.xml index 5dad287ab97..805a318e6ed 100644 --- a/standalone-container/pom.xml +++ b/standalone-container/pom.xml @@ -112,7 +112,7 @@ linguistics-components-jar-with-dependencies.jar, model-evaluation-jar-with-dependencies.jar, model-integration-jar-with-dependencies.jar, - container-onnxruntime-bundle.jar, + container-onnxruntime.jar, -- cgit v1.2.3