code: def check_for_gpu(device_id):
      if device_id is not None and device_id >= cuda.device_count():
          raise ConfigurationError(
              "Experiment specified a GPU but none is available;"
              " if you want to run on CPU use the override"
              " 'trainer.cuda_device=-1' in the json config file."
          )
  
file_path: magnitude/pymagnitude/third_party/allennlp/common/checks.py
imports: from __future__ import absolute_import
  import logging
  from torch import cuda
label_desc: Use image node_id 3 for calling a global function with example usage: check_for_gpu(device_id) without return types