Skip to content

Commit

Permalink
add logging message for using GPU
Browse files Browse the repository at this point in the history
Summary: added a logger message when GPU is successfully used with the model and generator included.

Differential Revision: D65907247
  • Loading branch information
JasonKChow authored and facebook-github-bot committed Nov 13, 2024
1 parent 508760b commit 1b204f8
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion aepsych/strategy.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,12 +164,13 @@ def __init__(
if use_gpu_modeling:
if not torch.cuda.is_available():
warnings.warn(
"GPU requested for model {type(model).__name__}, but no GPU found! Using CPU instead.",
f"GPU requested for model {type(model).__name__}, but no GPU found! Using CPU instead.",
UserWarning,
)
self.model_device = torch.device("cpu")
else:
self.model_device = torch.device("cuda")
logger.info(f"Using GPU for modeling with {type(model).__name__}")
else:
self.model_device = torch.device("cpu")

Expand All @@ -195,6 +196,9 @@ def __init__(
self.generator_device = torch.device("cpu")
else:
self.generator_device = torch.device("cuda")
logger.info(
f"Using GPU for generating with {type(generator).__name__}"
)
else:
self.generator_device = torch.device("cpu")

Expand Down

0 comments on commit 1b204f8

Please sign in to comment.