Giter Site home page Giter Site logo

Comments (18)

zolrath avatar zolrath commented on May 19, 2024 2

When I encountered this I had run the Livebook before I had set the XLA_TARGET, so XLA was already compiled with only CPU support. Even after adding the XLA_TARGET and ensuring I had CUDA and cuDNN installed properly I would get 14:30:19.336 [info] TfrtCpuClient created..

I solved this by deleting the xla and mix folders in ~/.cache, as I couldn't see a clean way to run mix deps.clean xla --build in Livebook.

from bumblebee.

josevalim avatar josevalim commented on May 19, 2024 1

@jonatanklosko there is an env var called MIX_INSTALL_FORCE, we can set it to "true" before we evaluate.

from bumblebee.

seanmor5 avatar seanmor5 commented on May 19, 2024

What if you set cuda explicitly in your config?

  config: [
    nx: [
      default_backend: EXLA.Backend,
      default_defn_options: [compiler: EXLA, client: :cuda]
    ]
  ],
  system_env: [
    XLA_TARGET: "cuda"
  ]

from bumblebee.

josevalim avatar josevalim commented on May 19, 2024

You can also run: EXLA.Client.get_supported_platforms() and see if CUDA is listed. If it isn't, for some reason XLA is not identifying your GPU device.

from bumblebee.

josevalim avatar josevalim commented on May 19, 2024

And additionally EXLA.Client.default_name() to get the name of the default one.

from bumblebee.

josevalim avatar josevalim commented on May 19, 2024

@jonatanklosko we should consider the XLA_TARGET in the cache key, right?

from bumblebee.

xrd avatar xrd commented on May 19, 2024

@zolrath Yes, that is what must have happened to me as well. I did get CUDA at first, and then could not switch back to it no matter what I tried. Thanks everyone for your help, and thanks @seanmor5 and @josevalim for an amazing project!

from bumblebee.

jonatanklosko avatar jonatanklosko commented on May 19, 2024

@josevalim ohh I've just realised that setting the env var and restarting runtime is not enough (unless the env var is set in Mix.install options). That's because we changed XLA to look at the initial XLA_TARGET, rather than every time it compiles. So in a mix project that would require mix deps.clean xla --build and for mix install force: true.

from bumblebee.

josevalim avatar josevalim commented on May 19, 2024

Do you remember why we did such change?

from bumblebee.

jonatanklosko avatar jonatanklosko commented on May 19, 2024

Actually what I was remembering is XLA_BUILD (elixir-nx/nx#845 (comment)). The issue with XLA_TARGET is that we compile dependencies only once, specifically exla.

Inside the exla project if you call mix compile with a different XLA_BUILD it will pick up the new version, but if you call mix compile in a project that depends on exla, it wouldn't pick up the change, since exla doesn't recompile.

from bumblebee.

josevalim avatar josevalim commented on May 19, 2024

But it works if we pass it to Mix.install/2 or force build, right?

maybe we should have an option to “force build” from Livebook UI? Maybe a drop down on the “Reconnect and setup”?

from bumblebee.

xrd avatar xrd commented on May 19, 2024

I'm able to use cuda now, shall I close it?

from bumblebee.

josevalim avatar josevalim commented on May 19, 2024

We will close it @xrd as soon as we figure out how to improve the user experience :)

from bumblebee.

josevalim avatar josevalim commented on May 19, 2024

Actually, one way to improve this would be to add:

system_env: %{"XLA_TARGET" => System.get_env("XLA_TARGET")}

this will enforce system differences to be picked up.

from bumblebee.

jonatanklosko avatar jonatanklosko commented on May 19, 2024

@josevalim yeah this works, my concern is that once someone sets the env var, they won't remember or bother to always add it to the notebooks. Then someone else using those notebooks may run into similar issue and it is not obvious that's how they could fix it.

from bumblebee.

josevalim avatar josevalim commented on May 19, 2024

So I guess the best option is some UI to force installation the next install?

from bumblebee.

jonatanklosko avatar jonatanklosko commented on May 19, 2024

That could be useful in other cases too. Would we modify the code on the fly to include force: true?

from bumblebee.

josevalim avatar josevalim commented on May 19, 2024

Moved to Livebook backlog: livebook-dev/livebook#1579

from bumblebee.

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.