Lightweight Parallelism library based on Ada 2022 features

A full implementation of the parallel features of Ada 2022 is yet to be released. In the meantime, here is a light-weight-threading library that provides essentially all of the parallel features of Ada 2022, using various generics, etc. Scheduling is provided using a plug-in architecture. If no scheduler is plugged in, the light-weight threads are simply executed sequentially. If a light-weight-thread scheduler is plugged in, then the light-weight threads spawned by instances of the various generic packages are managed by that scheduler.

There are currently two LWT scheduler plug-ins:

  • a wrapper for the GNU implementation of OpenMP (lwt-openmp.ads)
  • a work-stealing based plug-in, written entirely in Ada (lwt-work_stealing.ads)

Below is a link to the “readme.md” documentation for the GitHub lwt library. It is currently part of the ParaSail GitHub repository, but the files in “lwt” are actually independent of ParaSail. ParaSail has its own work-stealing-based scheduler built-in, but at some point we plan to shift over to using the “lwt” library. But at the moment, there is no dependence either way between the ParaSail interpreter/compiler and the lwt library.

Feel free to open GitHub Issues if you find problems with the implementation, or have suggestions for improvements.

Enjoy!

-Tucker Taft

The ParaSail GitHub repository was created by my colleague Olivier Henley, and he has also helped to improve the documentation and testing scripts. Much appreciated!

9 Likes

Hi, this is great to know. is the plan also for GNAT to use this to implement Ada2022 parallel constructs?

1 Like

That is to be determined. There is some interest in doing this work directly on the FSF sources, without waiting for AdaCore.

6 Likes

Maybe such work could be proposed for the Google Summer of Code 2024? Cf. thread on this forum: https://forum.ada-lang.io/t/urgent-participation-in-google-summer-of-code-2024/

2 Likes