We have shown how multi-threading is supported in deal.II and how it can be used in several examples occuring in common finite element programs. It was demonstrated that implementing a usable C++ interface poses several difficulties, both from the aspect of user friendliness as well as program correctness. In order to overcome these difficulties, first the more simple framework implemented in deal.II version 3.0 was discussed, followed by a rather complex scheme which will be the base of implementations in future versions.
The second framework features a more complicated hierarchy of classes as well as intricate use of templates and synchronization mechanisms, which however led to a design in which threads can be created in a user friendly, system independent, C++ like way suitable for common programs. The use of this framework is inherently safe and does not require special knowledge of the internals by the user, and is simple to use. By using it, the overhead required for programming multi-threaded applications is reduced to a minimum and the programmer can concentrate on the task of getting the semantics of multi-threaded programs right, in particular managing concurrent access to data and distributing work to different threads.
The framework has been used in several application programs and has shown that
with only marginally increased programming effort, finite element programs can
be made significantly faster on multi-processor machines.