2022-04-19 02:59:44 +00:00
|
|
|
import click
|
2022-04-19 07:14:54 +00:00
|
|
|
from .launcher import run
|
2022-04-20 04:05:38 +00:00
|
|
|
from .check import check
|
2022-04-19 04:08:28 +00:00
|
|
|
from colossalai.cli.benchmark.utils import BATCH_SIZE, SEQ_LENGTH, HIDDEN_DIM, ITER_TIMES
|
|
|
|
from colossalai.cli.benchmark.run import launch as col_benchmark
|
2022-04-19 02:59:44 +00:00
|
|
|
|
2022-04-19 07:14:54 +00:00
|
|
|
|
2022-04-19 02:59:44 +00:00
|
|
|
class Arguments():
|
2022-04-19 07:14:54 +00:00
|
|
|
|
2022-04-19 04:08:28 +00:00
|
|
|
def __init__(self, arg_dict):
|
|
|
|
for k, v in arg_dict.items():
|
2022-04-19 02:59:44 +00:00
|
|
|
self.__dict__[k] = v
|
|
|
|
|
2022-04-19 07:14:54 +00:00
|
|
|
|
2022-04-19 02:59:44 +00:00
|
|
|
@click.group()
|
|
|
|
def cli():
|
|
|
|
pass
|
|
|
|
|
2022-04-19 07:14:54 +00:00
|
|
|
|
2022-04-19 04:08:28 +00:00
|
|
|
@click.command()
|
2022-04-19 07:14:54 +00:00
|
|
|
@click.option("--num_gpus", type=int, default=-1)
|
|
|
|
@click.option("--bs", type=int, default=BATCH_SIZE)
|
|
|
|
@click.option("--seq_len", type=int, default=SEQ_LENGTH)
|
|
|
|
@click.option("--hid_dim", type=int, default=HIDDEN_DIM)
|
|
|
|
@click.option("--num_steps", type=int, default=ITER_TIMES)
|
2022-04-19 04:08:28 +00:00
|
|
|
def benchmark(num_gpus, bs, seq_len, hid_dim, num_steps):
|
|
|
|
args_dict = locals()
|
|
|
|
args = Arguments(args_dict)
|
|
|
|
col_benchmark(args)
|
|
|
|
|
2022-04-19 02:59:44 +00:00
|
|
|
|
2022-04-19 07:14:54 +00:00
|
|
|
cli.add_command(run)
|
2022-04-20 04:05:38 +00:00
|
|
|
cli.add_command(check)
|
2022-04-19 04:08:28 +00:00
|
|
|
cli.add_command(benchmark)
|
2022-04-19 02:59:44 +00:00
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
|
|
cli()
|