import argparse
from pathlib import Path
import os

from seq_exec import run_sequential
from concurrency_exec import run_concurrent
from utils import generate_inputs

def _get_parser():
    parser = argparse.ArgumentParser(description="Python dummy benchmark")
    parser.add_argument('mode', choices=["sequential", "concurrent"])
    parser.add_argument('--files', type=int, default=5)
    parser.add_argument('--nums-per-file', type=int, default=1000)
    return parser

def main():
    # PARSE ARGS:
    args = _get_parser().parse_args()
    
    mode = args.mode
    num_files = args.files
    numbers_per_file = args.nums_per_file
    problem_size = num_files * numbers_per_file

    if problem_size % 2 != 0:
        print("problem_size must be divisible by 2")

    # GENERATE INPUTS (if not created already)
    print("STARTING PYTHON DUMMY BENCHMARK")
    print("MODE: {}, NUM_FILES: {} numbers_per_file: {} ".
          format(mode, num_files, numbers_per_file))

    generate_inputs(num_files, numbers_per_file)
    if mode == "sequential":
        run_sequential(num_files)
    elif mode == "concurrent":
        run_concurrent(num_files)
    print("ENDING")

if __name__ == "__main__":
    main()

