Parallel Constructors#

[1]:
import iarray as ia
import numpy as np
import seaborn as sns

%load_ext memprofiler

sns.set_theme()
[2]:
shape = (20 * 1024, 20 * 1024)
size = np.prod(shape)

chunks = (4 * 1024, 4 * 1024)
blocks = (256, 256)

ia.reset_config_defaults()
[2]:
Config(codec=<Codec.LZ4: 1>, clevel=9, favor=<Favor.BALANCE: 0>, filters=[<Filter.SHUFFLE: 1>], fp_mantissa_bits=0, use_dict=False, nthreads=32, eval_method=<Eval.AUTO: 1>, seed=2, random_gen=<RandomGen.MRG32K3A: 0>, btune=True, dtype=<class 'numpy.float64'>, split_mode=<SplitMode.AUTO_SPLIT: 3>, chunks=None, blocks=None, urlpath=None, mode='w-', contiguous=None)

Basic constructors#

Integers#

[3]:
%%mprof_run ia::arange_i32

b_arange_i32 = ia.arange(shape, 0, 1, chunks=chunks, blocks=blocks, dtype=np.int32)
memprofiler: used -1.61 MiB RAM (peak of 9.29 MiB) in 0.3377 s, total RAM usage 267.11 MiB
[4]:
%%mprof_run ia::arange_i64

b_arange_i64 = ia.arange(shape, 0, 1, chunks=chunks, blocks=blocks, dtype=np.int64)
memprofiler: used 0.11 MiB RAM (peak of 25.02 MiB) in 0.3575 s, total RAM usage 267.31 MiB
[5]:
%%mprof_run np::arange_i32

a_arange_i32 = np.arange(0, size, 1, dtype=np.int32).reshape(shape)
memprofiler: used 1600.01 MiB RAM (peak of 1600.01 MiB) in 0.2211 s, total RAM usage 1867.53 MiB
[6]:
%%mprof_run np::arange_i64

a_arange_i64 = np.arange(0, size, 1, dtype=np.int64).reshape(shape)
memprofiler: used 3200.01 MiB RAM (peak of 3200.01 MiB) in 0.4146 s, total RAM usage 5067.54 MiB
[7]:
%mprof_plot .*arange_i --groupby 1