Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a way to run multiple cells simultaneously in IPython notebook?

One cell in my notebook executes for a long time, while the other CPU's in the machine are idle. Is it possible to run other cells in parallel?

like image 495
user2808117 Avatar asked Jan 21 '14 03:01

user2808117


People also ask

Can you run multiple cells at once Jupyter notebook?

First, you will need to install jupyter nbextensions configurator as described here. Then search for "Initialization cells" from inside the search bar of the Jupyter nbextension manager. A check box at the top of every cell will appear. You can select which cells to be marked as initialization cells.

How do you simultaneously work on Jupyter notebook?

Editors are not collaborative by default; to activate it, start JupyterLab with the --collaborative flag. To share a document with other users, you can copy the URL and send it, or you can install a helpful extension called jupyterlab-link-share that might help to share the link including the token.


2 Answers

Yes. Here is the documentation for ipyparallel (formerly IPython parallel) that will show you how to spawn multiple IPython kernel. After you are free to distribute the work across cores, and you can prefix cells with %%px0 %%px1... %%px999 (once set up) to execute a cell on a specific engine, which in practice correspond to parallel execution of cell. I woudl suggest having a look at Dask as well.

like image 176
Matt Avatar answered Sep 17 '22 23:09

Matt


This does not answer your question directly but I think it would help a lot of people that are having the same problem. You can move variables between notebooks easily and then continue running the functions on another notebook then move the result back to the main notebook.

For example:

Notebook 1:

%store X %store y 

Notebook 2:

%store -r X %store -r y  new_df = ... %store new_df 

Notebook 1:

%store -r new_df  
like image 43
Yousef Avatar answered Sep 19 '22 23:09

Yousef