This repository contains no code but rather describe my finding about writing parallel problems in C
Among other stuff I do then I am developer at Mosek. One of my tasks is to parallelize C code e.g. a sparse Cholesky computation. Now parallelizing C using native threads such as pthread is major pain and therefore it is better to use an API or framework that makes it easy.
My current favourite is Cilk which provides a very simplex extension to C language. The example
cilk_spawn f(); cilk_spawn g(); cilk sync;
will make the functions f and g run in parallel. Very simple and very powerful. I have relied on Cilk as implemented in Intel C to run my code. Unforfortuantely Intel has deprecated support Cilk code.
So Cilk seems dead but it seems a Cilk inspired parallel feature has just been introduced in Julia. For details see the Julia blog. Also the original inventors of Cilk is still working on it. See Cilk at MIT.
Due to the deprecation of Cilk then I am looking for an alternative that can used in C. Below
- CheckedThreads Source with a liberal license. Cilk like. Both C and C++.
- C thread pool Source with a liberal license.
- OpenMP Supported by many compilers.
- PARTR Runtime engine written in C. It is employed in Julia for their Cilk inspired parallelization.
- Pfunc. Cilk like features. Liberal license. Can be called from C but is C++. Seems very powerful and there is ph.d. thesis about its design. The project might be semi-dead though.
- Threaded building blocks. C++ only.
- Cpp task flow. C++ only.
- enkiTS
For the parallelization theta I am doing it seems using a task flow model is beneficial because it is very flexible and provides a sufficiently fine grained tasks to make sure a good load balancing is obtained. At the CPP taskflow website mentioned above there is a good description of the task flow model.
Some common terminology when working on parallism is