Set the default chunksize used by dask arrays.

If called without any arguments then the existing chunksize is returned.


Setting the chunk size will also change the dask global configuration value 'array.chunk-size'. If chunksize is used in a context manager then the dask configuration value is only altered within that context. Setting the chunk size directly from the dask configuration API will affect subsequent data creation, but will not change the value of chunksize.

arg: number or str or Constant, optional

The chunksize in bytes. Any size accepted by dask.utils.parse_bytes is accepted, for instance 100, '100', '1e6', '100 MB', '100M', '5kB', '5.4 kB', '1kiB', '1e6 kB', and 'MB' are all valid sizes.

Note that if arg is a float, or a string that implies a non-integral amount of bytes, then the integer part (rounded down) will be used.

Parameter example:

A chunksize of 2 MiB may be specified as '2097152' or '2 MiB'

Parameter example:

Chunksizes of '2678.9' and '2.6789 KB' are both equivalent to 2678.


The value prior to the change, or the current value if no new value was specified.