diff --git a/examples/Parallel/InteractiveMPI-publish-data.ipynb b/examples/Parallel/Examples/InteractiveMPI-publish-data.ipynb similarity index 100% rename from examples/Parallel/InteractiveMPI-publish-data.ipynb rename to examples/Parallel/Examples/InteractiveMPI-publish-data.ipynb diff --git a/examples/Parallel/InteractiveMPI.ipynb b/examples/Parallel/Examples/InteractiveMPI.ipynb similarity index 100% rename from examples/Parallel/InteractiveMPI.ipynb rename to examples/Parallel/Examples/InteractiveMPI.ipynb diff --git a/examples/Parallel/Parallel Magics.ipynb b/examples/Parallel/Examples/Parallel Magics.ipynb similarity index 100% rename from examples/Parallel/Parallel Magics.ipynb rename to examples/Parallel/Examples/Parallel Magics.ipynb diff --git a/examples/Parallel/Using Dill.ipynb b/examples/Parallel/Examples/Using Dill.ipynb similarity index 100% rename from examples/Parallel/Using Dill.ipynb rename to examples/Parallel/Examples/Using Dill.ipynb diff --git a/examples/Parallel/customresults.py b/examples/Parallel/Examples/customresults.py similarity index 100% rename from examples/Parallel/customresults.py rename to examples/Parallel/Examples/customresults.py diff --git a/examples/Parallel/davinci/pwordfreq.py b/examples/Parallel/Examples/daVinci Word Count/pwordfreq.py similarity index 100% rename from examples/Parallel/davinci/pwordfreq.py rename to examples/Parallel/Examples/daVinci Word Count/pwordfreq.py diff --git a/examples/Parallel/davinci/wordfreq.py b/examples/Parallel/Examples/daVinci Word Count/wordfreq.py similarity index 100% rename from examples/Parallel/davinci/wordfreq.py rename to examples/Parallel/Examples/daVinci Word Count/wordfreq.py diff --git a/examples/Parallel/dagdeps.py b/examples/Parallel/Examples/dagdeps.py similarity index 100% rename from examples/Parallel/dagdeps.py rename to examples/Parallel/Examples/dagdeps.py diff --git a/examples/Parallel/demo/dependencies.py b/examples/Parallel/Examples/dependencies.py similarity index 100% rename from examples/Parallel/demo/dependencies.py rename to examples/Parallel/Examples/dependencies.py diff --git a/examples/Parallel/fetchparse.py b/examples/Parallel/Examples/fetchparse.py similarity index 100% rename from examples/Parallel/fetchparse.py rename to examples/Parallel/Examples/fetchparse.py diff --git a/examples/Parallel/interengine/bintree.py b/examples/Parallel/Examples/interengine/bintree.py similarity index 100% rename from examples/Parallel/interengine/bintree.py rename to examples/Parallel/Examples/interengine/bintree.py diff --git a/examples/Parallel/interengine/bintree_script.py b/examples/Parallel/Examples/interengine/bintree_script.py similarity index 100% rename from examples/Parallel/interengine/bintree_script.py rename to examples/Parallel/Examples/interengine/bintree_script.py diff --git a/examples/Parallel/interengine/communicator.py b/examples/Parallel/Examples/interengine/communicator.py similarity index 100% rename from examples/Parallel/interengine/communicator.py rename to examples/Parallel/Examples/interengine/communicator.py diff --git a/examples/Parallel/interengine/interengine.py b/examples/Parallel/Examples/interengine/interengine.py similarity index 100% rename from examples/Parallel/interengine/interengine.py rename to examples/Parallel/Examples/interengine/interengine.py diff --git a/examples/Parallel/iopubwatcher.py b/examples/Parallel/Examples/iopubwatcher.py similarity index 100% rename from examples/Parallel/iopubwatcher.py rename to examples/Parallel/Examples/iopubwatcher.py diff --git a/examples/Parallel/itermapresult.py b/examples/Parallel/Examples/itermapresult.py similarity index 100% rename from examples/Parallel/itermapresult.py rename to examples/Parallel/Examples/itermapresult.py diff --git a/examples/Parallel/demo/map.py b/examples/Parallel/Examples/map.py similarity index 100% rename from examples/Parallel/demo/map.py rename to examples/Parallel/Examples/map.py diff --git a/examples/Parallel/options/Parallel MC Options.ipynb b/examples/Parallel/Examples/options/Parallel MC Options.ipynb similarity index 100% rename from examples/Parallel/options/Parallel MC Options.ipynb rename to examples/Parallel/Examples/options/Parallel MC Options.ipynb diff --git a/examples/Parallel/pi/parallelpi.py b/examples/Parallel/Examples/pi/parallelpi.py similarity index 100% rename from examples/Parallel/pi/parallelpi.py rename to examples/Parallel/Examples/pi/parallelpi.py diff --git a/examples/Parallel/pi/pidigits.py b/examples/Parallel/Examples/pi/pidigits.py similarity index 100% rename from examples/Parallel/pi/pidigits.py rename to examples/Parallel/Examples/pi/pidigits.py diff --git a/examples/Parallel/rmt/rmt.ipy b/examples/Parallel/Examples/rmt/rmt.ipy similarity index 100% rename from examples/Parallel/rmt/rmt.ipy rename to examples/Parallel/Examples/rmt/rmt.ipy diff --git a/examples/Parallel/rmt/rmt.ipynb b/examples/Parallel/Examples/rmt/rmt.ipynb similarity index 100% rename from examples/Parallel/rmt/rmt.ipynb rename to examples/Parallel/Examples/rmt/rmt.ipynb diff --git a/examples/Parallel/rmt/rmtkernel.py b/examples/Parallel/Examples/rmt/rmtkernel.py similarity index 100% rename from examples/Parallel/rmt/rmtkernel.py rename to examples/Parallel/Examples/rmt/rmtkernel.py diff --git a/examples/Parallel/demo/throughput.py b/examples/Parallel/Examples/throughput.py similarity index 100% rename from examples/Parallel/demo/throughput.py rename to examples/Parallel/Examples/throughput.py diff --git a/examples/Parallel/wave2D/RectPartitioner.py b/examples/Parallel/Examples/wave2D/RectPartitioner.py similarity index 100% rename from examples/Parallel/wave2D/RectPartitioner.py rename to examples/Parallel/Examples/wave2D/RectPartitioner.py diff --git a/examples/Parallel/wave2D/communicator.py b/examples/Parallel/Examples/wave2D/communicator.py similarity index 100% rename from examples/Parallel/wave2D/communicator.py rename to examples/Parallel/Examples/wave2D/communicator.py diff --git a/examples/Parallel/wave2D/parallelwave-mpi.py b/examples/Parallel/Examples/wave2D/parallelwave-mpi.py similarity index 100% rename from examples/Parallel/wave2D/parallelwave-mpi.py rename to examples/Parallel/Examples/wave2D/parallelwave-mpi.py diff --git a/examples/Parallel/wave2D/parallelwave.py b/examples/Parallel/Examples/wave2D/parallelwave.py similarity index 100% rename from examples/Parallel/wave2D/parallelwave.py rename to examples/Parallel/Examples/wave2D/parallelwave.py diff --git a/examples/Parallel/wave2D/wavesolver.py b/examples/Parallel/Examples/wave2D/wavesolver.py similarity index 100% rename from examples/Parallel/wave2D/wavesolver.py rename to examples/Parallel/Examples/wave2D/wavesolver.py diff --git a/examples/Parallel/workflow/client.py b/examples/Parallel/Examples/workflow/client.py similarity index 100% rename from examples/Parallel/workflow/client.py rename to examples/Parallel/Examples/workflow/client.py diff --git a/examples/Parallel/workflow/job_wrapper.py b/examples/Parallel/Examples/workflow/job_wrapper.py similarity index 100% rename from examples/Parallel/workflow/job_wrapper.py rename to examples/Parallel/Examples/workflow/job_wrapper.py diff --git a/examples/Parallel/workflow/wmanager.py b/examples/Parallel/Examples/workflow/wmanager.py similarity index 100% rename from examples/Parallel/workflow/wmanager.py rename to examples/Parallel/Examples/workflow/wmanager.py diff --git a/examples/Parallel/demo/noncopying.py b/examples/Parallel/demo/noncopying.py deleted file mode 100644 index 217372a..0000000 --- a/examples/Parallel/demo/noncopying.py +++ /dev/null @@ -1,44 +0,0 @@ -"""non-copying sends""" -import zmq -import numpy - -n = 10 -iface = 'inproc://pub' - -ctx = zmq.Context() - -p = ctx.socket(zmq.PUB) -p.bind(iface) - -# connect 2 subs -s1 = ctx.socket(zmq.SUB) -s1.connect(iface) -s1.setsockopt(zmq.SUBSCRIBE, '') - -s2 = ctx.socket(zmq.SUB) -s2.connect(iface) -s2.setsockopt(zmq.SUBSCRIBE, '') - -A = numpy.random.random((1024,1024)) - -# send -p.send(A, copy=False) -# recv on 1 non-copy -msg1 = s1.recv(copy=False) -B1 = numpy.frombuffer(msg1.buffer, dtype=A.dtype).reshape(A.shape) -# recv on 2 copy -msg2 = s2.recv(copy=False) -B2 = numpy.frombuffer(buffer(msg2.bytes), dtype=A.dtype).reshape(A.shape) - -print((B1==B2).all()) -print((B1==A).all()) -A[0][0] += 10 -print("~") -# after changing A in-place, B1 changes too, proving non-copying sends -print((B1==A).all()) -# but B2 is fixed, since it called the msg.bytes attr, which copies -print((B1==B2).all()) - - - - diff --git a/examples/Parallel/demo/views.py b/examples/Parallel/demo/views.py deleted file mode 100644 index a40b476..0000000 --- a/examples/Parallel/demo/views.py +++ /dev/null @@ -1,15 +0,0 @@ -from IPython.parallel import * - -client = Client() - -for id in client.ids: - client[id].push(dict(ids=id*id)) - -v = client[0] -v['a'] = 5 - -print(v['a']) - -remotes = client[:] - -print(remotes['ids']) diff --git a/examples/Parallel/helloworld.ipynb b/examples/Parallel/helloworld.ipynb deleted file mode 100644 index 582da63..0000000 --- a/examples/Parallel/helloworld.ipynb +++ /dev/null @@ -1,102 +0,0 @@ -{ - "metadata": { - "name": "" - }, - "nbformat": 3, - "nbformat_minor": 0, - "worksheets": [ - { - "cells": [ - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# Distributed hello world\n", - "\n", - "Originally by Ken Kinder (ken at kenkinder dom com)" - ] - }, - { - "cell_type": "code", - "collapsed": true, - "input": [ - "from __future__ import print_function\n", - "from IPython.parallel import Client" - ], - "language": "python", - "metadata": {}, - "outputs": [], - "prompt_number": 1 - }, - { - "cell_type": "code", - "collapsed": true, - "input": [ - "rc = Client()\n", - "view = rc.load_balanced_view()" - ], - "language": "python", - "metadata": {}, - "outputs": [], - "prompt_number": 2 - }, - { - "cell_type": "code", - "collapsed": true, - "input": [ - "def sleep_and_echo(t, msg):\n", - " import time\n", - " time.sleep(t)\n", - " return msg" - ], - "language": "python", - "metadata": {}, - "outputs": [], - "prompt_number": 3 - }, - { - "cell_type": "code", - "collapsed": true, - "input": [ - "world = view.apply_async(sleep_and_echo, 3, 'World!')\n", - "hello = view.apply_async(sleep_and_echo, 2, 'Hello')" - ], - "language": "python", - "metadata": {}, - "outputs": [], - "prompt_number": 4 - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "print(\"Submitted tasks:\", hello.msg_ids + world.msg_ids)\n", - "print(hello.get(), world.get())" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Submitted tasks: ['04670c2d-b2fd-4b6b-a5ac-dee15e533683', 'fc802284-507b-4c29-a526-67396e17718c']\n", - "Hello World!\n" - ] - } - ], - "prompt_number": 6 - }, - { - "cell_type": "code", - "collapsed": false, - "input": [], - "language": "python", - "metadata": {}, - "outputs": [] - } - ], - "metadata": {} - } - ] -} \ No newline at end of file diff --git a/examples/Parallel/helloworld.py b/examples/Parallel/helloworld.py deleted file mode 100644 index 93f5ca8..0000000 --- a/examples/Parallel/helloworld.py +++ /dev/null @@ -1,35 +0,0 @@ -# 2 - -# - -# # Distributed hello world -# -# Originally by Ken Kinder (ken at kenkinder dom com) - -# -from __future__ import print_function - -from IPython.parallel import Client - -# - -rc = Client() -view = rc.load_balanced_view() - -# - -def sleep_and_echo(t, msg): - import time - time.sleep(t) - return msg - -# - -world = view.apply_async(sleep_and_echo, 3, 'World!') -hello = view.apply_async(sleep_and_echo, 2, 'Hello') - -# - -print("Submitted tasks:", hello.msg_ids, world.msg_ids) -print(hello.get(), world.get()) - diff --git a/examples/Parallel/plotting/parallel_plot.ipy b/examples/Parallel/plotting/parallel_plot.ipy deleted file mode 100644 index c78c6af..0000000 --- a/examples/Parallel/plotting/parallel_plot.ipy +++ /dev/null @@ -1,44 +0,0 @@ -"""Example of how to use matplotlib to plot parallel data. - -The idea here is to run matplotlib is the same IPython session -as an ipython parallel Client. That way matplotlib -can be used to plot parallel data that is gathered using -a DirectView. - -To run this example, first start the IPython controller and 4 -engines:: - - ipcluster -n 4 - -Then start ipython with matplotlib integration mode:: - - ipython --matplotlib - -Then a simple "%run parallel_plot.ipy" in IPython will run the -example. -""" - -import matplotlib.pyplot as plt -from IPython.parallel import Client - -# Get an IPython Client -rc = Client() -v = rc[:] - -# Create random arrays on the engines -# This is to simulate arrays that you have calculated in parallel -# on the engines. -# Anymore that length 10000 arrays, matplotlib starts to be slow -%px import numpy as np -%px x = np.random.standard_normal(10000) -%px y = np.random.standard_normal(10000) - -print v.apply_async(lambda : x[0:10]).get_dict() -print v.apply_async(lambda : y[0:10]).get_dict() - -# Bring back the data -x_local = v.gather('x', block=True) -y_local = v.gather('y', block=True) - -# Make a scatter plot of the gathered data -plt.plot(x_local, y_local,'ro') diff --git a/examples/Parallel/plotting/plotting_backend.py b/examples/Parallel/plotting/plotting_backend.py deleted file mode 100644 index 178c6db..0000000 --- a/examples/Parallel/plotting/plotting_backend.py +++ /dev/null @@ -1,58 +0,0 @@ -"""An example of how to use IPython for plotting remote parallel data - -The two files plotting_frontend.py and plotting_backend.py go together. - -This file (plotting_backend.py) performs the actual computation. For this -example, the computation just generates a set of random numbers that -look like a distribution of particles with 2D position (x,y) and -momentum (px,py). In a real situation, this file would do some time -consuming and complicated calculation, and could possibly make calls -to MPI. - -One important feature is that this script can also be run standalone without -IPython. This is nice as it allows it to be run in more traditional -settings where IPython isn't being used. - -When used with IPython.parallel, this code is run on the engines. Because this -code doesn't make any plots, the engines don't have to have any plotting -packages installed. -""" -from __future__ import print_function - -# Imports -import numpy as N -import time -import random - -# Functions -def compute_particles(number): - x = N.random.standard_normal(number) - y = N.random.standard_normal(number) - px = N.random.standard_normal(number) - py = N.random.standard_normal(number) - return x, y, px, py - -def downsample(array, k): - """Choose k random elements of array.""" - length = array.shape[0] - indices = random.sample(xrange(length), k) - return array[indices] - -# Parameters of the run -number = 100000 -d_number = 1000 - -# The actual run - -time.sleep(0) # Pretend it took a while -x, y, px, py = compute_particles(number) -# Now downsample the data -downx = downsample(x, d_number) -downy = downsample(x, d_number) -downpx = downsample(px, d_number) -downpy = downsample(py, d_number) - -print("downx: ", downx[:10]) -print("downy: ", downy[:10]) -print("downpx: ", downpx[:10]) -print("downpy: ", downpy[:10]) diff --git a/examples/Parallel/plotting/plotting_frontend.py b/examples/Parallel/plotting/plotting_frontend.py deleted file mode 100644 index 1760003..0000000 --- a/examples/Parallel/plotting/plotting_frontend.py +++ /dev/null @@ -1,60 +0,0 @@ -"""An example of how to use IPython1 for plotting remote parallel data - -The two files plotting_frontend.py and plotting_backend.py go together. - -To run this example, first start the IPython controller and 4 -engines:: - - ipcluster start -n 4 - -Then start ipython with matplotlib integration:: - - ipython --matplotlib - -Then a simple "run plotting_frontend.py" in IPython will run the -example. When this is done, all the variables (such as number, downx, etc.) -are available in IPython, so for example you can make additional plots. -""" -from __future__ import print_function - -import matplotlib.pyplot as plt -from IPython.parallel import Client - -# Connect to the cluster -rc = Client() -view = rc[:] - -# Run the simulation on all the engines -view.run('plotting_backend.py') - -# Bring back the data. These are all AsyncResult objects -number = view.pull('number') -d_number = view.pull('d_number') -downx = view.gather('downx') -downy = view.gather('downy') -downpx = view.gather('downpx') -downpy = view.gather('downpy') - -# but we can still iterate through AsyncResults before they are done -print("number: ", sum(number)) -print("downsampled number: ", sum(d_number)) - - -# Make a scatter plot of the gathered data -# These calls to matplotlib could be replaced by calls to pygist or -# another plotting package. -plt.figure(1) -# wait for downx/y -downx = downx.get() -downy = downy.get() -plt.scatter(downx, downy) -plt.xlabel('x') -plt.ylabel('y') -plt.figure(2) -# wait for downpx/y -downpx = downpx.get() -downpy = downpy.get() -plt.scatter(downpx, downpy) -plt.xlabel('px') -plt.ylabel('py') -plt.show()