Abstract

This article describes the process of converting the program from single-threaded to multithreaded mode. The influence of the number of threads of execution on the total execution time of the code. The problem of spending much time to run programs solved by incremental parallelization when the code is designed for sequential execution, are added to the parallelizing directives. Are similar libraries for working with threads in other programming languages and the advantages of OpenMP over other libraries. Considered a model of parallelizing OpenMP directives, which is time-consuming to run the snippet in multi-threaded mode. The article also presents example code implemented using the C++ language, which built the parallelizing directives of OpenMP. In this model, the estimated execution time of a code snippet of a program with different number of threads. The study showed that with increasing the number of threads the run time is significantly reduced on the average in 1,5–2 times. This happens until the moment when the number of threads will be equal to the number of processor cores. If the number of threads becomes greater than the number of processor cores, the execution time of the program remains virtually unchanged. Are the OpenMP library allows to significantly shorten the program, which can be critical for works of real-time systems, to reduce the time of creating multithreaded applications is simple inserts directives of the library, to reduce the number of errors made by the programmer in the course of working with multi-threaded applications.

Highlights

  • This article describes the process of converting the program from single-threaded to multithreaded mode

  • The problem of spending much time to run programs solved by incremental parallelization when the code is designed for sequential execution

  • timeconsuming to run the snippet in multi-threaded mode

Read more

Summary

Недяк Антон Витальевич

Проблема затрат большого количества времени на выполнения программ решается с помощью инкрементального распараллеливания, когда в код, который предназначен для последовательного исполнения, добавляются распараллеливающие директивы. Представленная библиотека OpenMP позволяет значительно сократить время работы программы, которое может быть критичным для работ систем реального времени, сократить время создания многопоточных приложений простыми вставками директив библиотеки, уменьшить количество ошибок, допускаемых программистом в ходе работы с многопоточными приложениями. Применяемые на практике методы распараллеливания кода в различных языках программирования предоставляют такой эффект, как уменьшение времени работы программы, но являются достаточно трудозатратными для программиста. Библиотека OpenMP является достаточно простым и легковесным инструментом, по сравнению с другими библиотеками, для распараллеливания вычислений и уменьшения времени исполнения программы, которая снимает нагрузку с программиста. Ее функционал достаточно прост в освоении благодаря директивам распараллеливания, которые встраиваются в код программы без фрагмента кода, который требует исполнения в многопоточном режиме, что уменьшает время на разработку проекта [5]

Модель работы с потоками в библиотеке OpenMP
Постановка задачи
No опыта Количество элементов
Количество элементов массива поток потока потока потоков потоков потоков
No опыта
Время выполнения кода
Full Text
Paper version not known

Talk to us

Join us for a 30 min session where you can share your feedback and ask us any queries you have

Schedule a call

Disclaimer: All third-party content on this website/platform is and will remain the property of their respective owners and is provided on "as is" basis without any warranties, express or implied. Use of third-party content does not indicate any affiliation, sponsorship with or endorsement by them. Any references to third-party content is to identify the corresponding services and shall be considered fair use under The CopyrightLaw.