code: def gpu_mem_allocate_mbs(n, fatal=False):
      """
      Try to allocate n MBs on the current device.
  
      Return the variable  holding it on success, None on failure.
  
      fatal=True will throw an exception on failure to allocate (default is False).
      """
      # don't try to allocate less than 6MB as it'd be imprecise, need to probably switch to bytes allocation
      try:
          return torch.ones((n * 2**18)).cuda().contiguous()
      except Exception as e:
          if not fatal:
              return None
          raise e
  
file_path: ipyexperiments/ipyexperiments/utils/mem.py
imports: import gc
  import os
  from collections import namedtuple
  from ipyexperiments.utils.pynvml_gate import load_pynvml_env
label_desc: Use image node_id 10 for calling a global function with example usage: gpu_mem_allocate_mbs(n, fatal) and returns: torch, None