mirror of
https://github.com/elder-plinius/OBLITERATUS.git
synced 2026-08-18 00:47:23 +02:00
25 lines
804 B
Python
25 lines
804 B
Python
"""Real Apple MPS discovery, selection, placement, and operation probe."""
|
|
|
|
from __future__ import annotations
|
|
|
|
import pytest
|
|
import torch
|
|
|
|
from obliteratus import device
|
|
|
|
|
|
pytestmark = pytest.mark.mps
|
|
|
|
|
|
def test_mps_discovery_selection_placement_and_operation():
|
|
if not (hasattr(torch.backends, "mps") and torch.backends.mps.is_available()):
|
|
pytest.skip("requires an Apple Silicon MPS runner with ENABLE_MPS_GATE=true")
|
|
assert device.is_mps()
|
|
assert device.get_device("auto") == "mps"
|
|
assert device.default_dtype("mps") is torch.float16
|
|
assert not device.supports_float64("mps")
|
|
tensor = torch.arange(16, device="mps", dtype=torch.float32).reshape(4, 4)
|
|
result = tensor @ tensor.T
|
|
assert result.device.type == "mps"
|
|
assert torch.isfinite(result).all().item()
|