-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathgen_profile_scripts_with_suffix_wrapper.py
executable file
·147 lines (124 loc) · 3.8 KB
/
gen_profile_scripts_with_suffix_wrapper.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
#!/usr/bin/env python3
"""
Author : Xinyuan Chen <[email protected]>
Date : 2023-03-23
Purpose: wrapper around gen_bench_script.py's --profile-suffix workflow
"""
import argparse
from copy import deepcopy
from pathlib import Path
from config import (
graph_benchmark_method_order,
edgelist_filenames,
edgelist_filenames_lcc,
)
def get_args():
"""Get command-line arguments"""
parser = argparse.ArgumentParser(
description='wrapper around gen_bench_script.py\'s --profile-suffix workflow',
formatter_class=argparse.ArgumentDefaultsHelpFormatter,
)
parser.add_argument(
'suffix',
# dest='profile_suffix',
help='suffix for profile scripts (--profile-suffix)',
type=str,
default='',
)
parser.add_argument(
'-t',
'--tools',
dest='profile_select_tools',
help='select tools for profiling, (--profile-select-tools)',
type=str,
nargs='+',
choices=['igraph', 'graphtool', 'networkit', 'easygraph', 'networkx', 'snap'],
default=['igraph', 'graphtool', 'networkit', 'easygraph', 'networkx', 'snap'],
)
parser.add_argument(
'-T',
'--profile-no-tools',
help='Exclude certain tools for profiling',
type=str,
nargs='+',
choices=['igraph', 'graphtool', 'networkit', 'easygraph', 'networkx', 'snap'],
default=[],
)
parser.add_argument(
'-m',
'--methods',
dest='profile_select_methods',
help='select methods for profiling (--profile-select-methods)',
type=str,
nargs='+',
choices=graph_benchmark_method_order,
default=graph_benchmark_method_order,
)
parser.add_argument(
'-M',
'--profile-no-methods',
help='Exclude certain methods for profiling',
type=str,
nargs='+',
choices=graph_benchmark_method_order,
default=[],
)
parser.add_argument(
'-d',
'--datasets',
dest='profile_select_datasets',
help='select datasets for profiling (--profile-select-datasets)',
type=str,
nargs='+',
choices=edgelist_filenames + edgelist_filenames_lcc,
default=edgelist_filenames + edgelist_filenames_lcc,
)
parser.add_argument(
'-D',
'--profile-no-datasets',
help='Exclude certain datasets for profiling',
type=str,
nargs='+',
# choices=edgelist_filenames + edgelist_filenames_lcc,
default=[],
)
parser.add_argument(
'--directed-datasets-only',
help='only generate scripts for directed datasets',
action='store_true',
)
parser.add_argument(
'--undirected-datasets-only',
help='only generate scripts for undirected datasets',
action='store_true',
)
parser.add_argument(
'-e',
'--profile-entrypoint-exit-on-error',
help='exit on error in profile entrypoint scripts',
action='store_true',
)
parser.add_argument(
'--profile-entrypoint-bash-arg',
help='command line args for profile entrypoint scripts',
type=str,
default='"$@"',
)
return parser.parse_args()
def main():
"""Make a jazz noise here"""
args = get_args()
args.profile_suffix = args.suffix
del args.suffix # type: ignore
args_profile = deepcopy(args)
args_profile_entrypoint = deepcopy(args)
args_profile.profile = True
args_profile_entrypoint.profile_entrypoint = True
# from icecream import ic
# ic(args_profile)
# ic(args_profile_entrypoint)
from gen_bench_script import main as gen_bench_script_main
gen_bench_script_main(args_profile)
gen_bench_script_main(args_profile_entrypoint)
if __name__ == '__main__':
main()