From 12224c88b7fb16964099174ba2ffd2eb5231dcc5 Mon Sep 17 00:00:00 2001 From: Ryan Hill Date: Mon, 10 May 2021 13:03:17 -0700 Subject: [PATCH] Java fix for CPU build --- java/src/main/java/ai/onnxruntime/OnnxRuntime.java | 3 +++ onnxruntime/python/onnxruntime_pybind_state.cc | 3 +-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/java/src/main/java/ai/onnxruntime/OnnxRuntime.java b/java/src/main/java/ai/onnxruntime/OnnxRuntime.java index 0060773b4d..dc80666aac 100644 --- a/java/src/main/java/ai/onnxruntime/OnnxRuntime.java +++ b/java/src/main/java/ai/onnxruntime/OnnxRuntime.java @@ -219,6 +219,9 @@ final class OnnxRuntime { logger.log(Level.FINE, "Extracted native library '" + library + "' from resource path"); } } + } catch(Exception e) { + if(systemLoad) // We only throw if we're loading the library, otherwise failure is okay + throw e; } finally { cleanUp(tempFile, !systemLoad); } diff --git a/onnxruntime/python/onnxruntime_pybind_state.cc b/onnxruntime/python/onnxruntime_pybind_state.cc index dd9cb00ad2..b94614bca0 100644 --- a/onnxruntime/python/onnxruntime_pybind_state.cc +++ b/onnxruntime/python/onnxruntime_pybind_state.cc @@ -492,7 +492,7 @@ static AllocatorPtr GetCudaAllocator(OrtDevice::DeviceId id) { if (id_to_allocator_map->find(id) == id_to_allocator_map->end()) { // TODO: Expose knobs so that users can set fields associated with OrtArenaCfg so that we can pass it to the following method - id_to_allocator_map->insert({id, GetProviderInfo_CUDA()->CreateCudaAllocator(id, gpu_mem_limit, arena_extend_strategy, external_allocator_info)}); + id_to_allocator_map->insert({id, GetProviderInfo_CUDA()->CreateCudaAllocator(id, gpu_mem_limit, arena_extend_strategy, external_allocator_info, nullptr)}); } return (*id_to_allocator_map)[id]; @@ -2155,4 +2155,3 @@ onnxruntime::Environment& GetEnv() { } // namespace python } // namespace onnxruntime -