3
votes

I am quite new to python and was tring to use dask but I keep getting RuntimeWarning and dont really get why. Some insight would be nice.

code:

x2 = da.random.uniform(0.01,0.1,size=1e6,chunks= 1e5)
%time asd2 = da.arccos(x2)

this constantly gives me:

C:\ProgramsPhD\Anaconda\lib\site-packages\dask\array\core.py:457: RuntimeWarning: invalid value encountered in arccos o = func(*args, **kwargs)

1

1 Answers

2
votes

This warning is harmless. Dask.array has to determine the dtype of the output array but, because it is lazy, it doesn't yet have access to any of the data. To resolve this it calls np.arccos on a tiny bit of data. Sometimes this tiny bit of data is zero, which raises a NumPy warning.

This is annoying and should be fixed, but it doesn't affect your actual computation.

In [1]: import dask.array as da

In [2]: x2 = da.random.uniform(0.01,0.1,size=1e6,chunks= 1e5)
   ...: %time asd2 = da.arccos(x2)
   ...: 
/home/mrocklin/workspace/dask/dask/array/core.py:476: RuntimeWarning: invalid value encountered in arccos
  o = func(*args, **kwargs)
CPU times: user 5.61 ms, sys: 108 µs, total: 5.72 ms
Wall time: 9.66 ms

In [3]: asd2
Out[3]: dask.array<arccos, shape=(1000000,), dtype=float64, chunksize=(100000,)>

In [4]: asd2.compute()
Out[4]: 
array([ 1.48500108,  1.55036626,  1.50620869, ...,  1.52765354,
        1.5051477 ,  1.49203593])