Giter VIP home page Giter VIP logo

Comments (2)

zpcore avatar zpcore commented on July 30, 2024

With using_pjrt user doesn't need to call the function _maybe_select_default_device to init the device by themselves. To get rid of using_pjrt decorator, we either need to:

  1. force user to call function like _maybe_select_default_device at the beginning of their script; Or
  2. place the _maybe_select_default_device within some other functions that must be called at the beginning of their script.

Both ways look annoying. Can we do something in torch_xla/__init__.py file to automatically find the device at the first place?

from xla.

will-cromar avatar will-cromar commented on July 30, 2024

__init__.py sounds fine. That's what I meant by "trigger auto detection upon import".

Broadly, there are two options that I see:

  1. Decorate any function that could potentially init the runtime something equivalent to requires_pjrt. This is arguably cleaner/more precise, but I'm concerned we'll miss some functions and not fully root out this $PJRT_DEVICE is not set error.
  2. _maybe_select_default_device in __init__.py so it runs automatically when the user imports torch_xla.

I'm open to other solutions too. The core constraint is that runtime init happens in C++, while most of the logic we need to detect devices is in Python.

from xla.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.