code: def train(args, model_path, forecaster, train_loader, records):
      """
      train stage will record throughput.
      """
      if args.training_processes:
          forecaster.num_processes = args.training_processes
      epochs = args.training_epochs
      forecaster.use_ipex = True if args.ipex else False
  
      start_time = time.time()
      forecaster.fit(train_loader, epochs=epochs)
      training_time = time.time() - start_time
  
      if args.framework == "tensorflow":
          training_sample_num = epochs * sum(
              [x.shape[0] for x, _ in train_loader]
          )
      else:
          training_sample_num = epochs * len(train_loader.dataset)
      forecaster.save(model_path)
      records["training_time"] = training_time
      records["training_sample_num"] = training_sample_num
      records["train_throughput"] = training_sample_num / training_time
  
file_path: BigDL/python/chronos/src/bigdl/chronos/benchmark/benchmark_chronos.py
imports: from bigdl.chronos.benchmark import generate_forecaster, generate_data, get_CPU_info, check_nano_env
  import time
  import numpy
  import argparse
  import os
  from scipy import stats
  import psutil
  import subprocess
  from bigdl.nano.utils.common import invalidInputError
  from bigdl.nano.utils.common import spawn_new_process
label_desc: Use image node_id 1 for calling a global function with example usage: train(args, model_path, forecaster, train_loader, records) without return types