krickert commented on code in PR #1462:
URL: https://github.com/apache/opennlp/pull/1462#discussion_r4247441684


##########
opennlp-core/opennlp-ml/opennlp-dl/src/test/java/opennlp/dl/AbstractDLColdStartCudaTest.java:
##########
@@ -0,0 +1,148 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package opennlp.dl;
+
+import java.io.IOException;
+import java.nio.charset.StandardCharsets;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.util.List;
+import java.util.concurrent.TimeUnit;
+
+import ai.onnxruntime.OrtEnvironment;
+import ai.onnxruntime.OrtException;
+import ai.onnxruntime.OrtProvider;
+import ai.onnxruntime.OrtSession;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.io.TempDir;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assertions.fail;
+import static org.junit.jupiter.api.Assumptions.assumeTrue;
+
+/**
+ * Tests that {@link AbstractDL#sessionOptions(InferenceOptions)} can request 
the CUDA execution
+ * provider as the first ONNX Runtime call of a JVM. The request either adds 
the provider or is
+ * rejected because the CUDA provider library cannot be loaded, never because 
ONNX Runtime's
+ * default logger is missing.
+ *
+ * <p>Whether ONNX Runtime has been used is process-wide state that the other 
tests of the module
+ * change, so the request runs in a child JVM through {@link 
FirstCudaRequest}. The test runs
+ * where ONNX Runtime has the CUDA provider, which is {@code opennlp-dl-gpu}; 
a CUDA device is not
+ * needed.</p>
+ */
+class AbstractDLColdStartCudaTest {
+
+  private static final String ADDED = "ADDED";
+
+  private static final String REJECTED = "REJECTED ";
+
+  private static final String DEFAULT_LOGGER_FAILURE = "DefaultLogger";
+
+  private static final String CUDA_PROVIDER_FAILURE =

Review Comment:
   @/tmp/paste-1462-coldstart59.md



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to