| @@ -24,7 +24,7 @@ usage() | |||||
| { | { | ||||
| echo "Usage:" | echo "Usage:" | ||||
| echo "bash build.sh [-d] [-r] [-v] [-c on|off] [-t on|off] [-g on|off] [-h] [-b ge] [-m infer|train] \\" | echo "bash build.sh [-d] [-r] [-v] [-c on|off] [-t on|off] [-g on|off] [-h] [-b ge] [-m infer|train] \\" | ||||
| echo " [-a on|off] [-Q on|off] [-S on|off] [-p on|off] [-i] [-L] [-R] [-D on|off] [-j[n]] [-e gpu|d|cpu] \\" | |||||
| echo " [-a on|off] [-Q on|off] [-p on|off] [-i] [-L] [-R] [-D on|off] [-j[n]] [-e gpu|d|cpu] \\" | |||||
| echo " [-P on|off] [-z [on|off]] [-M on|off] [-V 9.2|10.1] [-I] [-K] [-B on|off] [-E] [-l on|off]" | echo " [-P on|off] [-z [on|off]] [-M on|off] [-V 9.2|10.1] [-I] [-K] [-B on|off] [-E] [-l on|off]" | ||||
| echo "" | echo "" | ||||
| echo "Options:" | echo "Options:" | ||||
| @@ -48,7 +48,6 @@ usage() | |||||
| echo " -P Enable dump anf graph to file in ProtoBuffer format, default on" | echo " -P Enable dump anf graph to file in ProtoBuffer format, default on" | ||||
| echo " -Q Enable dump memory, default off" | echo " -Q Enable dump memory, default off" | ||||
| echo " -D Enable dumping of function graph ir, default on" | echo " -D Enable dumping of function graph ir, default on" | ||||
| echo " -S Enable async data dump, default off" | |||||
| echo " -z Compile dataset & mindrecord, default on" | echo " -z Compile dataset & mindrecord, default on" | ||||
| echo " -M Enable MPI and NCCL for GPU training, gpu default on" | echo " -M Enable MPI and NCCL for GPU training, gpu default on" | ||||
| echo " -V Specify the minimum required cuda version, default CUDA 10.1" | echo " -V Specify the minimum required cuda version, default CUDA 10.1" | ||||
| @@ -89,7 +88,6 @@ checkopts() | |||||
| ENABLE_TIMELINE="off" | ENABLE_TIMELINE="off" | ||||
| ENABLE_DUMP2PROTO="on" | ENABLE_DUMP2PROTO="on" | ||||
| ENABLE_DUMPE2E="off" | ENABLE_DUMPE2E="off" | ||||
| ENABLE_DATA_DUMP="off" | |||||
| ENABLE_DUMP_IR="on" | ENABLE_DUMP_IR="on" | ||||
| COMPILE_MINDDATA="on" | COMPILE_MINDDATA="on" | ||||
| ENABLE_MPI="off" | ENABLE_MPI="off" | ||||
| @@ -104,7 +102,7 @@ checkopts() | |||||
| ENABLE_PYTHON="on" | ENABLE_PYTHON="on" | ||||
| # Process the options | # Process the options | ||||
| while getopts 'drvj:c:t:hsb:a:g:p:ie:m:l:I:LRP:Q:S:D:zM:V:K:sB:E' opt | |||||
| while getopts 'drvj:c:t:hsb:a:g:p:ie:m:l:I:LRP:Q:D:zM:V:K:sB:E' opt | |||||
| do | do | ||||
| OPTARG=$(echo ${OPTARG} | tr '[A-Z]' '[a-z]') | OPTARG=$(echo ${OPTARG} | tr '[A-Z]' '[a-z]') | ||||
| case "${opt}" in | case "${opt}" in | ||||
| @@ -220,11 +218,6 @@ checkopts() | |||||
| ENABLE_DUMPE2E="$OPTARG" | ENABLE_DUMPE2E="$OPTARG" | ||||
| echo "enable dump end to end" | echo "enable dump end to end" | ||||
| ;; | ;; | ||||
| S) | |||||
| check_on_off $OPTARG S | |||||
| ENABLE_DATA_DUMP="$OPTARG" | |||||
| echo "enable data dump" | |||||
| ;; | |||||
| D) | D) | ||||
| check_on_off $OPTARG D | check_on_off $OPTARG D | ||||
| ENABLE_DUMP_IR="$OPTARG" | ENABLE_DUMP_IR="$OPTARG" | ||||
| @@ -328,9 +321,6 @@ build_mindspore() | |||||
| if [[ "X$ENABLE_DUMPE2E" = "Xon" ]]; then | if [[ "X$ENABLE_DUMPE2E" = "Xon" ]]; then | ||||
| CMAKE_ARGS="${CMAKE_ARGS} -DENABLE_DUMP_E2E=ON" | CMAKE_ARGS="${CMAKE_ARGS} -DENABLE_DUMP_E2E=ON" | ||||
| fi | fi | ||||
| if [[ "X$ENABLE_DATA_DUMP" = "Xon" ]]; then | |||||
| CMAKE_ARGS="${CMAKE_ARGS} -DENABLE_DATA_DUMP=ON" | |||||
| fi | |||||
| CMAKE_ARGS="${CMAKE_ARGS} -DENABLE_DUMP_IR=${ENABLE_DUMP_IR}" | CMAKE_ARGS="${CMAKE_ARGS} -DENABLE_DUMP_IR=${ENABLE_DUMP_IR}" | ||||
| CMAKE_ARGS="${CMAKE_ARGS} -DENABLE_PYTHON=${ENABLE_PYTHON}" | CMAKE_ARGS="${CMAKE_ARGS} -DENABLE_PYTHON=${ENABLE_PYTHON}" | ||||
| if [[ "X$ENABLE_MPI" = "Xon" ]]; then | if [[ "X$ENABLE_MPI" = "Xon" ]]; then | ||||
| @@ -116,10 +116,6 @@ if(ENABLE_DUMP_E2E) | |||||
| add_compile_definitions(ENABLE_DUMP_E2E) | add_compile_definitions(ENABLE_DUMP_E2E) | ||||
| endif() | endif() | ||||
| if(ENABLE_DATA_DUMP) | |||||
| add_compile_definitions(ENABLE_DATA_DUMP) | |||||
| endif() | |||||
| if(ENABLE_DEBUGGER) | if(ENABLE_DEBUGGER) | ||||
| add_compile_definitions(ENABLE_DEBUGGER) | add_compile_definitions(ENABLE_DEBUGGER) | ||||
| endif() | endif() | ||||
| @@ -21,9 +21,7 @@ | |||||
| #include <memory> | #include <memory> | ||||
| #include "framework/ge_runtime/task_info.h" | #include "framework/ge_runtime/task_info.h" | ||||
| #include "backend/kernel_compiler/kernel.h" | #include "backend/kernel_compiler/kernel.h" | ||||
| #ifdef ENABLE_DATA_DUMP | |||||
| #include "debug/data_dump_parser.h" | #include "debug/data_dump_parser.h" | ||||
| #endif | |||||
| using TaskInfoPtr = std::shared_ptr<ge::model_runner::TaskInfo>; | using TaskInfoPtr = std::shared_ptr<ge::model_runner::TaskInfo>; | ||||
| namespace mindspore { | namespace mindspore { | ||||
| @@ -34,13 +32,7 @@ class AscendKernelMod : public KernelMod { | |||||
| const std::vector<AddressPtr> &, uint32_t) = 0; | const std::vector<AddressPtr> &, uint32_t) = 0; | ||||
| uint32_t block_dim() { return block_dim_; } | uint32_t block_dim() { return block_dim_; } | ||||
| uint32_t stream_id() { return stream_id_; } | uint32_t stream_id() { return stream_id_; } | ||||
| virtual bool NeedDump() { | |||||
| #ifdef ENABLE_DATA_DUMP | |||||
| return DataDumpParser::GetInstance().NeedDump(kernel_name_); | |||||
| #else | |||||
| return false; | |||||
| #endif | |||||
| } | |||||
| virtual bool NeedDump() { return DataDumpParser::GetInstance().NeedDump(kernel_name_); } | |||||
| protected: | protected: | ||||
| uint32_t block_dim_{1}; | uint32_t block_dim_{1}; | ||||
| @@ -23,9 +23,7 @@ if (ENABLE_D) | |||||
| list(APPEND _DEBUG_SRC_LIST | list(APPEND _DEBUG_SRC_LIST | ||||
| "${CMAKE_CURRENT_SOURCE_DIR}/common.cc" | "${CMAKE_CURRENT_SOURCE_DIR}/common.cc" | ||||
| ) | ) | ||||
| if (ENABLE_DATA_DUMP) | |||||
| list(APPEND _DEBUG_SRC_LIST "${CMAKE_CURRENT_SOURCE_DIR}/data_dump_parser.cc") | |||||
| endif(ENABLE_DATA_DUMP) | |||||
| list(APPEND _DEBUG_SRC_LIST "${CMAKE_CURRENT_SOURCE_DIR}/data_dump_parser.cc") | |||||
| endif() | endif() | ||||
| if (ENABLE_DUMP_E2E) | if (ENABLE_DUMP_E2E) | ||||
| @@ -35,7 +35,7 @@ void DataDumpParser::ResetParam() { | |||||
| bool DataDumpParser::DumpEnabled() const { | bool DataDumpParser::DumpEnabled() const { | ||||
| auto enable_dump = std::getenv(kEnableDataDump); | auto enable_dump = std::getenv(kEnableDataDump); | ||||
| if (!enable_dump) { | if (!enable_dump) { | ||||
| MS_LOG(WARNING) << "[DataDump] enable dump is null. Please export ENABLE_DATA_DUMP"; | |||||
| MS_LOG(INFO) << "[DataDump] enable dump is null. Please export ENABLE_DATA_DUMP"; | |||||
| return false; | return false; | ||||
| } | } | ||||
| @@ -49,6 +49,10 @@ using mindspore::device::ascend::tasksink::TaskGenerator; | |||||
| using mindspore::kernel::tbe::TbeUtils; | using mindspore::kernel::tbe::TbeUtils; | ||||
| using std::vector; | using std::vector; | ||||
| constexpr uint32_t kTupleTaskId = 0; | |||||
| constexpr uint32_t kTupleStreamId = 1; | |||||
| constexpr uint32_t kTupleArgs = 2; | |||||
| namespace mindspore { | namespace mindspore { | ||||
| namespace device { | namespace device { | ||||
| namespace ascend { | namespace ascend { | ||||
| @@ -91,13 +95,11 @@ std::string GetRankId() { | |||||
| AscendKernelRuntime::~AscendKernelRuntime() { graph_model_map_.clear(); } | AscendKernelRuntime::~AscendKernelRuntime() { graph_model_map_.clear(); } | ||||
| void AscendKernelRuntime::ClearGraphModelMap() { | void AscendKernelRuntime::ClearGraphModelMap() { | ||||
| #ifdef ENABLE_DATA_DUMP | |||||
| for (auto &iter : graph_data_dumper_) { | for (auto &iter : graph_data_dumper_) { | ||||
| MS_LOG(INFO) << "[DataDump] Unload data dumper:" << iter.first; | MS_LOG(INFO) << "[DataDump] Unload data dumper:" << iter.first; | ||||
| iter.second->UnloadDumpInfo(); | iter.second->UnloadDumpInfo(); | ||||
| } | } | ||||
| graph_data_dumper_.clear(); | graph_data_dumper_.clear(); | ||||
| #endif | |||||
| for (auto &iter : graph_model_map_) { | for (auto &iter : graph_model_map_) { | ||||
| MS_LOG(INFO) << "Ge UnloadModel " << iter.first; | MS_LOG(INFO) << "Ge UnloadModel " << iter.first; | ||||
| auto ret = ModelRunner::Instance().UnloadModel(iter.first); | auto ret = ModelRunner::Instance().UnloadModel(iter.first); | ||||
| @@ -167,9 +169,7 @@ bool AscendKernelRuntime::Init() { | |||||
| } | } | ||||
| #endif | #endif | ||||
| #ifdef ENABLE_DATA_DUMP | |||||
| DataDumpParser::GetInstance().ParseDumpConfig(); | DataDumpParser::GetInstance().ParseDumpConfig(); | ||||
| #endif | |||||
| // Start up profiling before rtSetDevice | // Start up profiling before rtSetDevice | ||||
| ret = ProfilingManager::GetInstance().StartupProfiling(device_id_); | ret = ProfilingManager::GetInstance().StartupProfiling(device_id_); | ||||
| @@ -510,9 +510,8 @@ bool AscendKernelRuntime::LoadTask(const session::KernelGraph *graph) { | |||||
| ProfilingUtils::ReportProfilingData(task_ids, stream_ids, NOT_NULL(graph)); | ProfilingUtils::ReportProfilingData(task_ids, stream_ids, NOT_NULL(graph)); | ||||
| } | } | ||||
| #ifdef ENABLE_DATA_DUMP | |||||
| LaunchDataDump(NOT_NULL(graph)); | LaunchDataDump(NOT_NULL(graph)); | ||||
| #endif | |||||
| if (!ModelRunner::Instance().LoadModelComplete(model_iter->first)) { | if (!ModelRunner::Instance().LoadModelComplete(model_iter->first)) { | ||||
| MS_LOG(ERROR) << "Call ge runtime LoadModelComplete failed"; | MS_LOG(ERROR) << "Call ge runtime LoadModelComplete failed"; | ||||
| return false; | return false; | ||||
| @@ -520,7 +519,6 @@ bool AscendKernelRuntime::LoadTask(const session::KernelGraph *graph) { | |||||
| return true; | return true; | ||||
| } | } | ||||
| #ifdef ENABLE_DATA_DUMP | |||||
| void AscendKernelRuntime::LaunchDataDump(NotNull<const session::KernelGraph *> graph) { | void AscendKernelRuntime::LaunchDataDump(NotNull<const session::KernelGraph *> graph) { | ||||
| if (!DataDumpParser::GetInstance().DumpEnabled()) { | if (!DataDumpParser::GetInstance().DumpEnabled()) { | ||||
| return; | return; | ||||
| @@ -534,21 +532,12 @@ void AscendKernelRuntime::LaunchDataDump(NotNull<const session::KernelGraph *> g | |||||
| MS_LOG(WARNING) << "[DataDump] Insert graphId:" << graph->graph_id() << " data dumper failed"; | MS_LOG(WARNING) << "[DataDump] Insert graphId:" << graph->graph_id() << " data dumper failed"; | ||||
| } | } | ||||
| } | } | ||||
| #endif | |||||
| void AscendKernelRuntime::DebugTaskIdName(GraphId graph_id) { | void AscendKernelRuntime::DebugTaskIdName(GraphId graph_id) { | ||||
| auto task_ids = ModelRunner::Instance().GetTaskIdList(graph_id); | |||||
| auto graph_task_names = ProfilingUtils::graph_kernel_name(); | |||||
| auto iter = graph_task_names.find(graph_id); | |||||
| if (iter != graph_task_names.end()) { | |||||
| const auto &task_names = iter->second; | |||||
| if (task_ids.size() != task_names.size()) { | |||||
| MS_LOG(WARNING) << "Task_ids and task_names size not match"; | |||||
| return; | |||||
| } | |||||
| for (size_t i = 0; i < task_ids.size(); ++i) { | |||||
| MS_LOG(INFO) << "Task_id:" << task_ids[i] << " task_name:" << task_names[i]; | |||||
| } | |||||
| auto runtime_info_map = ModelRunner::Instance().GetRuntimeInfoMap(graph_id); | |||||
| for (auto iter : runtime_info_map) { | |||||
| MS_LOG(WARNING) << "Task name:" << iter.first << " task_id:" << std::get<kTupleTaskId>(*iter.second) | |||||
| << " stream_id:" << std::get<kTupleStreamId>(*iter.second); | |||||
| } | } | ||||
| } | } | ||||
| @@ -24,10 +24,8 @@ | |||||
| #include "framework/ge_runtime/davinci_model.h" | #include "framework/ge_runtime/davinci_model.h" | ||||
| #include "runtime/device/kernel_runtime_manager.h" | #include "runtime/device/kernel_runtime_manager.h" | ||||
| #include "backend/session/session_basic.h" | #include "backend/session/session_basic.h" | ||||
| #ifdef ENABLE_DATA_DUMP | |||||
| #include "debug/data_dump_parser.h" | #include "debug/data_dump_parser.h" | ||||
| #include "runtime/device/ascend/dump/data_dumper.h" | #include "runtime/device/ascend/dump/data_dumper.h" | ||||
| #endif | |||||
| using ge::model_runner::TaskInfo; | using ge::model_runner::TaskInfo; | ||||
| using std::unordered_map; | using std::unordered_map; | ||||
| @@ -70,10 +68,8 @@ class AscendKernelRuntime : public KernelRuntime { | |||||
| bool initialized_{false}; | bool initialized_{false}; | ||||
| unordered_map<GraphId, vector<std::shared_ptr<TaskInfo>>> task_map_; | unordered_map<GraphId, vector<std::shared_ptr<TaskInfo>>> task_map_; | ||||
| unordered_map<GraphId, std::shared_ptr<ge::model_runner::DavinciModel>> graph_model_map_; | unordered_map<GraphId, std::shared_ptr<ge::model_runner::DavinciModel>> graph_model_map_; | ||||
| #ifdef ENABLE_DATA_DUMP | |||||
| void LaunchDataDump(NotNull<const session::KernelGraph *> graph); | void LaunchDataDump(NotNull<const session::KernelGraph *> graph); | ||||
| unordered_map<GraphId, std::shared_ptr<DataDumper>> graph_data_dumper_; | unordered_map<GraphId, std::shared_ptr<DataDumper>> graph_data_dumper_; | ||||
| #endif | |||||
| }; | }; | ||||
| MS_REG_KERNEL_RUNTIME(kAscendDevice, AscendKernelRuntime); | MS_REG_KERNEL_RUNTIME(kAscendDevice, AscendKernelRuntime); | ||||
| @@ -13,7 +13,6 @@ | |||||
| * See the License for the specific language governing permissions and | * See the License for the specific language governing permissions and | ||||
| * limitations under the License. | * limitations under the License. | ||||
| */ | */ | ||||
| #ifdef ENABLE_DATA_DUMP | |||||
| #include "runtime/device/ascend/dump/data_dumper.h" | #include "runtime/device/ascend/dump/data_dumper.h" | ||||
| #include <map> | #include <map> | ||||
| @@ -279,4 +278,3 @@ void DumpKernelInput(const CNodePtr &kernel, void *args, NotNull<aicpu::dump::Ta | |||||
| } // namespace ascend | } // namespace ascend | ||||
| } // namespace device | } // namespace device | ||||
| } // namespace mindspore | } // namespace mindspore | ||||
| #endif | |||||
| @@ -16,7 +16,6 @@ | |||||
| #ifndef MINDSPORE_MINDSPORE_CCSRC_DEVICE_ASCEND_DUMP_DATADUMP_H_ | #ifndef MINDSPORE_MINDSPORE_CCSRC_DEVICE_ASCEND_DUMP_DATADUMP_H_ | ||||
| #define MINDSPORE_MINDSPORE_CCSRC_DEVICE_ASCEND_DUMP_DATADUMP_H_ | #define MINDSPORE_MINDSPORE_CCSRC_DEVICE_ASCEND_DUMP_DATADUMP_H_ | ||||
| #ifdef ENABLE_DATA_DUMP | |||||
| #include <tuple> | #include <tuple> | ||||
| #include <map> | #include <map> | ||||
| #include <memory> | #include <memory> | ||||
| @@ -65,5 +64,4 @@ class DataDumper { | |||||
| } // namespace ascend | } // namespace ascend | ||||
| } // namespace device | } // namespace device | ||||
| } // namespace mindspore | } // namespace mindspore | ||||
| #endif | |||||
| #endif // MINDSPORE_MINDSPORE_CCSRC_DEVICE_ASCEND_DUMP_DATADUMP_H_ | #endif // MINDSPORE_MINDSPORE_CCSRC_DEVICE_ASCEND_DUMP_DATADUMP_H_ | ||||
| @@ -15,6 +15,7 @@ | |||||
| */ | */ | ||||
| #include "runtime/device/ascend/tasksink/task_generator.h" | #include "runtime/device/ascend/tasksink/task_generator.h" | ||||
| #include "runtime/device/ascend/dump/data_dumper.h" | |||||
| namespace mindspore { | namespace mindspore { | ||||
| namespace device { | namespace device { | ||||
| @@ -25,6 +26,9 @@ bool TaskGenerator::GenTasks(const std::vector<CNodePtr> &anf_node_list, std::ve | |||||
| return true; | return true; | ||||
| } | } | ||||
| } // namespace tasksink | } // namespace tasksink | ||||
| void DataDumper::LoadDumpInfo() {} | |||||
| void DataDumper::UnloadDumpInfo() {} | |||||
| DataDumper::~DataDumper() {} | |||||
| } // namespace ascend | } // namespace ascend | ||||
| } // namespace device | } // namespace device | ||||
| } // namespace mindspore | } // namespace mindspore | ||||