UPCommons. Portal del coneixement obert de la UPC
Publicación
Contribución de congreso (ConferenceOutput)
Enhancing OmpSs-2 suspendable tasks by combining operating system and user-level threads with C++ coroutines
This paper explores three methods for implementing suspendable tasks within task-based programming models: OS threads (pthreads), User-Level Threads (ULTs), and C++ coroutines. We enhance the OmpSs-2 programming model, originally supporting suspendable tasks via pthreads, to also accommodate ULTs and C++ coroutines. This unified approach facilitates a comprehensive comparative analysis using various benchmarks that includes recursive fork-join and data-flow parallelization strategies. Additionally, we contrast these suspension methods with the Cilk and OpenMP task-based programming models, which, despite their efficiency, lack support for suspendable tasks. Key contributions of this study include the novel integration of C++20 coroutines into the OmpSs-2 programming model, which can be combined with pthreads or ULTs. Furthermore, we introduce a new Linux kernel syscall that accelerates pthread context switches by an order of magnitude, thus narrowing the performance gap between ULTs and pthreads in context-switch times from two to one order of magnitude. C++ Coroutines are the ideal solution for scenarios where many tasks are simultaneously in a suspended state, or the frequency of task suspension and resumption is high because they have the smallest memory footprint and minor contextswitch overhead. However, they are limited to C++ programs, do not support TLS, and only allow task suspension at top-level functions. Still, pthreads and ULTs can bring remarkable benefits where C++ Coroutines cannot. We conclude that combining the strengths of coroutines with pthreads or ULTs brings productivity and performance benefits for programming models., This work was partially supported by the Generalitat de Catalunya (contract 2021-SGR-01007) and the Spanish Government through the Severo Ochoa Program (CEX2021-001148-S/MCIN/AEI/10.13039/501100011033). It is also part of the research project PID2023-147979NB-C21, funded by MICIU/AEI (10.13039/501100011033) and co-financed by the European Regional Development Fund (FEDER, EU). Additionally, this work was developed in the context of the European PILOT project, which has received funding from the European High-Performance Computing Joint Undertaking (JU) under grant agreement No. 101034126, with support from the European Union's Horizon 2020 research and innovation program and Spain, Italy, Switzerland, Germany, France, Greece, Sweden, Croatia, and Turkey. This paper is also co-financed by the Barcelona Zettaescale Laboratory (reference REGAGE22e00058408992), promoted by the Ministry for Digital Transformation and the Civil Service, within the framework of the Recovery, Transformation and Resilience Plan - Funded by the European Union - NextGenerationEU., Peer Reviewed