[cwn] Attn: Development Editor, Latest OCaml Weekly News
Alan Schmitt
alan.schmitt at polytechnique.org
Tue May 31 05:29:41 PDT 2022
Hello
Here is the latest OCaml Weekly News, for the week of May 24 to 31,
2022.
Table of Contents
─────────────────
carray.0.0.1
OCaml Users and Developers Workshop 2022
Old CWN
carray.0.0.1
════════════
Archive: <https://discuss.ocaml.org/t/ann-carray-0-0-1/9938/1>
Danny Willems announced
───────────────────────
I'm glad to announce the first (experimental) release of ocaml-carray,
a library mocking the Array interface to work with contiguous C array.
*Disclaimer*: this first version is experimental and must be used with
caution. A restricted set of values are supported at the moment
(custom block with no out-of-heap values). Depending on the demand,
more values might be supported. Feel free to use this thread to
suggest ideas, make opinions, etc.
Repository
<https://gitlab.com/dannywillems/ocaml-carray>
License
[MIT]
Release
[0.0.1]
Documentation
<https://dannywillems.gitlab.io/ocaml-carray/carray/index.html>
Nomadic Labs website
<https://nomadic-labs.com>
Tezos ZK-rollups repository
<https://gitlab.com/nomadic-labs/privacy-team>
[MIT]
<https://gitlab.com/dannywillems/ocaml-carray/-/blob/0.0.1/LICENSE>
[0.0.1] <https://gitlab.com/dannywillems/ocaml-carray/-/tags/0.0.1>
Motivation
╌╌╌╌╌╌╌╌╌╌
OCaml arrays are not always contiguous piece of memory, requiring
accessing different chunks of memory when accessing individual
elements. When requiring a value in memory, the CPU will fetch the RAM
and load not only the particular value but a memory page (a contiguous
piece of memory) and add it to its cache. The CPU will use its cache
to load the values in its registers. It is not efficient with large
OCaml arrays as the CPU will constantly fetch the RAM to load
different memory pages in its cache. Also, when using the C FFI, the
user must know the memory representation of an array and use the non
user-friendly low-level interface macro `Field'.
This work
╌╌╌╌╌╌╌╌╌
This library provides a polymorphic interface mocking a subset of the
`Array' interface to work with contiguous piece of memory. Using the
library should be as easy as adding `module Array = Carray'. A C
macro `Carray_val' is also provided for developers writing bindings
and requires to simply cast in the underlying C type. It has also
been observed sub arrays are sometimes used for read-only
operations. However, `Array.sub' allocates a fresh copy of the
requested sub part. `Carray' leverages this memory cost by providing
noalloc variants, like `sub_noalloc'.
Performances
╌╌╌╌╌╌╌╌╌╌╌╌
The concept has been tested and used in real world applications like
the polynomial library used by Nomadic Labs to implement zk-rollups. A
speed up of around 50% has been observed when using contiguous arrays
compared to OCaml arrays to compute NTT/FFT.
Usage
╌╌╌╌╌
This library is *experimental*. Use this library with caution. The
interface might change in the future.
┌────
│ opam install carray.0.0.1
└────
OCaml Users and Developers Workshop 2022
════════════════════════════════════════
Archive:
<https://discuss.ocaml.org/t/ocaml-users-and-developers-workshop-2022/9726/2>
Continuing this thread, Matija Pretnar announced
────────────────────────────────────────────────
This is a reminder for anyone interested in contributing to OCaml
Workshop 2022. The deadline has been slightly extended to Friday, June
3 (anywhere on Earth), which means you have roughly *four days left*
to prepare your submissions.
Old CWN
═══════
If you happen to miss a CWN, you can [send me a message] and I'll mail
it to you, or go take a look at [the archive] or the [RSS feed of the
archives].
If you also wish to receive it every week by mail, you may subscribe
[online].
[Alan Schmitt]
[send me a message] <mailto:alan.schmitt at polytechnique.org>
[the archive] <https://alan.petitepomme.net/cwn/>
[RSS feed of the archives] <https://alan.petitepomme.net/cwn/cwn.rss>
[online] <http://lists.idyll.org/listinfo/caml-news-weekly/>
[Alan Schmitt] <https://alan.petitepomme.net/>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.idyll.org/pipermail/caml-news-weekly/attachments/20220531/49fccf6a/attachment.html>
More information about the caml-news-weekly
mailing list