diff --git a/mindspore/lite/java/src/main/java/com/mindspore/ModelParallelRunner.java b/mindspore/lite/java/src/main/java/com/mindspore/ModelParallelRunner.java index 8634d24eb0a..c975046eb7a 100644 --- a/mindspore/lite/java/src/main/java/com/mindspore/ModelParallelRunner.java +++ b/mindspore/lite/java/src/main/java/com/mindspore/ModelParallelRunner.java @@ -68,6 +68,10 @@ public class ModelParallelRunner { rwLock.writeLock().unlock(); return false; } + if (modelParallelRunnerPtr != 0L){ + rwLock.writeLock().unlock(); + return true; + } modelParallelRunnerPtr = this.init(modelPath, runnerConfig.getRunnerConfigPtr()); rwLock.writeLock().unlock(); return modelParallelRunnerPtr != 0L; @@ -85,6 +89,10 @@ public class ModelParallelRunner { rwLock.writeLock().unlock(); return false; } + if (modelParallelRunnerPtr != 0L){ + rwLock.writeLock().unlock(); + return true; + } modelParallelRunnerPtr = this.init(modelPath, 0L); rwLock.writeLock().unlock(); return modelParallelRunnerPtr != 0; diff --git a/mindspore/lite/src/runtime/cxx_api/model_pool/resource_manager.cc b/mindspore/lite/src/runtime/cxx_api/model_pool/resource_manager.cc index 5bf06a1eccf..8bffa05eecb 100644 --- a/mindspore/lite/src/runtime/cxx_api/model_pool/resource_manager.cc +++ b/mindspore/lite/src/runtime/cxx_api/model_pool/resource_manager.cc @@ -204,6 +204,10 @@ Status ResourceManager::DistinguishPhysicalAndLogicalByNuma(std::vectorSetPredictTaskDone(); + predict_task_queue_ = nullptr; + } std::unique_lock l(mtx_init_); is_destroy_ = true; is_launch_ = true;