Skip to content
Draft
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
12 changes: 12 additions & 0 deletions test/pjrt/test_runtime_tpu.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,18 @@ def tearDown(self) -> None:
os.environ.pop(xenv.TPU_VISIBLE_CHIPS, None)
os.environ.pop(xenv.TPU_PROCESS_BOUNDS, None)

def test_tensor_oom(self):
a = torch.randn((4000000000, 4000000000), device="xla")
with self.assertRaises(Exception) as cm:
# The above tensor doesn't fit in HBM. It should result in a python
# exception instead of crashing.
a.sum()

self.assertEqual(
(type(cm.exception).__name__, str(cm.exception)),
("RuntimeError", "")
)

def test_xla_devices_multiprocess(self):
expected = _ordinal_to_device()

Expand Down
Loading