Skip to content

Commit c442f86

Browse files
authored
Add intro blog for STL Concurrency primitives GSoC 2025 project (#295)
1 parent 8504fdf commit c442f86

File tree

6 files changed

+85
-0
lines changed

6 files changed

+85
-0
lines changed

.github/actions/spelling/allow/terms.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ gitlab
3333
gridlay
3434
gsoc
3535
gpu
36+
jthread
3637
llm
3738
llvm
3839
pushforward

_data/contributors.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -275,6 +275,30 @@
275275
potentially establishing a new standard for high-performance genomic data analysis.
276276
proposal: /assets/docs/Aditya_Pandey_GSoC2025.pdf
277277
mentors: Martin Vassilev, Jonas Rembser, Fons Rademakers, Vassil Vassilev
278+
279+
- name: Petro Mozil
280+
photo: PetroMozil.jpeg
281+
info: "Google Summer of Code 2025 Contributor"
282+
283+
education: "Bachelor of Computer Science, Ukrainian Catholic University, Ukraine"
284+
github: "https://github.com/pmozil"
285+
active: 1
286+
linkedin: "https://www.linkedin.com/in/petro-mozil-a94583170/"
287+
projects:
288+
- title: "Enabling support for STL concurrency primitives in CLAD"
289+
status: Ongoing
290+
description: |
291+
Clad recursively iterates over the syntax tree to check whether a given
292+
statement should be differentiated. Each function that is called from
293+
inside of a differentiated function should be differentiated as well,
294+
and so should any object method. The main issue for clad is that std::thread is an object,
295+
and thus as a type that should be differentiated However, std::thread shouldn’t
296+
be differentiated, the function inside of it should.
297+
Some of STL’s concurrency primitives face the same problem -
298+
the methods in them should not be differentiated,
299+
and only the location of where they were called should be preserved.
300+
proposal: /assets/docs/petro_mozil_promosal_GSoC_2025.pdf
301+
mentors: Martin Vassilev, David Lange
278302

279303
- name: Salvador de la Torre Gonzalez
280304
info: "Google Summer of Code 2025 Contributor"

_pages/team/petro-mozil.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
---
2+
title: "Compiler Research - Team - Petro Mozil"
3+
layout: gridlay
4+
excerpt: "Compiler Research: Team members"
5+
sitemap: false
6+
permalink: /team/PetroMozil
7+
8+
---
9+
10+
{% include team-profile.html %}
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
---
2+
title: "Supporting STL Concurrency Primitives in CLAD"
3+
layout: post
4+
excerpt: "Support for STL concurrency features in CLAD is a useful feature for applications utilizing cpu threads. Many applications of autodifferentiation benefit from parallel or concurrent processing, and support for some STL concurrency primitives such as threads and basic synchronization primitives may considerably simplify the user's design."
5+
sitemap: false
6+
author: Petro Mozil
7+
permalink: blogs/gsoc25_/
8+
banner_image: /images/blog/gsoc-banner.png
9+
date: 2025-05-18
10+
tags: gsoc llvm clang auto-differentiation
11+
---
12+
13+
## About me
14+
15+
I am Petro Mozil, a student participating in the Google Summer of Code program in 2025.
16+
I will work on adding support of STL concurrency primitives to CLAD.
17+
18+
## Problem description
19+
20+
`Clad` is a plugin for automatic differentiation for the `clang` compiler.
21+
Automatic differentiation is a term for multiple techniques of deriving a mathematical function analytically. Some of the ways of doing this include simply calculating the derivative numerically or by deriving a function by a set of rules, symbolically.
22+
23+
`Clad` provides an interface that returns an object that contained the derivative of a given function. There might be problems with some functions, if they are to be derived. For example, one would not derive `printf`, and neither would they derive `std::tread` - those are exceptions, and should be handled differently from mathematical functions.
24+
25+
The main goals of this project are to implement support for automatically derive functions that contain `std::thread` so that the user wouldn't have to separate the multi-processing logic from the mathematical functions - such a feature would be a great time-saver for production of multi-processing code.
26+
27+
## Objectives
28+
29+
The objectives for this project include adding support for multiple objects in STL, such as `std::thread`, `std::atomic`, `std::mutex`.
30+
31+
The first, and, likely, most important part of the project is to add support for `std::thread` - this will include deriving not the `std::thread` constructor, but deriving the function supplied for the thread.
32+
33+
Support for mutexes is a bit more straightforward - though `clad` creates a second object to represent the derived value, it shouldn't do so for a mutex. It is a matter of having a custom derivative for `std::mutex`.
34+
35+
Atomics will likely involve more effort - they would require custom derivatives for `compare_exchange` functions as well as their methods.
36+
37+
If time allows, I would also like to add support for `std::condition_variable`, `std::lock_guard`, `std::unique_lock` and `std::jthread`, and most of those would also only involve a custom derivative.
38+
39+
40+
## Conclusion
41+
42+
A a result of this project, support for the concurrency primitives is expected. Clad should seamlessly derive functions with concurrency primitives in them.
43+
Though this project does not focus on features immediately required from `clad`, it should result in making easier the lives of those, who use clad for high-perf computing.
44+
45+
## Related links
46+
47+
- [LLVM Repository](https://github.com/llvm/llvm-project)
48+
- [CLAD repository](https://github.com/vgvassilev/clad)
49+
- [Project description](https://hepsoftwarefoundation.org/gsoc/2025/proposal_Clad-STLConcurrency.html)
50+
- [My github](https://github.com/pmozil)
171 KB
Binary file not shown.

images/team/PetroMozil.jpg

107 KB
Loading

0 commit comments

Comments
 (0)