Jupyter Notebook - GPU

北战南征 提交于 2019-12-10 18:14:18

问题


I'm working on a Jupyter Notebook and would like to make it run faster by using Google GPU. I've already made a few researches and found a solution, but it didn't work for me.

The solution was:

"Easiest way to do is use connect to Local Runtime then select hardware accelerator as GPU as shown in Google Colab Free GPU Tutorial."

I did manage to connect googe colab to jupyter but when I then try to switch the hardware accelerator to GPU, I get disconnected from my jupyter notebook... In the tutorial he seemed to be able to be connected to jupyter AND still use GPU, but I can't.

Does anyone know how to fix that problem?


回答1:


I think what you're asking is not possible. Some explanations:

In your situation you have two frontends, that you are using to interact with your code:

  1. Jupyter Notebook (served to your browser by a local server running your computer)
  2. Google Colab (served from google servers)

Additionally you have two backends that run the code they're receiving from your frontend:

  1. IPython kernels (started by your jupyter process)
  2. Google cloud runtimes (running on google cloud infrastructure, possibly with GPU acceleration)

The following combinations are possible:

  1. Jupyer Notebook --> IPython kernel which is probably the setup you started with.
  2. Google Colab --> Google cloud runtimes is the default setup of Google colab. You upload a notebook file to your google drive (or create a new one). The code you're executing in the Colab interface get's run on google cloud infrastructure. This also give you access to GPU acceleration by activating it in Runtime -> Change Runtime Type
  3. Google Colab --> IPython kernel You're still writing code in the Google Colab interface as in (2), but when you execute a cell it's run by a IPython kernel on your computer using your local hardware. This setup is described in the 'local runtime' help article you linked.

What you're trying to do sounds like:

  1. Jupyter Notebook --> Google cloud runtime which is the only combination here that is not possible.

If you want to run a notebook using with GPU acceleration on google cloud hardware you have two options:

  1. Upload it to your Google Drive and edit/run it in Google Colab (setup 2 above)
  2. Use a Google Compute Engine instance to run a Jupyer Notebook as described here. Note that in this case fees may apply.


来源:https://stackoverflow.com/questions/53691393/jupyter-notebook-gpu

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!