Skip to content

Remove DLPack device number from arrays (revert #212) #219

Description

@betatim

In #212 we changed the device ID reported by the "not CPU" devices in array-api-strict. I think we should revert that change again. For one my original use-case has probably gone away but more importantly it seems to break torch.from_dlpack (and maybe others).

In scikit-learn/scikit-learn#34456 you have what happens in a scikit-learn test where we try to move an array from one namespace to another. Neither device really uses CUDA, but torch tries to use its CUDA machinery because array-api-strict device claims to be a CUDA device. I haven't tried but I assume that if I had a torch with CUDA support installed this would break at a later stage when it tries to access the actual memory.

All this makes me think that faking the device ID is a step too far.

If we decide to do this we also need to check the device ID reported by the other devices in array-api-strict ("no_float64")

A related thought is: what testing could we add to the array-api-strict test suite so that we'd have caught this problem before merging the PR. Should we have a CI job that runs some tests that are about checking compatibility/interaction with a library like torch?

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions