def run_global_memory_analysis(swap_tasks, swapped_out_tensor):
    global job_num
    global global_memory_analyzer
    max_memory = 0
    max_memory_tensors = []
    last_input_accesses = []
    max_time = []
    time_axis = []
    for job_id in range(job_num):
        (job_max_memory, job_max_memory_tensors, last_input_access, now_time, t_axis) = global_memory_analyzer[job_id].get_max_memory_used(swap_tasks[job_id], swapped_out_tensor)
        time_axis.append(t_axis)
        max_memory_tensors.extend(job_max_memory_tensors)
        last_input_accesses.append(last_input_access)
        max_time.append(now_time)
        max_memory += job_max_memory
    return (max_memory, max_memory_tensors, last_input_accesses, max_time, time_axis)
def run_global_memory_analysis(swap_tasks, swapped_out_tensor):
    global job_num
    global global_memory_analyzer
    max_memory = 0
    max_memory_tensors = []
    last_input_accesses = []
    max_time = []
    time_axis = []
    for job_id in range(job_num):
        (job_max_memory, job_max_memory_tensors, last_input_access, now_time, t_axis) = global_memory_analyzer[job_id].get_max_memory_used(swap_tasks[job_id], swapped_out_tensor)
        time_axis.append(t_axis)
        max_memory_tensors.extend(job_max_memory_tensors)
        last_input_accesses.append(last_input_access)
        max_time.append(now_time)
        max_memory += job_max_memory
    return (max_memory, max_memory_tensors, last_input_accesses, max_time, time_axis)