Parallel Constructors#

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

%load_ext memprofiler

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

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

Basic constructor#

linspace#

[3]:
%%mprof_run ia::linspace_f32

b_linspace_f32 = ia.linspace(shape, 0, 5, dtype=np.float32)
memprofiler: used 82.25 MiB RAM (peak of 88.48 MiB) in 0.4095 s, total RAM usage 353.31 MiB
[4]:
%%mprof_run ia::linspace_f64

b_lindpace_f64 = ia.linspace(shape, 0, 5, dtype=np.float64)
memprofiler: used 353.11 MiB RAM (peak of 357.95 MiB) in 0.4474 s, total RAM usage 706.51 MiB
[5]:
%%mprof_run np::linspace_f32

a_linspace_f32 = np.linspace(0, 5, size, dtype=np.float32).reshape(shape)
memprofiler: used 1525.89 MiB RAM (peak of 4526.38 MiB) in 1.1505 s, total RAM usage 2232.41 MiB
[6]:
%%mprof_run np::linspace_f64

a_linspace_f64 = np.linspace(0, 5, size, dtype=np.float64).reshape(shape)
memprofiler: used 3051.77 MiB RAM (peak of 3051.77 MiB) in 0.8715 s, total RAM usage 5284.38 MiB
[7]:
%mprof_plot .*linspace_f --groupby 1