Remove pass reporter callback to hccl

pull/576/head
taoxiangdong 4 years ago
parent e435b4ea03
commit 71d2fb4d58

@ -22,7 +22,6 @@
#include "graph/load/graph_loader.h" #include "graph/load/graph_loader.h"
#include "init/gelib.h" #include "init/gelib.h"
#include "framework/common/ge_inner_error_codes.h" #include "framework/common/ge_inner_error_codes.h"
#include "opskernel_manager/ops_kernel_builder_manager.h"
namespace { namespace {
const uint32_t kDeviceListIndex = 3; const uint32_t kDeviceListIndex = 3;
@ -150,12 +149,7 @@ ge::Status RegProfReporterCallback(MsprofReporterCallback func) {
GELOGE(rt_ret, "Pass MsprofReporterCallback to runtime failed!!"); GELOGE(rt_ret, "Pass MsprofReporterCallback to runtime failed!!");
return rt_ret; return rt_ret;
} }
// Pass MsprofReporterCallback to hccl in opskernel so initialize // Pass MsprofReporterCallback to hccl
rt_ret = ge::OpsKernelBuilderManager::Instance().RegProfReporterCallBack(reinterpret_cast<void *>(func));
if (rt_ret != ge::SUCCESS) {
GELOGE(rt_ret, "Pass MsprofReporterCallback to hccl failed.");
return rt_ret;
}
} }
return ge::SUCCESS; return ge::SUCCESS;
} }

