Show More
@@ -549,11 +549,69 b' on the engines until you do ``%autopx`` again.' | |||
|
549 | 549 | [stdout:1] Average max eigenvalue is: 10.064508 |
|
550 | 550 | [stdout:2] Average max eigenvalue is: 10.055724 |
|
551 | 551 | [stdout:3] Average max eigenvalue is: 10.086876 |
|
552 | ||
|
552 | ||
|
553 | 553 | In [35]: %autopx |
|
554 | 554 | Auto Parallel Disabled |
|
555 | 555 | |
|
556 | 556 | |
|
557 | Engines as Kernels | |
|
558 | ****************** | |
|
559 | ||
|
560 | Engines are really the same object as the Kernels used elsewhere in IPython, | |
|
561 | with the minor exception that engines connect to a controller, while regular kernels | |
|
562 | bind their sockets, listening for connections from a QtConsole or other frontends. | |
|
563 | ||
|
564 | Sometimes for debugging or inspection purposes, you would like a QtConsole connected | |
|
565 | to an engine for more direct interaction. You can do this by first instructing | |
|
566 | the Engine to *also* bind its kernel, to listen for connections: | |
|
567 | ||
|
568 | .. sourcecode:: ipython | |
|
569 | ||
|
570 | In [50]: %px from IPython.parallel import bind_kernel; bind_kernel() | |
|
571 | ||
|
572 | Then, if your engines are local, you can start a qtconsole right on the engine(s): | |
|
573 | ||
|
574 | .. sourcecode:: ipython | |
|
575 | ||
|
576 | In [51]: %px %qtconsole | |
|
577 | ||
|
578 | Careful with this one, because if your view is of 16 engines it will start 16 QtConsoles! | |
|
579 | ||
|
580 | Or you can view just the connection info, and work out the right way to connect to the engines, | |
|
581 | depending on where they live and where you are: | |
|
582 | ||
|
583 | .. sourcecode:: ipython | |
|
584 | ||
|
585 | In [51]: %px %connect_info | |
|
586 | Parallel execution on engine(s): [0, 1, 2, 3] | |
|
587 | [stdout:0] | |
|
588 | { | |
|
589 | "stdin_port": 60387, | |
|
590 | "ip": "127.0.0.1", | |
|
591 | "hb_port": 50835, | |
|
592 | "key": "eee2dd69-7dd3-4340-bf3e-7e2e22a62542", | |
|
593 | "shell_port": 55328, | |
|
594 | "iopub_port": 58264 | |
|
595 | } | |
|
596 | ||
|
597 | Paste the above JSON into a file, and connect with: | |
|
598 | $> ipython <app> --existing <file> | |
|
599 | or, if you are local, you can connect with just: | |
|
600 | $> ipython <app> --existing kernel-60125.json | |
|
601 | or even just: | |
|
602 | $> ipython <app> --existing | |
|
603 | if this is the most recent IPython session you have started. | |
|
604 | [stdout:1] | |
|
605 | { | |
|
606 | "stdin_port": 61869, | |
|
607 | ... | |
|
608 | ||
|
609 | .. note:: | |
|
610 | ||
|
611 | ``%qtconsole`` will call :func:`bind_kernel` on an engine if it hasn't been done already, | |
|
612 | so you can often skip that first step. | |
|
613 | ||
|
614 | ||
|
557 | 615 | Moving Python objects around |
|
558 | 616 | ============================ |
|
559 | 617 |
General Comments 0
You need to be logged in to leave comments.
Login now