Hi,
I have been reading through the Examples and Tests in order to find out more about Pointer SNodes. From what I understand this type of node also maintains memory sparsity, where memory is only allocated when a specific section of the domain is needed/ assigned a value. Do I understand this correctly?
For example, similar to the tests
x = ti.var(dt=ti.f32)
ti.root.pointer(ti.i, 16).dense(ti.i, 16).place(x)
x[0] = 1
This would allocate memory for the first pointer to the first 16 entries of x correct? In the tests you verify this by checking ti.is_active
for individual elements.
What I’m not clear on however, is how you use the ti.is_active
in the examples/taichi_sparse.py
example. Specifically
These blocks have sizes
but are accessed using indices i = [0,n)
. What am I missing here? How can you check if the blocks are active using these indices? I thought that maybe the calls propagate to the children of that block/ node (not sure what to call it), but that would be ambiguous as soon as you have multiple children.
Any help or explanation on this would be much appreciated, since I also did not easily find an answer by looking through the source.