why my pc is crashing when using da.where() and how to solve it?

时间:2019-04-16 22:47:26

标签: python dask

In order to broadcast 2d arrays and create a 3d array, i use this simple code.

import numpy as np
import dask.array as da

x = da.random.uniform(size=(200, 100000), chunks=(200,100))
ind = da.random.binomial(1, 0.5, (200, 200, 1)).astype(np.bool)
x = da.where(ind, x, 0)
x = x.persist() #the crash happens here
print(x)`

I expect x to be a (200,200,100000) array with 0 where ind is False. However, its cause a sudden increase of the RAM usage and my pc freeze and it becomes unusable. I tried several chunk size but with the same result. setup: os: linux mint 18 cpu: i5 4440 ram: 8gb dask version: 1.2.0

thank you for your help

0 个答案:

没有答案