Skip to content

Commit

Permalink
mc
Browse files Browse the repository at this point in the history
  • Loading branch information
jovoni committed Feb 6, 2024
1 parent bdbd152 commit 4a861b8
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions inst/pydevil/pydevil/utils_input.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,16 @@ def check_and_prepare_input_run_SVDE(input_matrix, model_matrix, size_factors, g
"""
validate_boolean(cuda, "cuda")
if cuda and torch.cuda.is_available():
print("GPU usage was requested and and will be used!")
torch.set_default_device("cuda:0")
elif cuda and not torch.cuda.is_available():
print("GPU usage was requested but is not available! Using CPU instead.")
torch.set_default_device("cpu")
elif not cuda and torch.cuda.is_available():
print("GPU usage was not requested but is available! Using CPU instead.")
torch.set_default_device("cpu")
else:
print("GPU usage was not requested and is not available! Using CPU.")
torch.set_default_device("cpu")

input_matrix = ensure_tensor(input_matrix, cuda=cuda).int()
Expand Down

0 comments on commit 4a861b8

Please sign in to comment.