Lazy object copy as a platform for population-based probabilistic programming

01/09/2020
by   Lawrence M. Murray, et al.
0

This work considers dynamic memory management for population-based probabilistic programs, such as those using particle methods for inference. Such programs exhibit a pattern of allocating, copying, potentially mutating, and deallocating collections of similar objects through successive generations. These objects may assemble data structures such as stacks, queues, lists, ragged arrays, and trees, which may be of random, and possibly unbounded, size. For the simple case of N particles, T generations, D objects, and resampling at each generation, dense representation requires O(DNT) memory, while sparse representation requires only O(DT+DNlog DN) memory, based on existing theoretical results. This work describes an object copy-on-write platform to automate this saving for the programmer. The core idea is formalized using labeled directed multigraphs, where vertices represent objects, edges the pointers between them, and labels the necessary bookkeeping. A specific labeling scheme is proposed for high performance under the motivating pattern. The platform is implemented for the Birch probabilistic programming language, using smart pointers, hash tables, and reference-counting garbage collection. It is tested empirically on a number of realistic probabilistic programs, and shown to significantly reduce memory use and execution time in a manner consistent with theoretical expectations. This enables copy-on-write for the imperative programmer, lazy deep copies for the object-oriented programmer, and in-place write optimizations for the functional programmer.

READ FULL TEXT

page 13

page 14

research
09/05/2022

Detecting Unjustified Assumptions in Subclasses via Elegant Objects Representation

Elegant Objects (EO) is a programming language based on ideas of pure ob...
research
04/12/2018

Design and Implementation of Dynamic Memory Management in a Reversible Object-Oriented Programming Language

The reversible object-oriented programming language (ROOPL) was presente...
research
09/05/2022

Detecting unanticipated mutual recursion using Elegant Objects representation of object-oriented programs

Elegant Objects (EO) is a variation of the object-oriented programming p...
research
10/28/2018

DynaSOAr: A Parallel Memory Allocator for Object-oriented Programming on GPUs with Efficient Memory Access

Object-oriented programming has long been regarded as too inefficient fo...
research
06/17/2016

Taming Weak Memory Models

Speculative techniques in microarchitectures relax various dependencies ...
research
06/13/2023

Efficient Iterative Programs with Distributed Data Collections

Big data programming frameworks have become increasingly important for...
research
09/06/2023

Reference Capabilities for Flexible Memory Management: Extended Version

Verona is a concurrent object-oriented programming language that organis...

Please sign up or login with your details

Forgot password? Click here to reset