Created
February 23, 2025 03:15
-
-
Save LimHyungTae/bff50f7e16bef023202b5caff827ec26 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import ray | |
import torch | |
import os | |
import torch | |
print("CUDA Available:", torch.cuda.is_available()) | |
print("CUDA Device Count:", torch.cuda.device_count()) | |
print("Current CUDA Device:", torch.cuda.current_device()) | |
print("CUDA Device Name:", torch.cuda.get_device_name(torch.cuda.current_device())) | |
print(os.environ.get("CUDA_VISIBLE_DEVICES")) | |
ray.init(num_gpus=1) | |
@ray.remote(num_gpus=1) | |
def check_cuda(): | |
print(os.environ.get("CUDA_VISIBLE_DEVICES")) | |
return torch.cuda.is_available(), torch.cuda.device_count() | |
print(ray.get(check_cuda.remote())) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment