tylerjereddy / scipy

Scipy library main repository
http://scipy.org/scipylib/
BSD 3-Clause "New" or "Revised" License
1 stars 1 forks source link

DEMO: testing torch device MPS with cirrus CI #71

Open tylerjereddy opened 1 year ago

tylerjereddy commented 1 year ago

Quick demo to show that we can test on native ARM mac metal performance shaders (MPS GPU) on cirrus CI so we have at least one array API "device" other than host tested in CI.

tylerjereddy commented 1 year ago

So, the failures in Cirrus CI arm Mac run here appear to be related to memory problems--I wonder if they somehow block usage of the integrated GPU on their native mac platforms?

Locally I get a few sensible device-related failures with:

SCIPY_TORCH_DEVICE=mps python dev.py test -j 12 -b numpy -b pytorch -s cluster

FAILED scipy/cluster/tests/test_hierarchy.py::TestLinkage::test_linkage_tdist[torch] - AttributeError: 'Tensor' object has no attribute 'flags'
FAILED scipy/cluster/tests/test_vq.py::TestWhiten::test_whiten[torch] - AssertionError: 
FAILED scipy/cluster/tests/test_vq.py::TestWhiten::test_whiten_zero_std[torch] - AssertionError: 
FAILED scipy/cluster/tests/test_vq.py::TestVq::test_py_vq[torch] - TypeError: can't convert mps:0 device type tensor to numpy. Use Tensor.cpu() to copy the tensor to host memory first.
FAILED scipy/cluster/tests/test_vq.py::TestKMean::test_kmeans2_kpp_high_dim[torch] - TypeError: can't convert mps:0 device type tensor to numpy. Use Tensor.cpu() to copy the tensor to host memory first.
tylerjereddy commented 1 year ago

I opened a ticket (cross-linked above) with the Cirrus CI team just to see what they think about the MPS support/usage--I see no open/closed issues about this yet, so I'm curious..

rgommers commented 1 year ago

That is an interesting idea. I don't know much about MPS, but could try to find out from the PyTorch team. Curious what the Cirrus CI folks will say.

tylerjereddy commented 1 year ago

They said it is because of the Apple virtualization framework they build tart on top of, and are hoping it will be possible after the upcoming WWDC conference in a few weeks.

tylerjereddy commented 1 year ago

Actually, now they think it should be supported in theory, since there is a video of Apple saying it is. That sounds promising, at least eventually...