code: def test_gpus_in_local_mode(self):
      # Local mode.
      ray.init(local_mode=True)
  
      actual_gpus_available = torch.cuda.device_count()
  
      config = (
          PPOConfig()
          .rollouts(num_rollout_workers=2)
          .environment("CartPole-v1")
      )
  
      # Expect no errors in local mode.
      for num_gpus in [0, 0.1, 1, actual_gpus_available + 4]:
          print(f"num_gpus={num_gpus}")
          for fake_gpus in [False, True]:
              print(f"_fake_gpus={fake_gpus}")
              config.resources(num_gpus=num_gpus, _fake_gpus=fake_gpus)
              frameworks = (
                  ("tf", "torch")
                  if num_gpus > 1
                  else ("tf2", "tf", "torch")
              )
              for _ in framework_iterator(
                  config, frameworks=frameworks
              ):
                  print("direct RLlib")
                  algo = config.build()
                  algo.stop()
                  print("via ray.tune.Tuner().fit()")
                  tune.Tuner(
                      "PPO",
                      param_space=config,
                      run_config=air.RunConfig(
                          stop={"training_iteration": 0}
                      ),
                  ).fit()
  
      ray.shutdown()
  
file_path: ray/python/ray/rllib/tests/test_gpus.py
imports: import unittest
  import ray
  from ray import air
  from ray.rllib.algorithms.ppo import PPOConfig
  from ray.rllib.utils.framework import try_import_torch
  from ray.rllib.utils.test_utils import framework_iterator
  from ray import tune
label_desc: Use image node_id 2 for calling the TestGPUs obj's underlying member method code with example usage: obj.test_gpus_in_local_mode() without return types