Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BUG: RuntimeWarning: All-NaN slice encountered #226

Open
pagecp opened this issue Oct 14, 2022 · 2 comments
Open

BUG: RuntimeWarning: All-NaN slice encountered #226

pagecp opened this issue Oct 14, 2022 · 2 comments

Comments

@pagecp
Copy link
Collaborator

pagecp commented Oct 14, 2022

  • icclim version: 5.4.0
  • Python version: 3.9

Description

Sometimes when calculating, I get a warning on All-NaN slice encountered. After it gets Killed but I cannot confirm it is related, since what is raised is only a Warning. Further investigation will be done by running manually on the input file.

Sorry for the poor GitHub issue information included here... it is run in batch so I have less information until I run it manually.

Minimal reproducible example

/home/jovyan/work/data/CMIP6/ScenarioMIP/CNRM-CERFACS/CNRM-CM6-1-HR/ssp585/r1i1p1f2/CSU/gr/v20191202/CSU_day_CNRM-CM6-1-HR_ssp585_r1i1p1f2_gr_20650101-21001231.nc
Processing CSU and creating /home/jovyan/work/data/CMIP6/ScenarioMIP/CNRM-CERFACS/CNRM-CM6-1-HR/ssp585/r1i1p1f2/CSU/gr/v20191202/CSU_day_CNRM-CM6-1-HR_ssp585_r1i1p1f2_gr_20650101-21001231.nc

Output received

2022-10-13 12:23:43,995 Calculating climate index: CSU
/opt/conda/lib/python3.9/site-packages/dask/array/reductions.py:608: RuntimeWarning: All-NaN slice encountered
return np.nanmax(x_chunk, axis=axis, keepdims=keepdims)
Killed

@bzah
Copy link
Member

bzah commented Oct 14, 2022

I don't think the warning is related to the process being killed.
The "all nan sliced encoutered" is displayed by numpy when np.nanmax (or other nan-related functions) is computed over an array made of only nans.
See:

>>> np.nanmax(np.asanyarray([np.nan]))
<ipython-input-173-445f05e52077>:1: RuntimeWarning: All-NaN slice encountered
  np.nanmax(np.asanyarray([np.nan]))
Out[173]: nan

I haven't played too much with dask recently, but I guess it's memory related.
You may try to feed dask fewer workers and/or fewer threads per worker or give a larger memory pool. Careful though, on a LocalCluster/Client the pool is per worker, so make sure you have n_worker * mem_pool memory available.

Also, I don't know on which machine you run that but if it's one from Cerfacs it could also be due to the file creation issue that Laurent talked about earlier. Dask can create quite a few files especially when the memory is limited.

@pagecp
Copy link
Collaborator Author

pagecp commented Oct 14, 2022

Yes, it may be memory leak for long running scripts. It runs on CMCC cluster. I will investigate and we can close the Issue for now, I guess, until I have more info.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants