docstr: Call the solver to search an efficient parameter offloading strategy for the linearized graph.
  The solver adopts greedy algorithm.
  
  Raises:
      NotImplementedError: Unable to find a solution for the given memory budget.
docstr_tok: ["Call","the","solver","to","search","an","efficient","parameter","offloading","strategy","for","the","linearized","graph",".","The","solver","adopts","greedy","algorithm",".","Raises",":","NotImplementedError",":","Unable","to","find","a","solution","for","the","given","memory","budget","."]
code: def _call_solver(self):
      """
      Call the solver to search an efficient parameter offloading strategy for the linearized graph.
      The solver adopts greedy algorithm.
  
      Raises:
          NotImplementedError: Unable to find a solution for the given memory budget.
      """
  
      print("search for offloading strategy ......")
      # Records the prefetch execution location of the offloaded region
      region_to_region_map = {}
      while self.best_ts.peak_mem > self.memory_budget:
          region_to_offload = None
          max_offload_profit = (0,)
          best_offl_ts = None
  
          # search which region should be offloaded,
          # the last region does not need to be offloaded
          for region in self.region_list[:-1]:
              if region.param_size and not region.need_offload:
                  max_prefetch_profit = (0,)
                  best_pref_ts = None
  
                  # search when to prefetch the region offloaded
                  for host_region in self.region_list[
                      region.r_id
                      + 1 : region.r_id
                      + 1
                      + self.search_window_size
                  ]:
                      if host_region.bwd_prefetch_region is not None:
                          continue
  
                      temp_ts, profit = self._try_to_offload(
                          host_region, region
                      )
  
                      if self._compare_profit(
                          profit, max_prefetch_profit
                      ):
                          region_to_region_map[
                              region.r_id
                          ] = host_region
                          max_prefetch_profit = profit
                          best_pref_ts = temp_ts
                          if profit[0] == float("inf"):
                              break
  
                  if self._compare_profit(
                      max_prefetch_profit, max_offload_profit
                  ):
                      region_to_offload = region
                      max_offload_profit = max_prefetch_profit
                      best_offl_ts = best_pref_ts
  
          if (region_to_offload is not None) and (
              best_offl_ts is not None
          ):
              region_to_offload.need_offload = True
              if (
                  region_to_region_map[region_to_offload.r_id]
                  == region_to_offload
              ):
                  region_to_offload.is_syn = True
              else:
                  region_to_region_map[
                      region_to_offload.r_id
                  ].bwd_prefetch_region = region_to_offload
                  self.region_to_region_map[
                      region_to_offload.r_id
                  ] = region_to_region_map[region_to_offload.r_id]
  
              self._update_state(best_offl_ts)
  
          elif self.region_to_region_map.__len__() > 0:
              self._repair_strategy()
          else:
              raise NotImplementedError(
                  f"can't find the offload strategy met the memory budget {self.memory_budget / 1024 ** 2} MB, "
                  f"it needs {self.best_ts.peak_mem / 1024 ** 2:.3f} MB at least!"
              )
  
          region_to_region_map.clear()
  
imports: import time
  from abc import ABC, abstractmethod
  from typing import Dict, List, Type
  import torch
  from torch.fx.node import Node
  from colossalai.utils.device import get_current_device
  from .region import Region
  from .training_simulator import AsynTrainingSimulator, SynTrainingSimulator, TrainingSimulator
  from .util import NodeInfo, NvDevicePower
label_desc: Use image node_id 3 for calling the AsynGreedySolver obj's underlying member method code with example usage: obj._call_solver() without return types