def init(logged_times: list, gpu: int):
    global job_num
    global global_tensor_access
    global tensor_access_by_tensor
    global total_memory
    global handle
    global jobs_weights
    global global_graphs
    global global_tensors
    global swap_scheduler
    global parameters
    global global_memory_analyzer
    global_tensor_access = [[]]
    tensor_access_by_tensor = []
    global_tensors = {}
    swap_scheduler = []
    parameters = []
    global_memory_analyzer = []
    graphs = global_graphs
    jobs_weights = [weight for _ in range(len(graphs))]
    tensor_access_by_tensor = [[] for _ in range(job_num)]
    if (not debug_mod):
        nvmlInit()
        handle = nvmlDeviceGetHandleByIndex(gpu)
        total_memory = (nvmlDeviceGetMemoryInfo(handle).free / 1000000)
    else:
        total_memory = 6000
    job_num = len(graphs)
    tmp = [get_framework_info(graphs[i], logged_times[i], i) for i in range(job_num)]
    global_tensor_access = [tmp[i][0] for i in range(job_num)]
    swap_scheduler = [tmp[i][1] for i in range(job_num)]
    parameters = [tmp[i][2] for i in range(job_num)]
    for i in range(job_num):
        global_memory_analyzer.append(MemoryAnalyzer(global_tensor_access[i], global_tensors[i]))
def init(logged_times: list, gpu: int):
    global job_num
    global global_tensor_access
    global tensor_access_by_tensor
    global total_memory
    global handle
    global jobs_weights
    global global_graphs
    global global_tensors
    global swap_scheduler
    global parameters
    global global_memory_analyzer
    global_tensor_access = [[]]
    tensor_access_by_tensor = []
    global_tensors = {}
    swap_scheduler = []
    parameters = []
    global_memory_analyzer = []
    graphs = global_graphs
    jobs_weights = [weight for _ in range(len(graphs))]
    tensor_access_by_tensor = [[] for _ in range(job_num)]
    if (not debug_mod):
        nvmlInit()
        handle = nvmlDeviceGetHandleByIndex(gpu)
        total_memory = (nvmlDeviceGetMemoryInfo(handle).free / 1000000)
    else:
        total_memory = 6000
    job_num = len(graphs)
    tmp = [get_framework_info(graphs[i], logged_times[i], i) for i in range(job_num)]
    global_tensor_access = [tmp[i][0] for i in range(job_num)]
    swap_scheduler = [tmp[i][1] for i in range(job_num)]
    parameters = [tmp[i][2] for i in range(job_num)]
    for i in range(job_num):
        global_memory_analyzer.append(MemoryAnalyzer(global_tensor_access[i], global_tensors[i]))