Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add assertions to IPU accelerator for device availability #11798

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,9 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).
- Added a `_Stateful` support for `LightningDataModule` ([#11637](https://github.com/PyTorchLightning/pytorch-lightning/pull/11637))


- Added checks to `IPUAccelerator` to assert device availability ([#11799](https://github.com/PyTorchLightning/pytorch-lightning/pull/11798))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- Added checks to `IPUAccelerator` to assert device availability ([#11799](https://github.com/PyTorchLightning/pytorch-lightning/pull/11798))
- Added checks to `IPUAccelerator` to assert device availability ([#11798](https://github.com/PyTorchLightning/pytorch-lightning/pull/11798))



### Changed

- Implemented a new native and rich format in `_print_results` method of the `EvaluationLoop` ([#11332](https://github.com/PyTorchLightning/pytorch-lightning/pull/11332))
Expand Down
14 changes: 14 additions & 0 deletions pytorch_lightning/accelerators/ipu.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,25 @@
import torch

from pytorch_lightning.accelerators.accelerator import Accelerator
from pytorch_lightning.utilities.exceptions import MisconfigurationException
from pytorch_lightning.utilities.imports import _IPU_AVAILABLE


class IPUAccelerator(Accelerator):
"""Accelerator for IPUs."""

def __init__(self) -> None:
"""
Raises:
MisconfigurationException:
If the IPU device is not available.
"""
if not _IPU_AVAILABLE:
ananthsub marked this conversation as resolved.
Show resolved Hide resolved
raise MisconfigurationException(
"The IPU Accelerator requires IPU devices to run. "
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"The IPU Accelerator requires IPU devices to run. "
"The IPU Accelerator requires `GraphCore IPU devices` to run. "

"Learn more or get started with IPUs at https://www.graphcore.ai/getstarted"
)

def get_device_stats(self, device: Union[str, torch.device]) -> Dict[str, Any]:
"""IPU device stats aren't supported yet."""
return {}
Expand Down