taichi icon indicating copy to clipboard operation
taichi copied to clipboard

Serialize and deserialize sparse data structrure from/to buffer and file

Open xuhao1 opened this issue 1 year ago • 2 comments

Concisely describe the proposed feature I would like to serialize/deserialize sparse data structure with to a buffer or to file, this will benefit online transmission and data logging/replay

Describe the solution you'd like (if any)

#Serialize
B = B.pointer(ti.ijk, (K, K, K))
v = ti.field(ti.i32)
B.place(v)
#To buffer.
buf = ti.data_to_buffer(v)
#To file
ti.data_to_file(v)

#Deserialize
B, v = ti.from_buffer(buf) #B is the SNode, v is the value
B, v = ti.from_file(file)

Additional comments Personally, I think this feature is very important for using taichi for high-performance computation, which requires distributed computing and data logging. The reason the store/load sparse data is hope it can have compact structure to save the memory.

xuhao1 avatar Jul 14 '22 15:07 xuhao1

This seems to be a feature request to our AOT system. For now AOT only serializes the "NdarrayType" or "SNodeTreeType", and we should enable serialization for the underlying data buffers as well.

Updated LLVM AOT tasks to address this issue: https://github.com/taichi-dev/taichi/issues/4800

jim19930609 avatar Jul 29 '22 05:07 jim19930609

@jim19930609 Thanks! I will take a look.

xuhao1 avatar Aug 04 '22 10:08 xuhao1