shands
Posts: 1
Joined: Sat May 13, 2017 3:08 pm

Multiprocessing help - MagPi 57 p. 56

Sun May 14, 2017 2:19 pm

I copied and pasted four program codes from article URL to my Pi3 and ran from terminal (python3 program_name.py) with following results:
mandelbrot_original - works

mandelbrot_with_map: AttributeError: 'map' object has no attribute 'reshape'
ValueError: total size of new array must be unchanged

manderbrot_multi: works

manderbrot_multi_bunched: AttributeError: 'list' object has no attribute 'reshape'
ValueError: total size of new array must be unchanged

The complete error message (from multi_bunched, with_map identical except a 'map' object) is
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/numpy/core/fromnumeric.py", line 215, in reshape
reshape = a.reshape
AttributeError: 'list' object has no attribute 'reshape'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "hobro_multi_bunched.py", line 51, in <module>
N = reshape(N, (nx,ny)) # change to rectangular array
File "/usr/lib/python3/dist-packages/numpy/core/fromnumeric.py", line 217, in reshape
return _wrapit(a, 'reshape', newshape, order=order)
File "/usr/lib/python3/dist-packages/numpy/core/fromnumeric.py", line 43, in _wrapit
result = getattr(asarray(obj), method)(*args, **kwds)
ValueError: total size of new array must be unchanged

N is a 'map' object in the with_map program and a 'list' object in both the multi and the multi_bundled programs. The array size is changing in the with_map and multi_bunched programs but everything working in the multi program. What is the problem in the with_map and multi_bunched programs?

Return to “The MagPi”