|
5 | 5 | gdb.execute(f'directory {get_config_root(Path.cwd())}') |
6 | 6 | gdb.prompt_hook = lambda x: '(ffdb) ' |
7 | 7 | gdb.execute('set history save on') |
8 | | - |
9 | | -# python |
10 | | -# from proj.config_file import get_config_root |
11 | | -# from pathlib import Path |
12 | | -# print(Path.cwd()) |
13 | | -# #gdb.execute(f'directory {get_conf}/{}') |
14 | | -# end |
15 | | - |
16 | | -# show directories |
17 | | - |
18 | | -# import gdb.printing |
19 | | -# |
20 | | -# class NodePrinter: |
21 | | -# def __init__(self, val): |
22 | | -# self.val = val |
23 | | -# |
24 | | -# def to_string(self): |
25 | | -# ptr = self.val["ptr"] |
26 | | -# if ptr != 0: |
27 | | -# op_type = ptr.referenced_value()['op_type'] |
28 | | -# return f'Node<guid={self.val["guid"]} ptr={ptr} op_type={op_type}>' |
29 | | -# else: |
30 | | -# return f'Node<guid={self.val["guid"]} ptr={self.val["ptr"]}>' |
31 | | -# |
32 | | -# class EdgePrinter: |
33 | | -# def __init__(self, val): |
34 | | -# self.val = val |
35 | | -# |
36 | | -# def to_string(self): |
37 | | -# return f'Edge<src={self.val["srcOp"]["guid"]} dst={self.val["dstOp"]["guid"]}>' |
38 | | -# |
39 | | -# class MachineViewPrinter: |
40 | | -# def __init__(self, val): |
41 | | -# self.val = val |
42 | | -# |
43 | | -# def to_string(self): |
44 | | -# toks = [] |
45 | | -# if self.val['device_type'] == 0: |
46 | | -# toks.append('type=GPU') |
47 | | -# else: |
48 | | -# toks.append('type=CPU') |
49 | | -# start_device_id = self.val['start_device_id'] |
50 | | -# for i in range(self.val['ndims']): |
51 | | -# dim = self.val['dim'][i] |
52 | | -# stride = self.val['stride'][i] |
53 | | -# toks.append(f'{i}=[{start_device_id}:{start_device_id+dim}:{stride}]') |
54 | | -# return f'MachineView<{" ".join(toks)}>' |
55 | | -# |
56 | | -# class DomainPrinter: |
57 | | -# def __init__(self, val): |
58 | | -# self.val = val |
59 | | -# |
60 | | -# def to_string(self): |
61 | | -# toks = [] |
62 | | -# ndim = self.val['dim'] |
63 | | -# for i in range(ndim): |
64 | | -# lo = self.val['rect_data'][i] |
65 | | -# hi = self.val['rect_data'][i + ndim] |
66 | | -# toks.append(f'{i}=[{lo}:{hi}]') |
67 | | -# return f'Domain<{" ".join(toks)}>' |
68 | | -# |
69 | | -# class TensorShapePrinter: |
70 | | -# def __init__(self, val): |
71 | | -# self.val = val |
72 | | -# |
73 | | -# def to_string(self): |
74 | | -# toks = [] |
75 | | -# ndim = self.val['num_dims'] |
76 | | -# for i in range(ndim): |
77 | | -# dim = self.val['dims'][i] |
78 | | -# size = dim['size'] |
79 | | -# degree = dim['degree'] |
80 | | -# parallel_idx = dim['parallel_idx'] |
81 | | -# toks.append(f'{i}=[s={size} d={degree} pi={parallel_idx}]') |
82 | | -# return f'TensorShape<{" ".join(toks)}>' |
83 | | -# |
84 | | -# class ParallelTensorBasePrinter: |
85 | | -# def __init__(self, val): |
86 | | -# self.val = val |
87 | | -# |
88 | | -# def to_string(self): |
89 | | -# toks = [] |
90 | | -# toks.append(f'guid={self.val["parallel_tensor_guid"]}') |
91 | | -# ndim = self.val['num_dims'] |
92 | | -# for i in range(ndim): |
93 | | -# dim = self.val['dims'][i] |
94 | | -# size = dim['size'] |
95 | | -# degree = dim['degree'] |
96 | | -# parallel_idx = dim['parallel_idx'] |
97 | | -# toks.append(f'{i}=[s={size} d={degree} pi={parallel_idx}]') |
98 | | -# return f'ParallelTensorBase<{" ".join(toks)}>' |
99 | | -# |
100 | | -# def build_pretty_printer(): |
101 | | -# pp = gdb.printing.RegexpCollectionPrettyPrinter( |
102 | | -# "flexflow") |
103 | | -# pp.add_printer('Node', '^FlexFlow::PCG::Node$', NodePrinter) |
104 | | -# pp.add_printer('Edge', '^FlexFlow::PCG::Edge$', EdgePrinter) |
105 | | -# pp.add_printer('MachineView', '^FlexFlow::MachineView$', MachineViewPrinter) |
106 | | -# pp.add_printer('Domain', '^Legion::Domain$', DomainPrinter) |
107 | | -# pp.add_printer('ParallelTensorShape', '^FlexFlow::ParallelTensorShape$', TensorShapePrinter) |
108 | | -# pp.add_printer('ParallelTensorBase', '^FlexFlow::ParallelTensorBase$', ParallelTensorBasePrinter) |
109 | | -# return pp |
110 | | -# |
111 | | -# gdb.printing.register_pretty_printer( |
112 | | -# gdb.current_objfile(), build_pretty_printer(), replace=True) |
0 commit comments