ray.get_gpu_ids#
- ray.get_gpu_ids() List[int] | List[str] [source]#
Get the IDs of the GPUs that are available to the worker.
This method should only be called inside of a task or actor, and not a driver.
If the CUDA_VISIBLE_DEVICES environment variable was set when the worker started up, then the IDs returned by this method will be a subset of the IDs in CUDA_VISIBLE_DEVICES. If not, the IDs will fall in the range [0, NUM_GPUS - 1], where NUM_GPUS is the number of GPUs that the node has.
- Returns:
A list of GPU IDs.