Repository navigation
Make one of the devices have a lower maximum float precision #64
Description
Activity
My thinking is that the default set of devices should cover the important use-cases (including this), but you should also be able to manually set what devices are active using the flags API.
This is related to #38
the last piece we'd need in scikit-learn to be able to find all "user errors" when writing array API code.
Given that it's been a year (sigh), is it something scikit-learn feels as sorely missing @betatim ?
It hasn't come up again as far as I remember. Using that as a yard stick: not super urgent/important.
But I think in general this would be useful to have. Maybe the next step is to decide on what we want to implement to make this happen?
The very first question I suppose is this:
In [11]: t = torch.as_tensor([1, 2, 3.0], device='mps') --------------------------------------------------------------------------- TypeError Traceback (most recent call last) Cell In[11], line 1 ----> 1 t = torch.as_tensor([1, 2, 3.0], device='mps') TypeError: Cannot convert a MPS Tensor to float64 dtype as the MPS framework doesn't support float64. Please use float32 instead.and the spec requires
float64: A conforming implementation of the array API standard must provide and support the following data types ... float64.So strictly speaking, these "metal" backends are not compliant. This is similar to JAX, which is compliant in the X64 mode only.
Given that
array-api-strictis scrupulous in following the spec to the detail, and given that there clearly is interest in supporting these fancy "metal" frameworks (cf a recent scipy mention), maybe this is something to consider for the spec itself? array-api-strict will then happily follow.Reacted by Tim HeadPrompted by #70 (comment), here's a WIP PR to implement a float32-only device: #206
(I just noticed and had to laugh: issue #64 is about less than float64 precision. Monday morning brain is easily entertained 😆 )
Reacted by Evgeni Burovski
As a follow up to #56: it would be useful to make one of the "devices" have a lower maximum float precision than the rest. To mirror what, for example, PyTorch's MPS device does (this is the "Apple silicon" GPU in modern MacBooks).
I think having a "lower maximum precision" device would be the last piece we'd need in scikit-learn to be able to find all "user errors" when writing array API code. This way people writing array API code don't need to have a GPU available to find and debug the errors you get when using a device that isn't a CPU.
What do people think?
cc @ogrisel