code: def test_has_cuda_context():
      if nvml.device_get_count() < 1:
          pytest.skip("No GPUs available")
  
      # This test should be run in a new process so that it definitely doesn't have a CUDA context
      # and uses a queue to pass exceptions back
      ctx = mp.get_context("spawn")
      queue = ctx.Queue()
      p = ctx.Process(target=run_has_cuda_context, args=(queue,))
      p.start()
      p.join()  # this blocks until the process terminates
      e = queue.get()
      if e is not None:
          raise e
  
file_path: distributed/distributed/diagnostics/tests/test_nvml.py
imports: from __future__ import annotations
  import multiprocessing
  import os
  import pytest
  import dask
  from distributed.diagnostics import nvml
  from distributed.utils_test import gen_cluster
label_desc: Use image node_id 6 for calling a global function with example usage: test_has_cuda_context() without return types