MCPcopy Create free account
hub / github.com/Apress/python-for-matlab-development / main

Function main

code/dask/MB_numba_dask.py:64–89  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

62 return img
63
64def main():
65 imax = 255
66 N = 35_000
67 T_s = time.time()
68 nR, nC = N, N
69 Re = np.linspace(-0.7440, -0.7433, nC)
70 Im = np.linspace( 0.1315, 0.1322, nR)
71 n_jobs = 18
72 #client = Client('127.0.0.1:8786')
73 client = Client('143.198.155.245:8786')
74 tasks = []
75 for i in range(n_jobs):
76 job = dask.delayed(MB)(Re, Im, 255, i, n_jobs)
77 tasks.append(job)
78 results = dask.compute(*tasks)
79 client.close()
80
81 # reassemble the image
82 img = np.empty((N,N), dtype=np.uint8)
83 for i in range(n_jobs):
84 my_rows = range(i, len(Im), n_jobs)
85 img[my_rows,:] = results[i][:]
86
87 print(f'{time.time() - T_s:.3f} {N:5d}')
88 plt.imshow(img)
89 plt.show()
90if __name__ == '__main__': main()

Callers 1

MB_numba_dask.pyFile · 0.70

Calls 1

showMethod · 0.80

Tested by

no test coverage detected