Possible to combine @parallel and %cython?
We have both @parallel and %cython to speed-up calculations. Can we join them?
A simple example to test that indeed all four cores are active.
sage: @parallel(p_iter='multiprocessing')
sage: def spill(n):
... tell=0
... while n>1:
... n=int(n/2-(5n+2)/4((-1)^(n&1)-1))
... tell+=1
... return tell
...
sage: a=9780657630
sage: for X, Y in sorted(list(spill([a]*4))): print X,Y
((9780657630,), {}) 1132
((9780657630,), {}) 1132
((9780657630,), {}) 1132
((9780657630,), {}) 1132
How can I use %cython to optimize the code further? I tried to find a way but always the message 'global name '....' is not defined' appears.
N.B.: the '3x+1'-code itself is only an example and not my problem.
Thanks in advance for your suggestions! I use VirtualBox, Win7 64, Sage 4.8 Roland