• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /**
2  * Copyright 2021 Huawei Technologies Co., Ltd
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #ifndef MINDSPORE_MINDSPORE_CCSRC_DEBUG_DATA_DUMP_DUMP_UTILS_H_
18 #define MINDSPORE_MINDSPORE_CCSRC_DEBUG_DATA_DUMP_DUMP_UTILS_H_
19 
20 #include <map>
21 #include <string>
22 
23 #include "backend/session/kernel_graph.h"
24 #include "runtime/device/device_address.h"
25 
26 namespace mindspore {
27 static const size_t PARAMETER_OUTPUT_INDEX = 0;
28 static const size_t VALUE_NODE_OUTPUT_INDEX = 0;
29 
30 std::string GenerateDumpPath(uint32_t graph_id, uint32_t rank_id = 0);
31 
32 void GetFileKernelName(NotNull<std::string *> kernel_name);
33 
34 void GetConstantId(const session::KernelGraph *graph, std::map<std::string, size_t> *const_map);
35 
36 void GetDumpIntShape(const AnfNodePtr &node, size_t index, NotNull<ShapeVector *> int_shapes, bool trans_flag = false);
37 
38 void DumpMemToFile(const std::string &file_path, const device::DeviceAddress &addr, const ShapeVector &int_shapes,
39                    const TypeId &type, bool trans_flag = false);
40 // Get time stamp since epoch in microseconds
41 uint64_t GetTimeStamp();
42 std::string GetOpNameWithoutScope(const std::string &fullname_with_scope);
43 }  // namespace mindspore
44 
45 #endif  // MINDSPORE_MINDSPORE_CCSRC_DEBUG_DATA_DUMP_DUMP_UTILS_H_
46