Browse Source

hccl handle

delete handle

handle

delete handle

fun *

delete head

close handle
tags/v1.1.0
hwjiaorui 5 years ago
parent
commit
846a354474
2 changed files with 12 additions and 6 deletions
  1. +10
    -5
      mindspore/ccsrc/runtime/device/ascend/executor/hccl_dynamic_kernel.cc
  2. +2
    -1
      mindspore/ccsrc/runtime/device/ascend/executor/hccl_dynamic_kernel.h

+ 10
- 5
mindspore/ccsrc/runtime/device/ascend/executor/hccl_dynamic_kernel.cc View File

@@ -88,14 +88,12 @@ void HcclDynamicKernel::StaticShapeExecute() {
void HcclDynamicKernel::Execute() { void HcclDynamicKernel::Execute() {
MS_LOG(INFO) << "Start Execute"; MS_LOG(INFO) << "Start Execute";


auto handle = HcclExecutorManager::GetInstance().handle();
auto EnqueueHcomOperation = auto EnqueueHcomOperation =
(HcclResult(*)(ge::HcomOpertion, std::function<void(HcclResult status)>))dlsym(handle, "EnqueueHcomOpertion");
(HcclResult(*)(ge::HcomOpertion, std::function<void(HcclResult status)>))HcclExecutorManager::GetInstance()
.GetHcomOpertion();
if (EnqueueHcomOperation == nullptr) { if (EnqueueHcomOperation == nullptr) {
MS_LOG(ERROR) << "Failed to get EnqueueHcomOperation function"; MS_LOG(ERROR) << "Failed to get EnqueueHcomOperation function";
if (dlclose(handle) != 0) {
MS_LOG(WARNING) << "Failed to close hcom handle";
}
HcclExecutorManager::GetInstance().CloseHandle();
MS_LOG(EXCEPTION) << "Hccl dynamic kernel execute failed"; MS_LOG(EXCEPTION) << "Hccl dynamic kernel execute failed";
return; return;
} }
@@ -186,6 +184,13 @@ bool HcclExecutorManager::Finalize() {
MS_LOG(INFO) << "Hccl DynamicKernel Finalize success"; MS_LOG(INFO) << "Hccl DynamicKernel Finalize success";
return true; return true;
} }

void *HcclExecutorManager::GetHcomOpertion() { return dlsym(handle_, "EnqueueHcomOpertion"); }
void HcclExecutorManager::CloseHandle() {
if (dlclose(handle_) != 0) {
MS_LOG(WARNING) << "Failed to close hcom handle";
}
}
} // namespace ascend } // namespace ascend
} // namespace device } // namespace device
} // namespace mindspore } // namespace mindspore

+ 2
- 1
mindspore/ccsrc/runtime/device/ascend/executor/hccl_dynamic_kernel.h View File

@@ -66,7 +66,8 @@ class HcclExecutorManager {


bool Initialize(); bool Initialize();
bool Finalize(); bool Finalize();
void *handle() { return handle_; }
void *GetHcomOpertion();
void CloseHandle();


private: private:
HcclExecutorManager() = default; HcclExecutorManager() = default;


Loading…
Cancel
Save