Show More
@@ -1,193 +1,381 b'' | |||
|
1 | 1 | { |
|
2 | "metadata": { | |
|
3 | "name": "BackgroundJobs" | |
|
4 | }, | |
|
5 | "nbformat": 3, | |
|
6 | "nbformat_minor": 0, | |
|
2 | 7 |
|
|
3 | 8 | { |
|
4 | 9 |
|
|
5 | 10 | { |
|
6 | "source": "# Simple interactive bacgkround jobs with IPython\n\nWe start by loading the `backgroundjobs` library and defining a few trivial functions to illustrate things with.", | |
|
7 | "cell_type": "markdown" | |
|
11 | "cell_type": "markdown", | |
|
12 | "metadata": {}, | |
|
13 | "source": [ | |
|
14 | "# Simple interactive bacgkround jobs with IPython\n", | |
|
15 | "\n", | |
|
16 | "We start by loading the `backgroundjobs` library and defining a few trivial functions to illustrate things with." | |
|
17 | ] | |
|
8 | 18 | }, |
|
9 | 19 | { |
|
10 | 20 |
|
|
21 | "collapsed": false, | |
|
22 | "input": [ | |
|
23 | "from IPython.lib import backgroundjobs as bg\n", | |
|
24 | "\n", | |
|
25 | "import sys\n", | |
|
26 | "import time\n", | |
|
27 | "\n", | |
|
28 | "def sleepfunc(interval=2, *a, **kw):\n", | |
|
29 | " args = dict(interval=interval,\n", | |
|
30 | " args=a,\n", | |
|
31 | " kwargs=kw)\n", | |
|
32 | " time.sleep(interval)\n", | |
|
33 | " return args\n", | |
|
34 | "\n", | |
|
35 | "def diefunc(interval=2, *a, **kw):\n", | |
|
36 | " time.sleep(interval)\n", | |
|
37 | " raise Exception(\"Dead job with interval %s\" % interval)\n", | |
|
38 | "\n", | |
|
39 | "def printfunc(interval=1, reps=5):\n", | |
|
40 | " for n in range(reps):\n", | |
|
41 | " time.sleep(interval)\n", | |
|
42 | " print 'In the background...', n\n", | |
|
43 | " sys.stdout.flush()\n", | |
|
44 | " print 'All done!'\n", | |
|
45 | " sys.stdout.flush()" | |
|
46 | ], | |
|
11 | 47 |
|
|
48 | "metadata": {}, | |
|
12 | 49 |
|
|
13 | "collapsed": false, | |
|
14 | "prompt_number": 35, | |
|
15 | "input": "from IPython.lib import backgroundjobs as bg\n\nimport sys\nimport time\n\ndef sleepfunc(interval=2, *a, **kw):\n args = dict(interval=interval,\n args=a,\n kwargs=kw)\n time.sleep(interval)\n return args\n\ndef diefunc(interval=2, *a, **kw):\n time.sleep(interval)\n raise Exception(\"Dead job with interval %s\" % interval)\n\ndef printfunc(interval=1, reps=5):\n for n in range(reps):\n time.sleep(interval)\n print 'In the background...', n\n sys.stdout.flush()\n print 'All done!'\n sys.stdout.flush()" | |
|
50 | "prompt_number": 35 | |
|
16 | 51 | }, |
|
17 | 52 | { |
|
18 | "source": "Now, we can create a job manager (called simply `jobs`) and use it to submit new jobs.\n<br>\nRun the cell below and wait a few seconds for the whole thing to finish, until you see the \"All done!\" printout.", | |
|
19 | "cell_type": "markdown" | |
|
53 | "cell_type": "markdown", | |
|
54 | "metadata": {}, | |
|
55 | "source": [ | |
|
56 | "Now, we can create a job manager (called simply `jobs`) and use it to submit new jobs.\n", | |
|
57 | "<br>\n", | |
|
58 | "Run the cell below and wait a few seconds for the whole thing to finish, until you see the \"All done!\" printout." | |
|
59 | ] | |
|
20 | 60 | }, |
|
21 | 61 | { |
|
22 | 62 |
|
|
63 | "collapsed": false, | |
|
64 | "input": [ | |
|
65 | "jobs = bg.BackgroundJobManager()\n", | |
|
66 | "\n", | |
|
67 | "# Start a few jobs, the first one will have ID # 0\n", | |
|
68 | "jobs.new(sleepfunc, 4)\n", | |
|
69 | "jobs.new(sleepfunc, kw={'reps':2})\n", | |
|
70 | "jobs.new('printfunc(1,3)')\n", | |
|
71 | "\n", | |
|
72 | "# This makes a couple of jobs which will die. Let's keep a reference to\n", | |
|
73 | "# them for easier traceback reporting later\n", | |
|
74 | "diejob1 = jobs.new(diefunc, 1)\n", | |
|
75 | "diejob2 = jobs.new(diefunc, 2)" | |
|
76 | ], | |
|
23 | 77 |
|
|
78 | "metadata": {}, | |
|
24 | 79 |
|
|
25 | 80 | { |
|
26 | 81 |
|
|
27 | 82 |
|
|
28 | "text": "Starting job # 0 in a separate thread.\nStarting job # 2 in a separate thread.\nStarting job # 3 in a separate thread.\nStarting job # 4 in a separate thread.\nStarting job # 5 in a separate thread.\n" | |
|
83 | "text": [ | |
|
84 | "Starting job # 0 in a separate thread.\n", | |
|
85 | "Starting job # 2 in a separate thread.\n", | |
|
86 | "Starting job # 3 in a separate thread.\n", | |
|
87 | "Starting job # 4 in a separate thread.\n", | |
|
88 | "Starting job # 5 in a separate thread.\n" | |
|
89 | ] | |
|
29 | 90 | }, |
|
30 | 91 | { |
|
31 | 92 |
|
|
32 | 93 |
|
|
33 | "text": "In the background... 0\n" | |
|
94 | "text": [ | |
|
95 | "In the background... 0\n" | |
|
96 | ] | |
|
34 | 97 | }, |
|
35 | 98 | { |
|
36 | 99 |
|
|
37 | 100 |
|
|
38 | "text": "In the background... 1\n" | |
|
101 | "text": [ | |
|
102 | "In the background... 1\n" | |
|
103 | ] | |
|
39 | 104 | }, |
|
40 | 105 | { |
|
41 | 106 |
|
|
42 | 107 |
|
|
43 | "text": "In the background... 2\n" | |
|
108 | "text": [ | |
|
109 | "In the background... 2\n" | |
|
110 | ] | |
|
44 | 111 | }, |
|
45 | 112 | { |
|
46 | 113 |
|
|
47 | 114 |
|
|
48 | "text": "All done!\n" | |
|
115 | "text": [ | |
|
116 | "All done!\n" | |
|
117 | ] | |
|
49 | 118 | } |
|
50 | 119 | ], |
|
51 | "collapsed": false, | |
|
52 | "prompt_number": 36, | |
|
53 | "input": "jobs = bg.BackgroundJobManager()\n\n# Start a few jobs, the first one will have ID # 0\njobs.new(sleepfunc, 4)\njobs.new(sleepfunc, kw={'reps':2})\njobs.new('printfunc(1,3)')\n\n# This makes a couple of jobs which will die. Let's keep a reference to\n# them for easier traceback reporting later\ndiejob1 = jobs.new(diefunc, 1)\ndiejob2 = jobs.new(diefunc, 2)" | |
|
120 | "prompt_number": 36 | |
|
54 | 121 | }, |
|
55 | 122 | { |
|
56 | "source": "You can check the status of your jobs at any time:", | |
|
57 | "cell_type": "markdown" | |
|
123 | "cell_type": "markdown", | |
|
124 | "metadata": {}, | |
|
125 | "source": [ | |
|
126 | "You can check the status of your jobs at any time:" | |
|
127 | ] | |
|
58 | 128 | }, |
|
59 | 129 | { |
|
60 | 130 |
|
|
131 | "collapsed": false, | |
|
132 | "input": [ | |
|
133 | "jobs.status()" | |
|
134 | ], | |
|
61 | 135 |
|
|
136 | "metadata": {}, | |
|
62 | 137 |
|
|
63 | 138 | { |
|
64 | 139 |
|
|
65 | 140 |
|
|
66 | "text": "Completed jobs:\n0 : <function sleepfunc at 0x30e1578>\n2 : <function sleepfunc at 0x30e1578>\n3 : printfunc(1,3)\n\nDead jobs:\n4 : <function diefunc at 0x304d488>\n5 : <function diefunc at 0x304d488>\n\n" | |
|
141 | "text": [ | |
|
142 | "Completed jobs:\n", | |
|
143 | "0 : <function sleepfunc at 0x30e1578>\n", | |
|
144 | "2 : <function sleepfunc at 0x30e1578>\n", | |
|
145 | "3 : printfunc(1,3)\n", | |
|
146 | "\n", | |
|
147 | "Dead jobs:\n", | |
|
148 | "4 : <function diefunc at 0x304d488>\n", | |
|
149 | "5 : <function diefunc at 0x304d488>\n", | |
|
150 | "\n" | |
|
151 | ] | |
|
67 | 152 | } |
|
68 | 153 | ], |
|
69 | "collapsed": false, | |
|
70 | "prompt_number": 37, | |
|
71 | "input": "jobs.status()" | |
|
154 | "prompt_number": 37 | |
|
72 | 155 | }, |
|
73 | 156 | { |
|
74 | "source": "For any completed job, you can get its result easily:", | |
|
75 | "cell_type": "markdown" | |
|
157 | "cell_type": "markdown", | |
|
158 | "metadata": {}, | |
|
159 | "source": [ | |
|
160 | "For any completed job, you can get its result easily:" | |
|
161 | ] | |
|
76 | 162 | }, |
|
77 | 163 | { |
|
78 | 164 |
|
|
165 | "collapsed": false, | |
|
166 | "input": [ | |
|
167 | "jobs[0].result\n", | |
|
168 | "j0 = jobs[0]\n", | |
|
169 | "j0.join?" | |
|
170 | ], | |
|
79 | 171 |
|
|
172 | "metadata": {}, | |
|
80 | 173 |
|
|
81 | "collapsed": false, | |
|
82 | "prompt_number": 43, | |
|
83 | "input": "jobs[0].result\nj0 = jobs[0]\nj0.join?" | |
|
174 | "prompt_number": 43 | |
|
84 | 175 | }, |
|
85 | 176 | { |
|
86 | "source": "You can get the traceback of any dead job. Run the line\nbelow again interactively until it prints a traceback (check the status\nof the job):\n", | |
|
87 | "cell_type": "markdown" | |
|
177 | "cell_type": "markdown", | |
|
178 | "metadata": {}, | |
|
179 | "source": [ | |
|
180 | "You can get the traceback of any dead job. Run the line\n", | |
|
181 | "below again interactively until it prints a traceback (check the status\n", | |
|
182 | "of the job):\n" | |
|
183 | ] | |
|
88 | 184 | }, |
|
89 | 185 | { |
|
90 | 186 |
|
|
187 | "collapsed": false, | |
|
188 | "input": [ | |
|
189 | "print \"Status of diejob1:\", diejob1.status\n", | |
|
190 | "diejob1.traceback() # jobs.traceback(4) would also work here, with the job number" | |
|
191 | ], | |
|
91 | 192 |
|
|
193 | "metadata": {}, | |
|
92 | 194 |
|
|
93 | 195 | { |
|
94 | 196 |
|
|
95 | 197 |
|
|
96 | "text": "Status of diejob1: Dead (Exception), call jobs.traceback() for details\n<span class=\"ansired\">---------------------------------------------------------------------------</span>\n<span class=\"ansired\">Exception</span> Traceback (most recent call last)\n<span class=\"ansigreen\">/home/fperez/usr/lib/python2.6/site-packages/IPython/lib/backgroundjobs.py</span> in <span class=\"ansicyan\">call</span><span class=\"ansiblue\">(self)</span>\n<span class=\"ansigreen\"> 462</span> <span class=\"ansiyellow\"></span>\n<span class=\"ansigreen\"> 463</span> <span class=\"ansigreen\">def</span> call<span class=\"ansiyellow\">(</span>self<span class=\"ansiyellow\">)</span><span class=\"ansiyellow\">:</span><span class=\"ansiyellow\"></span>\n<span class=\"ansigreen\">--> 464</span><span class=\"ansiyellow\"> </span><span class=\"ansigreen\">return</span> self<span class=\"ansiyellow\">.</span>func<span class=\"ansiyellow\">(</span><span class=\"ansiyellow\">*</span>self<span class=\"ansiyellow\">.</span>args<span class=\"ansiyellow\">,</span> <span class=\"ansiyellow\">**</span>self<span class=\"ansiyellow\">.</span>kwargs<span class=\"ansiyellow\">)</span><span class=\"ansiyellow\"></span>\n\n<span class=\"ansigreen\">/home/fperez/ipython/ipython/docs/examples/lib/<ipython-input-15-54795a097787></span> in <span class=\"ansicyan\">diefunc</span><span class=\"ansiblue\">(interval, *a, **kw)</span>\n<span class=\"ansigreen\"> 14</span> <span class=\"ansigreen\">def</span> diefunc<span class=\"ansiyellow\">(</span>interval<span class=\"ansiyellow\">=</span><span class=\"ansicyan\">2</span><span class=\"ansiyellow\">,</span> <span class=\"ansiyellow\">*</span>a<span class=\"ansiyellow\">,</span> <span class=\"ansiyellow\">**</span>kw<span class=\"ansiyellow\">)</span><span class=\"ansiyellow\">:</span><span class=\"ansiyellow\"></span>\n<span class=\"ansigreen\"> 15</span> time<span class=\"ansiyellow\">.</span>sleep<span class=\"ansiyellow\">(</span>interval<span class=\"ansiyellow\">)</span><span class=\"ansiyellow\"></span>\n<span class=\"ansigreen\">---> 16</span><span class=\"ansiyellow\"> </span><span class=\"ansigreen\">raise</span> Exception<span class=\"ansiyellow\">(</span><span class=\"ansiblue\">"Dead job with interval %s"</span> <span class=\"ansiyellow\">%</span> interval<span class=\"ansiyellow\">)</span><span class=\"ansiyellow\"></span>\n<span class=\"ansigreen\"> 17</span> <span class=\"ansiyellow\"></span>\n<span class=\"ansigreen\"> 18</span> <span class=\"ansigreen\">def</span> printfunc<span class=\"ansiyellow\">(</span>interval<span class=\"ansiyellow\">=</span><span class=\"ansicyan\">1</span><span class=\"ansiyellow\">,</span> reps<span class=\"ansiyellow\">=</span><span class=\"ansicyan\">5</span><span class=\"ansiyellow\">)</span><span class=\"ansiyellow\">:</span><span class=\"ansiyellow\"></span>\n\n<span class=\"ansired\">Exception</span>: Dead job with interval 1\n" | |
|
198 | "text": [ | |
|
199 | "Status of diejob1: Dead (Exception), call jobs.traceback() for details\n", | |
|
200 | "<span class=\"ansired\">---------------------------------------------------------------------------</span>\n", | |
|
201 | "<span class=\"ansired\">Exception</span> Traceback (most recent call last)\n", | |
|
202 | "<span class=\"ansigreen\">/home/fperez/usr/lib/python2.6/site-packages/IPython/lib/backgroundjobs.py</span> in <span class=\"ansicyan\">call</span><span class=\"ansiblue\">(self)</span>\n", | |
|
203 | "<span class=\"ansigreen\"> 462</span> <span class=\"ansiyellow\"></span>\n", | |
|
204 | "<span class=\"ansigreen\"> 463</span> <span class=\"ansigreen\">def</span> call<span class=\"ansiyellow\">(</span>self<span class=\"ansiyellow\">)</span><span class=\"ansiyellow\">:</span><span class=\"ansiyellow\"></span>\n", | |
|
205 | "<span class=\"ansigreen\">--> 464</span><span class=\"ansiyellow\"> </span><span class=\"ansigreen\">return</span> self<span class=\"ansiyellow\">.</span>func<span class=\"ansiyellow\">(</span><span class=\"ansiyellow\">*</span>self<span class=\"ansiyellow\">.</span>args<span class=\"ansiyellow\">,</span> <span class=\"ansiyellow\">**</span>self<span class=\"ansiyellow\">.</span>kwargs<span class=\"ansiyellow\">)</span><span class=\"ansiyellow\"></span>\n", | |
|
206 | "\n", | |
|
207 | "<span class=\"ansigreen\">/home/fperez/ipython/ipython/docs/examples/lib/<ipython-input-15-54795a097787></span> in <span class=\"ansicyan\">diefunc</span><span class=\"ansiblue\">(interval, *a, **kw)</span>\n", | |
|
208 | "<span class=\"ansigreen\"> 14</span> <span class=\"ansigreen\">def</span> diefunc<span class=\"ansiyellow\">(</span>interval<span class=\"ansiyellow\">=</span><span class=\"ansicyan\">2</span><span class=\"ansiyellow\">,</span> <span class=\"ansiyellow\">*</span>a<span class=\"ansiyellow\">,</span> <span class=\"ansiyellow\">**</span>kw<span class=\"ansiyellow\">)</span><span class=\"ansiyellow\">:</span><span class=\"ansiyellow\"></span>\n", | |
|
209 | "<span class=\"ansigreen\"> 15</span> time<span class=\"ansiyellow\">.</span>sleep<span class=\"ansiyellow\">(</span>interval<span class=\"ansiyellow\">)</span><span class=\"ansiyellow\"></span>\n", | |
|
210 | "<span class=\"ansigreen\">---> 16</span><span class=\"ansiyellow\"> </span><span class=\"ansigreen\">raise</span> Exception<span class=\"ansiyellow\">(</span><span class=\"ansiblue\">"Dead job with interval %s"</span> <span class=\"ansiyellow\">%</span> interval<span class=\"ansiyellow\">)</span><span class=\"ansiyellow\"></span>\n", | |
|
211 | "<span class=\"ansigreen\"> 17</span> <span class=\"ansiyellow\"></span>\n", | |
|
212 | "<span class=\"ansigreen\"> 18</span> <span class=\"ansigreen\">def</span> printfunc<span class=\"ansiyellow\">(</span>interval<span class=\"ansiyellow\">=</span><span class=\"ansicyan\">1</span><span class=\"ansiyellow\">,</span> reps<span class=\"ansiyellow\">=</span><span class=\"ansicyan\">5</span><span class=\"ansiyellow\">)</span><span class=\"ansiyellow\">:</span><span class=\"ansiyellow\"></span>\n", | |
|
213 | "\n", | |
|
214 | "<span class=\"ansired\">Exception</span>: Dead job with interval 1\n" | |
|
215 | ] | |
|
97 | 216 | } |
|
98 | 217 | ], |
|
99 | "collapsed": false, | |
|
100 | "prompt_number": 34, | |
|
101 | "input": "print \"Status of diejob1:\", diejob1.status\ndiejob1.traceback() # jobs.traceback(4) would also work here, with the job number" | |
|
218 | "prompt_number": 34 | |
|
102 | 219 | }, |
|
103 | 220 | { |
|
104 | "source": "This will print all tracebacks for all dead jobs:", | |
|
105 | "cell_type": "markdown" | |
|
221 | "cell_type": "markdown", | |
|
222 | "metadata": {}, | |
|
223 | "source": [ | |
|
224 | "This will print all tracebacks for all dead jobs:" | |
|
225 | ] | |
|
106 | 226 | }, |
|
107 | 227 | { |
|
108 | 228 |
|
|
229 | "collapsed": false, | |
|
230 | "input": [ | |
|
231 | "jobs.traceback()" | |
|
232 | ], | |
|
109 | 233 |
|
|
234 | "metadata": {}, | |
|
110 | 235 |
|
|
111 | 236 | { |
|
112 | 237 |
|
|
113 | 238 |
|
|
114 | "text": "Traceback for: <BackgroundJob #4: <function diefunc at 0x30df758>>\n<span class=\"ansired\">---------------------------------------------------------------------------</span>\n<span class=\"ansired\">Exception</span> Traceback (most recent call last)\n<span class=\"ansigreen\">/home/fperez/usr/lib/python2.6/site-packages/IPython/lib/backgroundjobs.py</span> in <span class=\"ansicyan\">call</span><span class=\"ansiblue\">(self)</span>\n<span class=\"ansigreen\"> 462</span> <span class=\"ansiyellow\"></span>\n<span class=\"ansigreen\"> 463</span> <span class=\"ansigreen\">def</span> call<span class=\"ansiyellow\">(</span>self<span class=\"ansiyellow\">)</span><span class=\"ansiyellow\">:</span><span class=\"ansiyellow\"></span>\n<span class=\"ansigreen\">--> 464</span><span class=\"ansiyellow\"> </span><span class=\"ansigreen\">return</span> self<span class=\"ansiyellow\">.</span>func<span class=\"ansiyellow\">(</span><span class=\"ansiyellow\">*</span>self<span class=\"ansiyellow\">.</span>args<span class=\"ansiyellow\">,</span> <span class=\"ansiyellow\">**</span>self<span class=\"ansiyellow\">.</span>kwargs<span class=\"ansiyellow\">)</span><span class=\"ansiyellow\"></span>\n\n<span class=\"ansigreen\">/home/fperez/ipython/ipython/docs/examples/lib/<ipython-input-15-54795a097787></span> in <span class=\"ansicyan\">diefunc</span><span class=\"ansiblue\">(interval, *a, **kw)</span>\n<span class=\"ansigreen\"> 14</span> <span class=\"ansigreen\">def</span> diefunc<span class=\"ansiyellow\">(</span>interval<span class=\"ansiyellow\">=</span><span class=\"ansicyan\">2</span><span class=\"ansiyellow\">,</span> <span class=\"ansiyellow\">*</span>a<span class=\"ansiyellow\">,</span> <span class=\"ansiyellow\">**</span>kw<span class=\"ansiyellow\">)</span><span class=\"ansiyellow\">:</span><span class=\"ansiyellow\"></span>\n<span class=\"ansigreen\"> 15</span> time<span class=\"ansiyellow\">.</span>sleep<span class=\"ansiyellow\">(</span>interval<span class=\"ansiyellow\">)</span><span class=\"ansiyellow\"></span>\n<span class=\"ansigreen\">---> 16</span><span class=\"ansiyellow\"> </span><span class=\"ansigreen\">raise</span> Exception<span class=\"ansiyellow\">(</span><span class=\"ansiblue\">"Dead job with interval %s"</span> <span class=\"ansiyellow\">%</span> interval<span class=\"ansiyellow\">)</span><span class=\"ansiyellow\"></span>\n<span class=\"ansigreen\"> 17</span> <span class=\"ansiyellow\"></span>\n<span class=\"ansigreen\"> 18</span> <span class=\"ansigreen\">def</span> printfunc<span class=\"ansiyellow\">(</span>interval<span class=\"ansiyellow\">=</span><span class=\"ansicyan\">1</span><span class=\"ansiyellow\">,</span> reps<span class=\"ansiyellow\">=</span><span class=\"ansicyan\">5</span><span class=\"ansiyellow\">)</span><span class=\"ansiyellow\">:</span><span class=\"ansiyellow\"></span>\n\n<span class=\"ansired\">Exception</span>: Dead job with interval 1\n\nTraceback for: <BackgroundJob #5: <function diefunc at 0x30df758>>\n<span class=\"ansired\">---------------------------------------------------------------------------</span>\n<span class=\"ansired\">Exception</span> Traceback (most recent call last)\n<span class=\"ansigreen\">/home/fperez/usr/lib/python2.6/site-packages/IPython/lib/backgroundjobs.py</span> in <span class=\"ansicyan\">call</span><span class=\"ansiblue\">(self)</span>\n<span class=\"ansigreen\"> 462</span> <span class=\"ansiyellow\"></span>\n<span class=\"ansigreen\"> 463</span> <span class=\"ansigreen\">def</span> call<span class=\"ansiyellow\">(</span>self<span class=\"ansiyellow\">)</span><span class=\"ansiyellow\">:</span><span class=\"ansiyellow\"></span>\n<span class=\"ansigreen\">--> 464</span><span class=\"ansiyellow\"> </span><span class=\"ansigreen\">return</span> self<span class=\"ansiyellow\">.</span>func<span class=\"ansiyellow\">(</span><span class=\"ansiyellow\">*</span>self<span class=\"ansiyellow\">.</span>args<span class=\"ansiyellow\">,</span> <span class=\"ansiyellow\">**</span>self<span class=\"ansiyellow\">.</span>kwargs<span class=\"ansiyellow\">)</span><span class=\"ansiyellow\"></span>\n\n<span class=\"ansigreen\">/home/fperez/ipython/ipython/docs/examples/lib/<ipython-input-15-54795a097787></span> in <span class=\"ansicyan\">diefunc</span><span class=\"ansiblue\">(interval, *a, **kw)</span>\n<span class=\"ansigreen\"> 14</span> <span class=\"ansigreen\">def</span> diefunc<span class=\"ansiyellow\">(</span>interval<span class=\"ansiyellow\">=</span><span class=\"ansicyan\">2</span><span class=\"ansiyellow\">,</span> <span class=\"ansiyellow\">*</span>a<span class=\"ansiyellow\">,</span> <span class=\"ansiyellow\">**</span>kw<span class=\"ansiyellow\">)</span><span class=\"ansiyellow\">:</span><span class=\"ansiyellow\"></span>\n<span class=\"ansigreen\"> 15</span> time<span class=\"ansiyellow\">.</span>sleep<span class=\"ansiyellow\">(</span>interval<span class=\"ansiyellow\">)</span><span class=\"ansiyellow\"></span>\n<span class=\"ansigreen\">---> 16</span><span class=\"ansiyellow\"> </span><span class=\"ansigreen\">raise</span> Exception<span class=\"ansiyellow\">(</span><span class=\"ansiblue\">"Dead job with interval %s"</span> <span class=\"ansiyellow\">%</span> interval<span class=\"ansiyellow\">)</span><span class=\"ansiyellow\"></span>\n<span class=\"ansigreen\"> 17</span> <span class=\"ansiyellow\"></span>\n<span class=\"ansigreen\"> 18</span> <span class=\"ansigreen\">def</span> printfunc<span class=\"ansiyellow\">(</span>interval<span class=\"ansiyellow\">=</span><span class=\"ansicyan\">1</span><span class=\"ansiyellow\">,</span> reps<span class=\"ansiyellow\">=</span><span class=\"ansicyan\">5</span><span class=\"ansiyellow\">)</span><span class=\"ansiyellow\">:</span><span class=\"ansiyellow\"></span>\n\n<span class=\"ansired\">Exception</span>: Dead job with interval 2\n\n" | |
|
239 | "text": [ | |
|
240 | "Traceback for: <BackgroundJob #4: <function diefunc at 0x30df758>>\n", | |
|
241 | "<span class=\"ansired\">---------------------------------------------------------------------------</span>\n", | |
|
242 | "<span class=\"ansired\">Exception</span> Traceback (most recent call last)\n", | |
|
243 | "<span class=\"ansigreen\">/home/fperez/usr/lib/python2.6/site-packages/IPython/lib/backgroundjobs.py</span> in <span class=\"ansicyan\">call</span><span class=\"ansiblue\">(self)</span>\n", | |
|
244 | "<span class=\"ansigreen\"> 462</span> <span class=\"ansiyellow\"></span>\n", | |
|
245 | "<span class=\"ansigreen\"> 463</span> <span class=\"ansigreen\">def</span> call<span class=\"ansiyellow\">(</span>self<span class=\"ansiyellow\">)</span><span class=\"ansiyellow\">:</span><span class=\"ansiyellow\"></span>\n", | |
|
246 | "<span class=\"ansigreen\">--> 464</span><span class=\"ansiyellow\"> </span><span class=\"ansigreen\">return</span> self<span class=\"ansiyellow\">.</span>func<span class=\"ansiyellow\">(</span><span class=\"ansiyellow\">*</span>self<span class=\"ansiyellow\">.</span>args<span class=\"ansiyellow\">,</span> <span class=\"ansiyellow\">**</span>self<span class=\"ansiyellow\">.</span>kwargs<span class=\"ansiyellow\">)</span><span class=\"ansiyellow\"></span>\n", | |
|
247 | "\n", | |
|
248 | "<span class=\"ansigreen\">/home/fperez/ipython/ipython/docs/examples/lib/<ipython-input-15-54795a097787></span> in <span class=\"ansicyan\">diefunc</span><span class=\"ansiblue\">(interval, *a, **kw)</span>\n", | |
|
249 | "<span class=\"ansigreen\"> 14</span> <span class=\"ansigreen\">def</span> diefunc<span class=\"ansiyellow\">(</span>interval<span class=\"ansiyellow\">=</span><span class=\"ansicyan\">2</span><span class=\"ansiyellow\">,</span> <span class=\"ansiyellow\">*</span>a<span class=\"ansiyellow\">,</span> <span class=\"ansiyellow\">**</span>kw<span class=\"ansiyellow\">)</span><span class=\"ansiyellow\">:</span><span class=\"ansiyellow\"></span>\n", | |
|
250 | "<span class=\"ansigreen\"> 15</span> time<span class=\"ansiyellow\">.</span>sleep<span class=\"ansiyellow\">(</span>interval<span class=\"ansiyellow\">)</span><span class=\"ansiyellow\"></span>\n", | |
|
251 | "<span class=\"ansigreen\">---> 16</span><span class=\"ansiyellow\"> </span><span class=\"ansigreen\">raise</span> Exception<span class=\"ansiyellow\">(</span><span class=\"ansiblue\">"Dead job with interval %s"</span> <span class=\"ansiyellow\">%</span> interval<span class=\"ansiyellow\">)</span><span class=\"ansiyellow\"></span>\n", | |
|
252 | "<span class=\"ansigreen\"> 17</span> <span class=\"ansiyellow\"></span>\n", | |
|
253 | "<span class=\"ansigreen\"> 18</span> <span class=\"ansigreen\">def</span> printfunc<span class=\"ansiyellow\">(</span>interval<span class=\"ansiyellow\">=</span><span class=\"ansicyan\">1</span><span class=\"ansiyellow\">,</span> reps<span class=\"ansiyellow\">=</span><span class=\"ansicyan\">5</span><span class=\"ansiyellow\">)</span><span class=\"ansiyellow\">:</span><span class=\"ansiyellow\"></span>\n", | |
|
254 | "\n", | |
|
255 | "<span class=\"ansired\">Exception</span>: Dead job with interval 1\n", | |
|
256 | "\n", | |
|
257 | "Traceback for: <BackgroundJob #5: <function diefunc at 0x30df758>>\n", | |
|
258 | "<span class=\"ansired\">---------------------------------------------------------------------------</span>\n", | |
|
259 | "<span class=\"ansired\">Exception</span> Traceback (most recent call last)\n", | |
|
260 | "<span class=\"ansigreen\">/home/fperez/usr/lib/python2.6/site-packages/IPython/lib/backgroundjobs.py</span> in <span class=\"ansicyan\">call</span><span class=\"ansiblue\">(self)</span>\n", | |
|
261 | "<span class=\"ansigreen\"> 462</span> <span class=\"ansiyellow\"></span>\n", | |
|
262 | "<span class=\"ansigreen\"> 463</span> <span class=\"ansigreen\">def</span> call<span class=\"ansiyellow\">(</span>self<span class=\"ansiyellow\">)</span><span class=\"ansiyellow\">:</span><span class=\"ansiyellow\"></span>\n", | |
|
263 | "<span class=\"ansigreen\">--> 464</span><span class=\"ansiyellow\"> </span><span class=\"ansigreen\">return</span> self<span class=\"ansiyellow\">.</span>func<span class=\"ansiyellow\">(</span><span class=\"ansiyellow\">*</span>self<span class=\"ansiyellow\">.</span>args<span class=\"ansiyellow\">,</span> <span class=\"ansiyellow\">**</span>self<span class=\"ansiyellow\">.</span>kwargs<span class=\"ansiyellow\">)</span><span class=\"ansiyellow\"></span>\n", | |
|
264 | "\n", | |
|
265 | "<span class=\"ansigreen\">/home/fperez/ipython/ipython/docs/examples/lib/<ipython-input-15-54795a097787></span> in <span class=\"ansicyan\">diefunc</span><span class=\"ansiblue\">(interval, *a, **kw)</span>\n", | |
|
266 | "<span class=\"ansigreen\"> 14</span> <span class=\"ansigreen\">def</span> diefunc<span class=\"ansiyellow\">(</span>interval<span class=\"ansiyellow\">=</span><span class=\"ansicyan\">2</span><span class=\"ansiyellow\">,</span> <span class=\"ansiyellow\">*</span>a<span class=\"ansiyellow\">,</span> <span class=\"ansiyellow\">**</span>kw<span class=\"ansiyellow\">)</span><span class=\"ansiyellow\">:</span><span class=\"ansiyellow\"></span>\n", | |
|
267 | "<span class=\"ansigreen\"> 15</span> time<span class=\"ansiyellow\">.</span>sleep<span class=\"ansiyellow\">(</span>interval<span class=\"ansiyellow\">)</span><span class=\"ansiyellow\"></span>\n", | |
|
268 | "<span class=\"ansigreen\">---> 16</span><span class=\"ansiyellow\"> </span><span class=\"ansigreen\">raise</span> Exception<span class=\"ansiyellow\">(</span><span class=\"ansiblue\">"Dead job with interval %s"</span> <span class=\"ansiyellow\">%</span> interval<span class=\"ansiyellow\">)</span><span class=\"ansiyellow\"></span>\n", | |
|
269 | "<span class=\"ansigreen\"> 17</span> <span class=\"ansiyellow\"></span>\n", | |
|
270 | "<span class=\"ansigreen\"> 18</span> <span class=\"ansigreen\">def</span> printfunc<span class=\"ansiyellow\">(</span>interval<span class=\"ansiyellow\">=</span><span class=\"ansicyan\">1</span><span class=\"ansiyellow\">,</span> reps<span class=\"ansiyellow\">=</span><span class=\"ansicyan\">5</span><span class=\"ansiyellow\">)</span><span class=\"ansiyellow\">:</span><span class=\"ansiyellow\"></span>\n", | |
|
271 | "\n", | |
|
272 | "<span class=\"ansired\">Exception</span>: Dead job with interval 2\n", | |
|
273 | "\n" | |
|
274 | ] | |
|
115 | 275 | } |
|
116 | 276 | ], |
|
117 | "collapsed": false, | |
|
118 | "prompt_number": 33, | |
|
119 | "input": "jobs.traceback()" | |
|
277 | "prompt_number": 33 | |
|
120 | 278 | }, |
|
121 | 279 | { |
|
122 | "source": "The job manager can be flushed of all completed jobs at any time:", | |
|
123 | "cell_type": "markdown" | |
|
280 | "cell_type": "markdown", | |
|
281 | "metadata": {}, | |
|
282 | "source": [ | |
|
283 | "The job manager can be flushed of all completed jobs at any time:" | |
|
284 | ] | |
|
124 | 285 | }, |
|
125 | 286 | { |
|
126 | 287 |
|
|
288 | "collapsed": false, | |
|
289 | "input": [ | |
|
290 | "jobs.flush()" | |
|
291 | ], | |
|
127 | 292 |
|
|
293 | "metadata": {}, | |
|
128 | 294 |
|
|
129 | 295 | { |
|
130 | 296 |
|
|
131 | 297 |
|
|
132 | "text": "No jobs to flush.\n" | |
|
298 | "text": [ | |
|
299 | "No jobs to flush.\n" | |
|
300 | ] | |
|
133 | 301 | } |
|
134 | 302 | ], |
|
135 | "collapsed": false, | |
|
136 | "prompt_number": 25, | |
|
137 | "input": "jobs.flush()" | |
|
303 | "prompt_number": 25 | |
|
138 | 304 | }, |
|
139 | 305 | { |
|
140 | "source": "After that, the status is simply empty:", | |
|
141 | "cell_type": "markdown" | |
|
306 | "cell_type": "markdown", | |
|
307 | "metadata": {}, | |
|
308 | "source": [ | |
|
309 | "After that, the status is simply empty:" | |
|
310 | ] | |
|
142 | 311 | }, |
|
143 | 312 | { |
|
144 | 313 |
|
|
314 | "collapsed": true, | |
|
315 | "input": [ | |
|
316 | "jobs.status()" | |
|
317 | ], | |
|
145 | 318 |
|
|
319 | "metadata": {}, | |
|
146 | 320 |
|
|
147 | "collapsed": true, | |
|
148 | "prompt_number": 27, | |
|
149 | "input": "jobs.status()" | |
|
321 | "prompt_number": 27 | |
|
150 | 322 | }, |
|
151 | 323 | { |
|
152 | "source": "It's easy to wait on a job:", | |
|
153 | "cell_type": "markdown" | |
|
324 | "cell_type": "markdown", | |
|
325 | "metadata": {}, | |
|
326 | "source": [ | |
|
327 | "It's easy to wait on a job:" | |
|
328 | ] | |
|
154 | 329 | }, |
|
155 | 330 | { |
|
156 | 331 |
|
|
332 | "collapsed": false, | |
|
333 | "input": [ | |
|
334 | "j = jobs.new(sleepfunc, 2)\n", | |
|
335 | "print \"Will wait for j now...\"\n", | |
|
336 | "sys.stdout.flush()\n", | |
|
337 | "j.join()\n", | |
|
338 | "print \"Result from j:\"\n", | |
|
339 | "j.result" | |
|
340 | ], | |
|
157 | 341 |
|
|
342 | "metadata": {}, | |
|
158 | 343 |
|
|
159 | 344 | { |
|
160 | 345 |
|
|
161 | 346 |
|
|
162 | "text": "Starting job # 7 in a separate thread.\nWill wait for j now...\n" | |
|
347 | "text": [ | |
|
348 | "Starting job # 7 in a separate thread.\n", | |
|
349 | "Will wait for j now...\n" | |
|
350 | ] | |
|
163 | 351 | }, |
|
164 | 352 | { |
|
165 | 353 |
|
|
166 | 354 |
|
|
167 | "text": "Result from j:\n" | |
|
355 | "text": [ | |
|
356 | "Result from j:\n" | |
|
357 | ] | |
|
168 | 358 | }, |
|
169 | 359 | { |
|
170 | 360 |
|
|
171 | 361 |
|
|
172 | "text": "{'args': (), 'interval': 2, 'kwargs': {}}" | |
|
362 | "text": [ | |
|
363 | "{'args': (), 'interval': 2, 'kwargs': {}}" | |
|
364 | ] | |
|
173 | 365 | } |
|
174 | 366 | ], |
|
175 | "collapsed": false, | |
|
176 | "prompt_number": 46, | |
|
177 | "input": "j = jobs.new(sleepfunc, 2)\nprint \"Will wait for j now...\"\nsys.stdout.flush()\nj.join()\nprint \"Result from j:\"\nj.result" | |
|
367 | "prompt_number": 46 | |
|
178 | 368 | }, |
|
179 | 369 | { |
|
180 | "input": "", | |
|
181 | 370 |
|
|
182 | 371 |
|
|
372 | "input": [], | |
|
183 | 373 |
|
|
374 | "metadata": {}, | |
|
184 | 375 |
|
|
185 | 376 | } |
|
186 | ] | |
|
187 | } | |
|
188 | 377 |
|
|
189 |
|
|
|
190 | "name": "BackgroundJobs" | |
|
191 | }, | |
|
192 | "nbformat": 2 | |
|
378 | "metadata": {} | |
|
379 | } | |
|
380 | ] | |
|
193 | 381 | } No newline at end of file |
@@ -1,228 +1,308 b'' | |||
|
1 | 1 | { |
|
2 | "nbformat": 2, | |
|
3 | 2 |
|
|
4 | 3 |
|
|
5 | 4 |
|
|
5 | "nbformat": 3, | |
|
6 | "nbformat_minor": 0, | |
|
6 | 7 |
|
|
7 | 8 | { |
|
8 | 9 |
|
|
9 | 10 | { |
|
10 | "source": "# Eigenvalue distribution of Gaussian orthogonal random matrices", | |
|
11 | "cell_type": "markdown" | |
|
11 | "cell_type": "markdown", | |
|
12 | "metadata": {}, | |
|
13 | "source": [ | |
|
14 | "# Eigenvalue distribution of Gaussian orthogonal random matrices" | |
|
15 | ] | |
|
12 | 16 | }, |
|
13 | 17 | { |
|
14 | "source": "The eigenvalues of random matrices obey certain statistical laws. Here we construct random matrices \nfrom the Gaussian Orthogonal Ensemble (GOE), find their eigenvalues and then investigate the nearest\nneighbor eigenvalue distribution $\\rho(s)$.", | |
|
15 | "cell_type": "markdown" | |
|
18 | "cell_type": "markdown", | |
|
19 | "metadata": {}, | |
|
20 | "source": [ | |
|
21 | "The eigenvalues of random matrices obey certain statistical laws. Here we construct random matrices \n", | |
|
22 | "from the Gaussian Orthogonal Ensemble (GOE), find their eigenvalues and then investigate the nearest\n", | |
|
23 | "neighbor eigenvalue distribution $\\rho(s)$." | |
|
24 | ] | |
|
16 | 25 | }, |
|
17 | 26 | { |
|
18 | 27 |
|
|
28 | "collapsed": false, | |
|
29 | "input": [ | |
|
30 | "from rmtkernel import ensemble_diffs, normalize_diffs, GOE\n", | |
|
31 | "import numpy as np\n", | |
|
32 | "from IPython.parallel import Client" | |
|
33 | ], | |
|
19 | 34 |
|
|
35 | "metadata": {}, | |
|
20 | 36 |
|
|
21 | "collapsed": false, | |
|
22 | "prompt_number": 1, | |
|
23 | "input": "from rmtkernel import ensemble_diffs, normalize_diffs, GOE\nimport numpy as np\nfrom IPython.parallel import Client" | |
|
37 | "prompt_number": 1 | |
|
24 | 38 | }, |
|
25 | 39 | { |
|
26 | "source": "## Wigner's nearest neighbor eigenvalue distribution", | |
|
27 | "cell_type": "markdown" | |
|
40 | "cell_type": "markdown", | |
|
41 | "metadata": {}, | |
|
42 | "source": [ | |
|
43 | "## Wigner's nearest neighbor eigenvalue distribution" | |
|
44 | ] | |
|
28 | 45 | }, |
|
29 | 46 | { |
|
30 | "source": "The Wigner distribution gives the theoretical result for the nearest neighbor eigenvalue distribution\nfor the GOE:\n\n$$\\rho(s) = \\frac{\\pi s}{2} \\exp(-\\pi s^2/4)$$", | |
|
31 | "cell_type": "markdown" | |
|
47 | "cell_type": "markdown", | |
|
48 | "metadata": {}, | |
|
49 | "source": [ | |
|
50 | "The Wigner distribution gives the theoretical result for the nearest neighbor eigenvalue distribution\n", | |
|
51 | "for the GOE:\n", | |
|
52 | "\n", | |
|
53 | "$$\\rho(s) = \\frac{\\pi s}{2} \\exp(-\\pi s^2/4)$$" | |
|
54 | ] | |
|
32 | 55 | }, |
|
33 | 56 | { |
|
34 | 57 |
|
|
58 | "collapsed": true, | |
|
59 | "input": [ | |
|
60 | "def wigner_dist(s):\n", | |
|
61 | " \"\"\"Returns (s, rho(s)) for the Wigner GOE distribution.\"\"\"\n", | |
|
62 | " return (np.pi*s/2.0) * np.exp(-np.pi*s**2/4.)" | |
|
63 | ], | |
|
35 | 64 |
|
|
65 | "metadata": {}, | |
|
36 | 66 |
|
|
37 | "collapsed": true, | |
|
38 | "prompt_number": 2, | |
|
39 | "input": "def wigner_dist(s):\n \"\"\"Returns (s, rho(s)) for the Wigner GOE distribution.\"\"\"\n return (np.pi*s/2.0) * np.exp(-np.pi*s**2/4.)" | |
|
67 | "prompt_number": 2 | |
|
40 | 68 | }, |
|
41 | 69 | { |
|
42 | 70 |
|
|
71 | "collapsed": true, | |
|
72 | "input": [ | |
|
73 | "def generate_wigner_data():\n", | |
|
74 | " s = np.linspace(0.0,4.0,400)\n", | |
|
75 | " rhos = wigner_dist(s)\n", | |
|
76 | " return s, rhos" | |
|
77 | ], | |
|
43 | 78 |
|
|
79 | "metadata": {}, | |
|
44 | 80 |
|
|
45 | "collapsed": true, | |
|
46 | "prompt_number": 3, | |
|
47 | "input": "def generate_wigner_data():\n s = np.linspace(0.0,4.0,400)\n rhos = wigner_dist(s)\n return s, rhos" | |
|
81 | "prompt_number": 3 | |
|
48 | 82 | }, |
|
49 | 83 | { |
|
50 | 84 |
|
|
85 | "collapsed": false, | |
|
86 | "input": [ | |
|
87 | "s, rhos = generate_wigner_data()" | |
|
88 | ], | |
|
51 | 89 |
|
|
90 | "metadata": {}, | |
|
52 | 91 |
|
|
53 | "collapsed": false, | |
|
54 | "prompt_number": 4, | |
|
55 | "input": "s, rhos = generate_wigner_data()" | |
|
92 | "prompt_number": 4 | |
|
56 | 93 | }, |
|
57 | 94 | { |
|
58 | 95 |
|
|
96 | "collapsed": false, | |
|
97 | "input": [ | |
|
98 | "plot(s, rhos)\n", | |
|
99 | "xlabel('Normalized level spacing s')\n", | |
|
100 | "ylabel('Probability $\\rho(s)$')" | |
|
101 | ], | |
|
59 | 102 |
|
|
103 | "metadata": {}, | |
|
60 | 104 |
|
|
61 | 105 | { |
|
62 | 106 |
|
|
63 | 107 |
|
|
64 | "text": "<matplotlib.text.Text at 0x3828790>" | |
|
108 | "text": [ | |
|
109 | "<matplotlib.text.Text at 0x3828790>" | |
|
110 | ] | |
|
65 | 111 | }, |
|
66 | 112 | { |
|
67 | 113 |
|
|
68 | 114 |
|
|
69 | 115 | } |
|
70 | 116 | ], |
|
71 | "collapsed": false, | |
|
72 | "prompt_number": 17, | |
|
73 | "input": "plot(s, rhos)\nxlabel('Normalized level spacing s')\nylabel('Probability $\\rho(s)$')" | |
|
117 | "prompt_number": 17 | |
|
74 | 118 | }, |
|
75 | 119 | { |
|
76 | "source": "## Serial calculation of nearest neighbor eigenvalue distribution", | |
|
77 | "cell_type": "markdown" | |
|
120 | "cell_type": "markdown", | |
|
121 | "metadata": {}, | |
|
122 | "source": [ | |
|
123 | "## Serial calculation of nearest neighbor eigenvalue distribution" | |
|
124 | ] | |
|
78 | 125 | }, |
|
79 | 126 | { |
|
80 | "source": "In this section we numerically construct and diagonalize a large number of GOE random matrices\nand compute the nerest neighbor eigenvalue distribution. This comptation is done on a single core.", | |
|
81 | "cell_type": "markdown" | |
|
127 | "cell_type": "markdown", | |
|
128 | "metadata": {}, | |
|
129 | "source": [ | |
|
130 | "In this section we numerically construct and diagonalize a large number of GOE random matrices\n", | |
|
131 | "and compute the nerest neighbor eigenvalue distribution. This comptation is done on a single core." | |
|
132 | ] | |
|
82 | 133 | }, |
|
83 | 134 | { |
|
84 | 135 |
|
|
136 | "collapsed": true, | |
|
137 | "input": [ | |
|
138 | "def serial_diffs(num, N):\n", | |
|
139 | " \"\"\"Compute the nearest neighbor distribution for num NxX matrices.\"\"\"\n", | |
|
140 | " diffs = ensemble_diffs(num, N)\n", | |
|
141 | " normalized_diffs = normalize_diffs(diffs)\n", | |
|
142 | " return normalized_diffs" | |
|
143 | ], | |
|
85 | 144 |
|
|
145 | "metadata": {}, | |
|
86 | 146 |
|
|
87 | "collapsed": true, | |
|
88 | "prompt_number": 6, | |
|
89 | "input": "def serial_diffs(num, N):\n \"\"\"Compute the nearest neighbor distribution for num NxX matrices.\"\"\"\n diffs = ensemble_diffs(num, N)\n normalized_diffs = normalize_diffs(diffs)\n return normalized_diffs" | |
|
147 | "prompt_number": 6 | |
|
90 | 148 | }, |
|
91 | 149 | { |
|
92 | 150 |
|
|
151 | "collapsed": true, | |
|
152 | "input": [ | |
|
153 | "serial_nmats = 1000\n", | |
|
154 | "serial_matsize = 50" | |
|
155 | ], | |
|
93 | 156 |
|
|
157 | "metadata": {}, | |
|
94 | 158 |
|
|
95 | "collapsed": true, | |
|
96 | "prompt_number": 7, | |
|
97 | "input": "serial_nmats = 1000\nserial_matsize = 50" | |
|
159 | "prompt_number": 7 | |
|
98 | 160 | }, |
|
99 | 161 | { |
|
100 | 162 |
|
|
163 | "collapsed": false, | |
|
164 | "input": [ | |
|
165 | "%timeit -r1 -n1 serial_diffs(serial_nmats, serial_matsize)" | |
|
166 | ], | |
|
101 | 167 |
|
|
168 | "metadata": {}, | |
|
102 | 169 |
|
|
103 | 170 | { |
|
104 | 171 |
|
|
105 | "text": "1 loops, best of 1: 1.19 s per loop" | |
|
172 | "stream": "stdout", | |
|
173 | "text": [ | |
|
174 | "1 loops, best of 1: 1.19 s per loop" | |
|
175 | ] | |
|
106 | 176 | } |
|
107 | 177 | ], |
|
108 | "collapsed": false, | |
|
109 | "prompt_number": 8, | |
|
110 | "input": "%timeit -r1 -n1 serial_diffs(serial_nmats, serial_matsize)" | |
|
178 | "prompt_number": 8 | |
|
111 | 179 | }, |
|
112 | 180 | { |
|
113 | 181 |
|
|
182 | "collapsed": false, | |
|
183 | "input": [ | |
|
184 | "serial_diffs = serial_diffs(serial_nmats, serial_matsize)" | |
|
185 | ], | |
|
114 | 186 |
|
|
187 | "metadata": {}, | |
|
115 | 188 |
|
|
116 | "collapsed": false, | |
|
117 | "prompt_number": 9, | |
|
118 | "input": "serial_diffs = serial_diffs(serial_nmats, serial_matsize)" | |
|
189 | "prompt_number": 9 | |
|
119 | 190 | }, |
|
120 | 191 | { |
|
121 | "source": "The numerical computation agrees with the predictions of Wigner, but it would be nice to get more\nstatistics. For that we will do a parallel computation.", | |
|
122 | "cell_type": "markdown" | |
|
192 | "cell_type": "markdown", | |
|
193 | "metadata": {}, | |
|
194 | "source": [ | |
|
195 | "The numerical computation agrees with the predictions of Wigner, but it would be nice to get more\n", | |
|
196 | "statistics. For that we will do a parallel computation." | |
|
197 | ] | |
|
123 | 198 | }, |
|
124 | 199 | { |
|
125 | 200 |
|
|
201 | "collapsed": false, | |
|
202 | "input": [ | |
|
203 | "hist_data = hist(serial_diffs, bins=30, normed=True)\n", | |
|
204 | "plot(s, rhos)\n", | |
|
205 | "xlabel('Normalized level spacing s')\n", | |
|
206 | "ylabel('Probability $P(s)$')" | |
|
207 | ], | |
|
126 | 208 |
|
|
209 | "metadata": {}, | |
|
127 | 210 |
|
|
128 | 211 | { |
|
129 | 212 |
|
|
130 | 213 |
|
|
131 | "text": "<matplotlib.text.Text at 0x3475bd0>" | |
|
214 | "text": [ | |
|
215 | "<matplotlib.text.Text at 0x3475bd0>" | |
|
216 | ] | |
|
132 | 217 | }, |
|
133 | 218 | { |
|
134 | 219 |
|
|
135 | 220 |
|
|
136 | 221 | } |
|
137 | 222 | ], |
|
138 | "collapsed": false, | |
|
139 | "prompt_number": 10, | |
|
140 | "input": "hist_data = hist(serial_diffs, bins=30, normed=True)\nplot(s, rhos)\nxlabel('Normalized level spacing s')\nylabel('Probability $P(s)$')" | |
|
223 | "prompt_number": 10 | |
|
141 | 224 | }, |
|
142 | 225 | { |
|
143 | "source": "## Parallel calculation of nearest neighbor eigenvalue distribution", | |
|
144 | "cell_type": "markdown" | |
|
226 | "cell_type": "markdown", | |
|
227 | "metadata": {}, | |
|
228 | "source": [ | |
|
229 | "## Parallel calculation of nearest neighbor eigenvalue distribution" | |
|
230 | ] | |
|
145 | 231 | }, |
|
146 | 232 | { |
|
147 | "source": "Here we perform a parallel computation, where each process constructs and diagonalizes a subset of\nthe overall set of random matrices.", | |
|
148 | "cell_type": "markdown" | |
|
233 | "cell_type": "markdown", | |
|
234 | "metadata": {}, | |
|
235 | "source": [ | |
|
236 | "Here we perform a parallel computation, where each process constructs and diagonalizes a subset of\n", | |
|
237 | "the overall set of random matrices." | |
|
238 | ] | |
|
149 | 239 | }, |
|
150 | 240 | { |
|
151 | 241 |
|
|
242 | "collapsed": true, | |
|
243 | "input": [ | |
|
244 | "def parallel_diffs(rc, num, N):\n", | |
|
245 | " nengines = len(rc.targets)\n", | |
|
246 | " num_per_engine = num/nengines\n", | |
|
247 | " print \"Running with\", num_per_engine, \"per engine.\"\n", | |
|
248 | " ar = rc.apply_async(ensemble_diffs, num_per_engine, N)\n", | |
|
249 | " diffs = np.array(ar.get()).flatten()\n", | |
|
250 | " normalized_diffs = normalize_diffs(diffs)\n", | |
|
251 | " return normalized_diffs" | |
|
252 | ], | |
|
152 | 253 |
|
|
254 | "metadata": {}, | |
|
153 | 255 |
|
|
154 | "collapsed": true, | |
|
155 | "prompt_number": 11, | |
|
156 | "input": "def parallel_diffs(rc, num, N):\n nengines = len(rc.targets)\n num_per_engine = num/nengines\n print \"Running with\", num_per_engine, \"per engine.\"\n ar = rc.apply_async(ensemble_diffs, num_per_engine, N)\n diffs = np.array(ar.get()).flatten()\n normalized_diffs = normalize_diffs(diffs)\n return normalized_diffs" | |
|
256 | "prompt_number": 11 | |
|
157 | 257 | }, |
|
158 | 258 | { |
|
159 | 259 |
|
|
260 | "collapsed": true, | |
|
261 | "input": [ | |
|
262 | "client = Client()\n", | |
|
263 | "view = client[:]\n", | |
|
264 | "view.run('rmtkernel.py')\n", | |
|
265 | "view.block = False" | |
|
266 | ], | |
|
160 | 267 |
|
|
268 | "metadata": {}, | |
|
161 | 269 |
|
|
162 | "collapsed": true, | |
|
163 | "prompt_number": 12, | |
|
164 | "input": "client = Client()\nview = client[:]\nview.run('rmtkernel.py')\nview.block = False" | |
|
270 | "prompt_number": 12 | |
|
165 | 271 | }, |
|
166 | 272 | { |
|
167 | 273 |
|
|
274 | "collapsed": true, | |
|
275 | "input": [ | |
|
276 | "parallel_nmats = 40*serial_nmats\n", | |
|
277 | "parallel_matsize = 50" | |
|
278 | ], | |
|
168 | 279 |
|
|
280 | "metadata": {}, | |
|
169 | 281 |
|
|
170 | "collapsed": true, | |
|
171 | "prompt_number": 13, | |
|
172 | "input": "parallel_nmats = 40*serial_nmats\nparallel_matsize = 50" | |
|
282 | "prompt_number": 13 | |
|
173 | 283 | }, |
|
174 | 284 | { |
|
175 | 285 |
|
|
176 | "language": "python", | |
|
177 | "outputs": [ | |
|
178 | { | |
|
179 | "output_type": "stream", | |
|
180 | "text": "Running with 10000 per engine.\n1 loops, best of 1: 14 s per loop" | |
|
181 | }, | |
|
182 | { | |
|
183 | "output_type": "stream" | |
|
184 | } | |
|
185 | ], | |
|
186 | 286 |
|
|
187 | "prompt_number": 14, | |
|
188 |
|
|
|
189 | }, | |
|
190 | { | |
|
191 | "cell_type": "code", | |
|
287 | "input": [ | |
|
288 | "%timeit -r1 -n1 parallel_diffs(view, parallel_nmats, parallel_matsize)" | |
|
289 | ], | |
|
192 | 290 |
|
|
291 | "metadata": {}, | |
|
193 | 292 |
|
|
194 | 293 | { |
|
195 | 294 |
|
|
196 | "text": "Running with 10000 per engine." | |
|
295 | "stream": "stdout", | |
|
296 | "text": [ | |
|
297 | "Running with 10000 per engine.\n", | |
|
298 | "1 loops, best of 1: 14 s per loop" | |
|
299 | ] | |
|
197 | 300 | } |
|
198 | 301 | ], |
|
199 | "collapsed": false, | |
|
200 | "prompt_number": 15, | |
|
201 | "input": "pdiffs = parallel_diffs(view, parallel_nmats, parallel_matsize)" | |
|
202 | }, | |
|
203 | { | |
|
204 | "source": "Again, the agreement with the Wigner distribution is excellent, but now we have better\nstatistics.", | |
|
205 | "cell_type": "markdown" | |
|
206 | }, | |
|
207 | { | |
|
208 | "cell_type": "code", | |
|
209 | "language": "python", | |
|
210 | "outputs": [ | |
|
211 | { | |
|
212 | "output_type": "pyout", | |
|
213 | "prompt_number": 16, | |
|
214 | "text": "<matplotlib.text.Text at 0x376c950>" | |
|
215 | }, | |
|
216 | { | |
|
217 | "output_type": "display_data", | |
|
218 | "png": "iVBORw0KGgoAAAANSUhEUgAAAYwAAAEMCAYAAADXiYGSAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAIABJREFUeJzt3XlcVPX+x/HXILgjLqhoFmqhgCgMCogmTm5gqN1SM61c\n6hZlirlU1q+uWrduda+pmRrZtVUry8qtMkzH0QTELXdNBRO3FBVQ2Tm/P4i5jmwzMMyZYT7P+5hH\nzMzX7/fN4TIfzvme8z0aRVEUhBBCiEq4qB1ACCGEY5CCIYQQwixSMIQQQphFCoYQQgizSMEQQghh\nFikYQgghzKJKwTAYDPj5+eHj48PChQtLvZ+VlcX06dMJCgoiPDycEydOqJBSCCHEzVQpGFOmTCEu\nLo6NGzeyaNEiLl26ZPL+F198QX5+Pnv37uWdd97h+eefVyOmEEKIm9i8YGRkZAAQERGBt7c3gwYN\nIikpyaTNpk2biI6OB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Ny4ETc3Nx555BEpFk5I9jCEEEKYReYwhBBCmEUKhhBC\nCLNIwRBCCGEWKRhCCCHMIgVDCCGEWaRgCCGEMMv/A2Gk2YWqgwe1AAAAAElFTkSuQmCC\n" | |
|
302 | "prompt_number": 14 | |
|
219 | 303 | } |
|
220 | 304 | ], |
|
221 | "collapsed": false, | |
|
222 | "prompt_number": 16, | |
|
223 | "input": "hist_data = hist(pdiffs, bins=30, normed=True)\nplot(s, rhos)\nxlabel('Normalized level spacing s')\nylabel('Probability $P(s)$')" | |
|
224 | } | |
|
225 | ] | |
|
305 | "metadata": {} | |
|
226 | 306 | } |
|
227 | 307 | ] |
|
228 | 308 | } No newline at end of file |
@@ -2,17 +2,19 b'' | |||
|
2 | 2 | "metadata": { |
|
3 | 3 | "name": "gilsleep" |
|
4 | 4 |
}, |
|
5 |
"nbformat": |
|
|
5 | "nbformat": 3, | |
|
6 | "nbformat_minor": 0, | |
|
6 | 7 | "worksheets": [ |
|
7 | 8 | { |
|
8 | 9 | "cells": [ |
|
9 | 10 | { |
|
10 | 11 |
"cell_type": "markdown", |
|
12 | "metadata": {}, | |
|
11 | 13 | "source": [ |
|
12 |
"Holding the GIL for too long could disrupt the heartbeat due to non-copying sends.", |
|
|
13 |
"", |
|
|
14 |
"The following cell repeatedly calls a function that holds the GIL for five seconds.", |
|
|
15 |
"", |
|
|
14 | "Holding the GIL for too long could disrupt the heartbeat due to non-copying sends.\n", | |
|
15 | "\n", | |
|
16 | "The following cell repeatedly calls a function that holds the GIL for five seconds.\n", | |
|
17 | "\n", | |
|
16 | 18 | "The heartbeat will fail after a few iterations prior to fixing Issue [#1260](https://github.com/ipython/ipython/issues/1260)." |
|
17 | 19 | ] |
|
18 | 20 |
}, |
@@ -20,25 +22,26 b'' | |||
|
20 | 22 |
"cell_type": "code", |
|
21 | 23 |
"collapsed": false, |
|
22 | 24 | "input": [ |
|
23 |
"import sys", |
|
|
24 |
"import time", |
|
|
25 |
"", |
|
|
26 |
"from cython import inline", |
|
|
27 |
"", |
|
|
28 |
"def gilsleep(t):", |
|
|
29 |
" \"\"\"gil-holding sleep with cython.inline\"\"\"", |
|
|
30 |
" code = '\\n'.join([", |
|
|
31 |
" 'from posix cimport unistd',", |
|
|
32 |
" 'unistd.sleep(t)',", |
|
|
33 |
" ])", |
|
|
34 |
" while True:", |
|
|
35 |
" inline(code, quiet=True, t=t)", |
|
|
36 |
" print time.time()", |
|
|
37 |
" sys.stdout.flush() # this is important", |
|
|
38 |
"", |
|
|
25 | "import sys\n", | |
|
26 | "import time\n", | |
|
27 | "\n", | |
|
28 | "from cython import inline\n", | |
|
29 | "\n", | |
|
30 | "def gilsleep(t):\n", | |
|
31 | " \"\"\"gil-holding sleep with cython.inline\"\"\"\n", | |
|
32 | " code = '\\n'.join([\n", | |
|
33 | " 'from posix cimport unistd',\n", | |
|
34 | " 'unistd.sleep(t)',\n", | |
|
35 | " ])\n", | |
|
36 | " while True:\n", | |
|
37 | " inline(code, quiet=True, t=t)\n", | |
|
38 | " print time.time()\n", | |
|
39 | " sys.stdout.flush() # this is important\n", | |
|
40 | "\n", | |
|
39 | 41 | "gilsleep(5)" |
|
40 | 42 |
], |
|
41 | 43 |
"language": "python", |
|
44 | "metadata": {}, | |
|
42 | 45 |
"outputs": [], |
|
43 | 46 | "prompt_number": 1 |
|
44 | 47 |
}, |
@@ -47,10 +50,12 b'' | |||
|
47 | 50 |
"collapsed": true, |
|
48 | 51 |
"input": [], |
|
49 | 52 |
"language": "python", |
|
53 | "metadata": {}, | |
|
50 | 54 |
"outputs": [], |
|
51 | 55 | "prompt_number": " " |
|
52 | 56 | } |
|
53 | ] | |
|
57 | ], | |
|
58 | "metadata": {} | |
|
54 | 59 | } |
|
55 | 60 | ] |
|
56 | 61 | } No newline at end of file |
General Comments 0
You need to be logged in to leave comments.
Login now