Skip to content

Commit

Permalink
Allow regex in P0 benchmarks
Browse files Browse the repository at this point in the history
  • Loading branch information
gevtushenko authored and wmaxey committed Dec 4, 2023
1 parent 4d5c181 commit 8ce93cb
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions benchmarks/scripts/cccl/bench/search.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ def parse_arguments():
'--list-benches', action=argparse.BooleanOptionalAction, help="Show available benchmarks.")
parser.add_argument('--num-shards', type=int, default=1, help='Split benchmarks into M pieces and only run one')
parser.add_argument('--run-shard', type=int, default=0, help='Run shard N / M of benchmarks')
parser.add_argument('-P0', action=argparse.BooleanOptionalAction, help="Run P0 benchmarks (overwrites -R)")
parser.add_argument('-P0', action=argparse.BooleanOptionalAction, help="Run P0 benchmarks")
return parser.parse_args()


Expand All @@ -64,16 +64,18 @@ def run_benches(algnames, sub_space, seeker):
print("#### ERROR exception occured while running {}: '{}'".format(algname, e))


def filter_benchmarks_by_regex(benchmarks, R):
pattern = re.compile(R)
return list(filter(lambda x: pattern.match(x), benchmarks))


def filter_benchmarks(benchmarks, args):
if args.run_shard >= args.num_shards:
raise ValueError('run-shard must be less than num-shards')

R = args.R
algnames = filter_benchmarks_by_regex(benchmarks.keys(), args.R)
if args.P0:
R = '^(?!.*segmented).*(scan|reduce|select|sort).*'

pattern = re.compile(R)
algnames = list(filter(lambda x: pattern.match(x), benchmarks.keys()))
algnames = filter_benchmarks_by_regex(algnames, '^(?!.*segmented).*(scan|reduce|select|sort).*')
algnames.sort()

if args.num_shards > 1:
Expand Down

0 comments on commit 8ce93cb

Please sign in to comment.