code: def add_hook():
      """Add a global hook function that captures all unhandled exceptions.
  
      The function calls MPI_Abort() to force all processes abort.
      It is useful when you run your training script on a cloud platform.
      """
      global _orig_except_hook
  
      if _orig_except_hook is not None:
          warnings.warn(
              "chainermn.global_except_hook.add_hook() "
              "seems to be called multiple times. Ignoring.",
              stacklevel=2,
          )
          return
  
      _orig_except_hook = sys.excepthook
      sys.excepthook = _global_except_hook
  
imports: import os
  import sys
  import warnings
label_desc: Use image node_id 3 for calling a global function with example usage: add_hook() without return types