Hello Here is the latest OCaml Weekly News, for the week of July 16 to 23, 2024. Table of Contents ───────────────── A Tour of the Living Library – A Safer FFI first release of rpmfile Dune dev meeting Fighting Mutation with Mutation in Living A small extension of Bigarray.Genarray adding iteration, mapping and folding cudajit: Bindings to the `cuda' and `nvrtc' libraries Rpmfile 0.2.0 - changelog Exploring the Docusaurus+Odoc combo Mopsa 1.0 – Modular Open Platform for Static Analysis OCaml 5 performance Other OCaml News Old CWN A Tour of the Living Library – A Safer FFI ══════════════════════════════════════════ Archive: Matt Walker announced ───────────────────── I've written a new blog post on the `living' library I announced a few days ago. Please give it a read if you're interested in safe use of Ctypes, or otherwise need lifetime management in OCaml. Would love to hear your views in this thread! first release of rpmfile ════════════════════════ Archive: Mikhail announced ───────────────── I'm happy to announce the first release of [rpmfile], a small library for reading meta information from RPM packages (version 3.0). It uses the Angstrom combinator parser library, which allows it to perform streaming parsing using Lwt or Async. How to get a package summary: ┌──── │ module Rpm_reader = Rpmfile.Reader (Rpmfile.Selector.All) │ │ let metadata = Rpm_reader.of_file_exn "hello-2.12.1-1.7.x86_64.rpm" │ │ Rpmfile.summary metadata │ (* - : string = "A Friendly Greeting Program" *) └──── The default reader module can read from a string or file, but has poor performance. It needs a selector module to select the tags to parse. The example uses `Selector.All' to parse all tags. I am developing this library for my pet project to create a self-hosted RPM repository management solution. Thank you for your attention! [rpmfile] Dune dev meeting ════════════════ Archive: maiste announced ──────────────── We are organizing a new public Dune dev meeting on *Wednesday, July, 24th at 10am CET*. It will be one hour long. Whether you are a maintainer, a regular contributor, a new joiner or just curious, feel free to join! The goal of these meetings is to provide a place to discuss the ongoing work together :smile: Below, you can find the agenda for this meeting: :scroll: Agenda ╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌ • Quick presentation about the attendees. • Presentation about the ongoing work in Dune. • Questions and Answers. • Information discussions :chains: Links ╌╌╌╌╌╌╌╌╌╌╌╌╌╌ • Meeting link: [zoom] • Calendar event: [google calendar] • Wiki with information and previous notes: [GitHub Wiki] [zoom] [google calendar] [GitHub Wiki] Fighting Mutation with Mutation in Living ═════════════════════════════════════════ Archive: Matt Walker announced ───────────────────── New blog post about fixing the mistakes in the `living' library. Please take a look if you're interested in interfacing ocaml with external resources. In particular, I think the library comes good with its guarantees now that 1. if every function is properly dependent, and 2. you only `unsafe_free' values that are disjoint from their dependencies, then you will obtain a sound program when using the Ctypes ffi, in terms of there being no use-after-free errors. Please let me know if you disagree! A small extension of Bigarray.Genarray adding iteration, mapping and folding ════════════════════════════════════════════════════════════════════════════ Archive: NAlec announced ─────────────── I needed a few functions which were missing in the [OCaml library : Bigarray.Genarray], and decided to write them for my own purpose : • Iteration on genarrays • mapping on genarrays • folding on genarrays Today I believe this can be usefull for others, and may suffer a code inspection as I am not that experienced in OCaml. I am ready to have this piece of code evolve if it is usefull so even (and maybe first) a feedback on the usefullness of such code is welcome. The only alternative I was given was the famous Owl library, which was way to heavy for my needs, and not easily usable (if not understandable). This extension is very simple, it is its strenght. Ultimately, it could be merged in the standard library … maybe after some work indeed : you tell me. There is a clean documentation I guess, hope this can help : [GenArrayIter] Looking forward to hearing from you all. [OCaml library : Bigarray.Genarray] [GenArrayIter] cudajit: Bindings to the `cuda' and `nvrtc' libraries ═════════════════════════════════════════════════════ Archive: Lukasz Stafiniak announced ────────────────────────── Hi! I'm happy to share cudajit 0.4.0: manually-selected bindings for Nvidia GPU programming. cudajit should soon propagate to the opam repository. [Bindings to the `cuda' and `nvrtc' libraries with a unified interface] [API documentation] Currently supported: • Compiling a kernel with conversion to PTX, launching a kernel. • Synchronous and asynchronous memory copying. • Contexts and streams. • (GPU) device attributes. Currently not supported: • Events. • CUDA graph features. • Cooperative kernel launch. Let me know your needs so I can prioritize. PRs are also welcome! [Bindings to the `cuda' and `nvrtc' libraries with a unified interface] [API documentation] Rpmfile 0.2.0 - changelog ═════════════════════════ Archive: Mikhail announced ───────────────── Hello again, everyone. :wave: Today I want to tell you about what has changed in a new version of my [rpmfile] library ([previous topic]) for reading meta-information from RPM packages.Should I post this in the forum? I'm sorry. [rpmfile] [previous topic] Changes ╌╌╌╌╌╌╌ • Fixed incorrect string parsing. I just forgot to make `advance' after `take_till' ([commit]); • `angstrom-unix' is used by default to read files in the `Reader' module functions. Previously, a RPM package was read entirely into memory; • Optimized partial parsing of [header sections]. Reduced unnecessary memory allocations ([commit]); • Decoding integers (int8/int16/int32/int64) to *native int* in access functions[^1] (like `Rpmfile.payload_size'). You can also use `get' to get "raw" values; • Improved compatibility with 4.0 version of RPM format by using *native int*; • Added a module `Selector.Base' to select only basic package info ([commit]); • Some new access functions and output fields of the CLI utility. [commit] [header sections] [commit] [commit] rpmfile vs rpm -qi ╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌ Not a real "benchmark" for parsing 1.5 GB packages. ┌──── │ $ time rpm -qi repo/*.rpm │ Executed in 226.82 millis fish external │ usr time 212.74 millis 1.06 millis 211.68 millis │ sys time 13.23 millis 0.00 millis 13.23 millis │ │ $ time rpmfile repo/*.rpm │ Executed in 153.97 millis fish external │ usr time 116.74 millis 0.00 millis 116.74 millis │ sys time 30.65 millis 1.47 millis 29.18 millis └──── Rpmfile doesn't verify signatures, which is why it is "faster". What's next? ╌╌╌╌╌╌╌╌╌╌╌╌ This is enough for my tasks, so there probably won't be a next release :cold_face: To-Do: functionality to work with signatures, read payload, implement writer module for create packages. Thank you for your attention! P.S. I also want to apologize for my terrible English. [^1]: The access function gets and decodes values from a `metadata' record. Exploring the Docusaurus+Odoc combo ═══════════════════════════════════ Archive: Mathieu Barbin announced ──────────────────────── To OCaml & Docusaurus enthusiasts out there :camel:+ :sauropod: Some time ago, I shared my experience using Docusaurus to document an OCaml project, highlighting the integration between Docusaurus, ocaml-mdx, and the dune workflow (previous post [here]). Today I wanted to share that I've resumed this exploration in documentation tools to try and integrate odoc-generated pages into Docusaurus, with the aim of creating a somewhat minimal template/example for this. I've published my experiment here: [https://mbarbin.github.io/doc-experiment-docusaurus/]. Integrating odoc posed challenges - I've written about the (pragmatic) approach I took [here]. I'm linking this [odoc issue] too, for reference about exploring more native solutions for this interop. Have you too tried this "magic combo" of Docusaurus, Odoc, and OCaml tools? And if so, how did you approach it? Do you have insights or suggestions? If this sparks your curiosity, please don't hesitate to engage with the repository. [here] [https://mbarbin.github.io/doc-experiment-docusaurus/] [here] [odoc issue] Mopsa 1.0 – Modular Open Platform for Static Analysis ═════════════════════════════════════════════════════ Archive: Raphaël Monat announced ─────────────────────── On behalf of all its developers, I am glad to announce the release of [Mopsa 1.0]! You can just `opam install mopsa'. Mopsa stands for Modular and Open Platform for Static Analysis. It aims at easing the development and use of static analyzers. More specifically, Mopsa is a generic framework for building sound static analyzer based on the theory of abstract interpretation. Mopsa is independent of language and abstraction choices. Developers are free to add arbitrary abstractions (numeric, pointer, memory, etc.) and syntax iterators for new languages. Mopsa encourages the development of independent abstractions which can cooperate or be combined to improve precision. Mopsa currently support the analysis of Python, C and Python+C programs. It reports run-time errors on C programs and uncaught exceptions on Python programs. Our benchmarks provide an illustrative overview of what Mopsa can currently analyze. All analyses currently provided are flow and context-sensitive (i.e, control-flow operators are taken into account by the analysis, and functions are analyzed by virtual inlining). The C analysis is actively developed and maintained. The Python and Python+C analyses work on real-world examples, but are not actively developed. Please note that Mopsa is an academic tool under development. Feel free to submit [issues] if you encounter any bug! Additional resources: • [user manual] • [demo of our abstract debugger] • [academic overview of Mopsa], and [in a PhD thesis] • [coreutils benchmarks on which Mopsa can run] [Mopsa 1.0] [issues] [user manual] [demo of our abstract debugger] [academic overview of Mopsa] [in a PhD thesis] [coreutils benchmarks on which Mopsa can run] OCaml 5 performance ═══════════════════ Archive: Thomas Leonard announced ──────────────────────── I've been trying out some tools to investigate performance problems in my OCaml programs and I've written up my experiences here in case other people find it useful: • The first post examines a case of slow IO in a concurrent Eio program, and the second looks at poor GC performance in a multicore app. In particular, it seems that minor GC performance is very sensitive to other work running on the machine, since any domain being late will trigger the others to sleep, e.g. I'd be interested to know if others can shed more light on this, or have other profiling tools they've found useful. Other OCaml News ════════════════ From the ocaml.org blog ─────────────────────── Here are links from many OCaml blogs aggregated at [the ocaml.org blog]. • [OCaml 5 performance part 2] • [OCaml 5 performance problems] • [OCaml Compiler Manual HTML Generation] [the ocaml.org blog] [OCaml 5 performance part 2] [OCaml 5 performance problems] [OCaml Compiler Manual HTML Generation] 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 to the [caml-list]. [Alan Schmitt] [send me a message] [the archive] [RSS feed of the archives] [caml-list] [Alan Schmitt]