Skip to Main content Skip to Navigation
Journal articles

Sundials/ML: Connecting OCaml to the Sundials Numeric Solvers

Abstract : This paper describes the design and implementation of a comprehensive OCaml interface to the Sundials library of numeric solvers for ordinary differential equations, differential algebraic equations, and non-linear equations. The interface provides a convenient and memory-safe alternative to using Sundials directly from C and facilitates application development by integrating with higher-level language features, like garbage-collected memory management, algebraic data types, and exceptions. Our benchmark results suggest that the interface overhead is acceptable: the standard examples are rarely twice as slow in OCaml than in C, and often less than 50% slower. The challenges in interfacing with Sundials are to efficiently and safely share data structures between OCaml and C, to support multiple implementations of vector operations and linear solvers through a common interface, and to manage calls and error signalling to and from OCaml. We explain how we overcame these difficulties using a combination of standard techniques such as phantom types and polymorphic variants, and carefully crafted data representations.
Complete list of metadata

https://hal.inria.fr/hal-01967659
Contributor : Timothy Bourke <>
Submitted on : Tuesday, January 1, 2019 - 10:56:06 AM
Last modification on : Thursday, July 1, 2021 - 5:58:09 PM

Licence


Distributed under a Creative Commons Attribution 4.0 International License

Links full text

Identifiers

Collections

Citation

Timothy Bourke, Jun Inoue, Marc Pouzet. Sundials/ML: Connecting OCaml to the Sundials Numeric Solvers. Electronic Proceedings in Theoretical Computer Science, EPTCS, 2018, ML Family Workshop / OCaml Users and Developers workshops (MLOCAML 2016), 285, pp.101-130. ⟨10.4204/EPTCS.285.4⟩. ⟨hal-01967659⟩

Share

Metrics

Record views

128