@ -22,7 +22,6 @@
#include "graph/ge_context.h" #include "graph/ge_context.h"
#include "runtime/base.h" #include "runtime/base.h"
#include "graph/load/new_model_manager/davinci_model.h" #include "graph/load/new_model_manager/davinci_model.h"
#include "opskernel_manager/ops_kernel_builder_manager.h"
namespace { namespace {
const char *const kTrainingTrace = "training_trace"; const char *const kTrainingTrace = "training_trace";
@ -496,11 +495,6 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY Status ProfilingManager::ProfIn
GELOGE(FAILED, "Runtime profiler start failed."); GELOGE(FAILED, "Runtime profiler start failed.");
return FAILED; return FAILED;
} }
Status hccl_ret = OpsKernelBuilderManager::Instance().ProfStart(model_load_mask);
if (hccl_ret != SUCCESS) {
GELOGE(FAILED, "Hccl profiler start failed.");
return FAILED;
}
is_load_profiling_ = true; is_load_profiling_ = true;
GELOGI("Prof init: model load profiling on."); GELOGI("Prof init: model load profiling on.");
} }
@ -530,12 +524,6 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY Status ProfilingManager::ProfFi
GELOGE(FAILED, "Runtime profiler stop failed."); GELOGE(FAILED, "Runtime profiler stop failed.");
return FAILED; return FAILED;
} }
Status hccl_ret = OpsKernelBuilderManager::Instance().ProfStop(PROF_MODEL_LOAD_MASK);
if (hccl_ret != SUCCESS) {
GELOGE(FAILED, "Hccl profiler stop failed.");
return FAILED;
}
for (auto device_id_module : device_id_module_map_) { for (auto device_id_module : device_id_module_map_) {
if (device_id_module.second != 0) { if (device_id_module.second != 0) {
uint32_t device_id = static_cast<uint32_t>(device_id_module.first); uint32_t device_id = static_cast<uint32_t>(device_id_module.first);
@ -661,12 +649,6 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY Status ProfilingManager::ProfSt
GELOGE(FAILED, "Runtime profiler config proc failed."); GELOGE(FAILED, "Runtime profiler config proc failed.");
return FAILED; return FAILED;
} }
Status hccl_ret = OpsKernelBuilderManager::Instance().ProfStart(module);
if (hccl_ret != SUCCESS) {
GELOGE(FAILED, "Hccl profiler start failed.");
return FAILED;
}
if ((module & PROF_MODEL_EXECUTE_MASK) == PROF_MODEL_EXECUTE_MASK) { if ((module & PROF_MODEL_EXECUTE_MASK) == PROF_MODEL_EXECUTE_MASK) {
for (int32_t i = 0; i < device_num; i++) { for (int32_t i = 0; i < device_num; i++) {
if (std::find(device_id_.begin(), device_id_.end(), device_list[i]) == device_id_.end()) { if (std::find(device_id_.begin(), device_id_.end(), device_list[i]) == device_id_.end()) {
@ -708,11 +690,6 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY Status ProfilingManager::ProfSt
GELOGE(FAILED, "Prof stop: runtime profiler config proc failed."); GELOGE(FAILED, "Prof stop: runtime profiler config proc failed.");
return FAILED; return FAILED;
} }
Status hccl_ret = OpsKernelBuilderManager::Instance().ProfStop(module);
if (hccl_ret != SUCCESS) {
GELOGE(FAILED, "Hccl profiler stop failed.");
return FAILED;
}
uint64_t execute_model_mask = module & PROF_MODEL_EXECUTE_MASK; uint64_t execute_model_mask = module & PROF_MODEL_EXECUTE_MASK;
if (execute_model_mask == PROF_MODEL_EXECUTE_MASK) { if (execute_model_mask == PROF_MODEL_EXECUTE_MASK) {
for (int32_t i = 0; i < device_num; i++) { for (int32_t i = 0; i < device_num; i++) {

@ -145,10 +145,6 @@ Status GELib::InnerInitialize(const map<string, string> &options) {
return initOpsBuilderStatus; return initOpsBuilderStatus;
} }
if (is_train_mode_ || (options_.device_id != kDefaultDeviceIdForInfer)) {
GE_CHK_RT_RET(rtSetDevice(options_.device_id));
}
GELOGI("sessionManager initial."); GELOGI("sessionManager initial.");
GE_TIMESTAMP_START(SessionManagerInitialize); GE_TIMESTAMP_START(SessionManagerInitialize);
Status initSmStatus = sessionManager_.Initialize(options); Status initSmStatus = sessionManager_.Initialize(options);
@ -342,7 +338,7 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY Status GELib::InitSystemWithOpt
// set device id // set device id
GELOGI("set logical device id:%u", options.device_id); GELOGI("set logical device id:%u", options.device_id);
GetContext().SetCtxDeviceId(static_cast<uint32_t>(options.device_id)); GetContext().SetCtxDeviceId(static_cast<uint32_t>(options.device_id));
// GE_CHK_RT_RET(rtSetDevice(options.device_id)); GE_CHK_RT_RET(rtSetDevice(options.device_id));
// In the scenario that the automatic add fusion is set, but there is no cleanaddr operator, // In the scenario that the automatic add fusion is set, but there is no cleanaddr operator,
// maybe need to check it // maybe need to check it

@ -168,31 +168,4 @@ Status OpsKernelBuilderManager::GenerateTask(const Node &node,
return SUCCESS; return SUCCESS;
} }
Status OpsKernelBuilderManager::RegProfReporterCallBack(void *func) const { } // namespace ge
GE_CHECK_NOTNULL(func);
for (auto it = ops_kernel_builders_.begin(); it != ops_kernel_builders_.end(); it++) {
GE_CHK_STATUS_RET(it->second->RegProfReporterCallBack(func),
"Failed to invoke RegProfReporterCallBack.");
}
GELOGD("Done invoking RegProfReporterCallBack successfully");
return SUCCESS;
}
Status OpsKernelBuilderManager::ProfStart(uint64_t prof_config) const {
for (auto it = ops_kernel_builders_.begin(); it != ops_kernel_builders_.end(); it++) {
GE_CHK_STATUS_RET(it->second->ProfStart(prof_config),
"Failed to invoke ProfStart.");
}
GELOGD("Done invoking ProfStart successfully");
return SUCCESS;
}
Status OpsKernelBuilderManager::ProfStop(uint64_t prof_config) const {
for (auto it = ops_kernel_builders_.begin(); it != ops_kernel_builders_.end(); it++) {
GE_CHK_STATUS_RET(it->second->ProfStop(prof_config),
"Failed to invoke ProfStop.");
}
GELOGD("Done invoking ProfStop successfully");
return SUCCESS;
}
} // namespace ge

@ -46,12 +46,6 @@ class OpsKernelBuilderManager {
Status GenerateTask(const Node &node, RunContext &context, Status GenerateTask(const Node &node, RunContext &context,
std::vector<domi::TaskDef> &tasks) const; std::vector<domi::TaskDef> &tasks) const;
Status RegProfReporterCallBack(void *func) const;
Status ProfStart(uint64_t prof_config) const;
Status ProfStop(uint64_t prof_config) const;
private: private:
OpsKernelBuilderManager() = default; OpsKernelBuilderManager() = default;
static Status GetLibPaths(const std::map<std::string, std::string> &options, std::string &lib_paths); static Status GetLibPaths(const std::map<std::string, std::string> &options, std::string &lib_paths);

Loading…
Cancel
Save