OpenMP versus threading in C/C++

B. Kuhn, Paul Petersen, E. O'Toole
{"title":"OpenMP versus threading in C/C++","authors":"B. Kuhn, Paul Petersen, E. O'Toole","doi":"10.1002/1096-9128(200010)12:12%3C1165::AID-CPE529%3E3.0.CO;2-L","DOIUrl":null,"url":null,"abstract":"When comparing OpenMP to other parallel programming models, it is easier to choose between OpenMP and MPI than between OpenMP and POSIX Threads (Pthreads). With languages like C and C++, developers have frequently chosen Pthreads to incorporate parallelism in applications. Few developers are currently using OpenMP C/C++, but they should. We show that converting Genehunter, a hand-threaded C program, to OpenMP increases robustness without sacrificing performance. It is also a good case study as it highlights several issues that are important in understanding how OpenMP uses threads. \n \nGenehunter is a genetics program which analyzes DNA assays from members of a family tree where a disease is present in certain members and not in others. This analysis is done in an attempt to identify the gene most likely to cause the disease. This problem is called linkage analysis. The same sections of Genehunter were parallelized first by hand-threading and then with OpenMP on Compaq Alpha Tru64 systems. We present examples using both methods and illustrate the tools that proved useful in the process. Our basic conclusion is that, although we could express the parallelism using either Pthreads or OpenMP, it was easier to express the parallelism at a higher level of abstraction. OpenMP allowed enough control to express the parallelism without exposing the implementation details. Also, due to the higher level specification of parallelism with OpenMP, the tools available to assist in the construction of correct and efficient programs provide more useful information than the equivalent tools available for hand-threaded programs. \n \nThe following concepts are presented: \n \n \ndifferences between coding styles for OpenMP and Pthreads; \n \n \ndata scoping specification for correct parallel programming; \n \n \nadapting a signal based exception mechanism to a parallel program; \n \n \nOpenMP tools: Debuggers—Ladebug, TotalView and Assure; Profilers—Hiprof and GuideView; \n \n \nperformance tuning with memory allocation, synchronization, and scheduling. \n \n \n \nGenehunter does not cover a few important topics in C/C++ programming style, which will be discussed separately. These are: \n \n \ninterfacing a GUI team of threads with an OpenMP compute team; \n \n \ncoordinating data structure with scheduling. \n \n \n \nCopyright © 2000 John Wiley & Sons, Ltd.","PeriodicalId":199059,"journal":{"name":"Concurr. Pract. Exp.","volume":"63 1","pages":"0"},"PeriodicalIF":0.0000,"publicationDate":"2000-10-01","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":"41","resultStr":null,"platform":"Semanticscholar","paperid":null,"PeriodicalName":"Concurr. Pract. Exp.","FirstCategoryId":"1085","ListUrlMain":"https://doi.org/10.1002/1096-9128(200010)12:12%3C1165::AID-CPE529%3E3.0.CO;2-L","RegionNum":0,"RegionCategory":null,"ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":null,"EPubDate":"","PubModel":"","JCR":"","JCRName":"","Score":null,"Total":0}
引用次数: 41

Abstract

When comparing OpenMP to other parallel programming models, it is easier to choose between OpenMP and MPI than between OpenMP and POSIX Threads (Pthreads). With languages like C and C++, developers have frequently chosen Pthreads to incorporate parallelism in applications. Few developers are currently using OpenMP C/C++, but they should. We show that converting Genehunter, a hand-threaded C program, to OpenMP increases robustness without sacrificing performance. It is also a good case study as it highlights several issues that are important in understanding how OpenMP uses threads. Genehunter is a genetics program which analyzes DNA assays from members of a family tree where a disease is present in certain members and not in others. This analysis is done in an attempt to identify the gene most likely to cause the disease. This problem is called linkage analysis. The same sections of Genehunter were parallelized first by hand-threading and then with OpenMP on Compaq Alpha Tru64 systems. We present examples using both methods and illustrate the tools that proved useful in the process. Our basic conclusion is that, although we could express the parallelism using either Pthreads or OpenMP, it was easier to express the parallelism at a higher level of abstraction. OpenMP allowed enough control to express the parallelism without exposing the implementation details. Also, due to the higher level specification of parallelism with OpenMP, the tools available to assist in the construction of correct and efficient programs provide more useful information than the equivalent tools available for hand-threaded programs. The following concepts are presented: differences between coding styles for OpenMP and Pthreads; data scoping specification for correct parallel programming; adapting a signal based exception mechanism to a parallel program; OpenMP tools: Debuggers—Ladebug, TotalView and Assure; Profilers—Hiprof and GuideView; performance tuning with memory allocation, synchronization, and scheduling. Genehunter does not cover a few important topics in C/C++ programming style, which will be discussed separately. These are: interfacing a GUI team of threads with an OpenMP compute team; coordinating data structure with scheduling. Copyright © 2000 John Wiley & Sons, Ltd.
OpenMP与C/ c++中的线程
当将OpenMP与其他并行编程模型进行比较时,在OpenMP和MPI之间进行选择比在OpenMP和POSIX线程(Pthreads)之间进行选择更容易。对于像C和c++这样的语言,开发人员经常选择pthread在应用程序中加入并行性。目前很少有开发人员使用OpenMP C/ c++,但他们应该这样做。我们展示了将Genehunter(一个手工线程的C程序)转换为OpenMP可以在不牺牲性能的情况下提高健壮性。这也是一个很好的案例研究,因为它突出了几个对于理解OpenMP如何使用线程很重要的问题。Genehunter是一个遗传学程序,它分析来自家谱成员的DNA分析,其中某些成员存在疾病,而其他成员没有。这项分析是为了找出最可能导致这种疾病的基因。这个问题叫做连锁分析。Genehunter的相同部分首先通过手工线程并行化,然后在康柏Alpha Tru64系统上使用OpenMP并行化。我们将提供使用这两种方法的示例,并说明在此过程中证明有用的工具。我们的基本结论是,尽管我们可以使用Pthreads或OpenMP来表达并行性,但在更高的抽象级别上表达并行性更容易。OpenMP允许足够的控制来表达并行性,而不暴露实现细节。此外,由于OpenMP对并行性的更高级别规范,可用于帮助构建正确且高效的程序的工具比可用于手动线程程序的等效工具提供了更多有用的信息。提出了以下概念:OpenMP和Pthreads编码风格的差异;正确并行编程的数据范围规范;基于信号的异常机制在并行程序中的应用OpenMP工具:调试器- ladebug, TotalView和Assure;剖面仪- hiprof和GuideView;使用内存分配、同步和调度进行性能调优。Genehunter没有涵盖C/ c++编程风格中的几个重要主题,这些主题将单独讨论。它们是:将GUI线程团队与OpenMP计算团队连接起来;协调数据结构与调度。版权所有©2000约翰威利父子有限公司
本文章由计算机程序翻译,如有差异,请以英文原文为准。
求助全文
约1分钟内获得全文 求助全文
来源期刊
自引率
0.00%
发文量
0
×
引用
GB/T 7714-2015
复制
MLA
复制
APA
复制
导出至
BibTeX EndNote RefMan NoteFirst NoteExpress
×
提示
您的信息不完整,为了账户安全,请先补充。
现在去补充
×
提示
您因"违规操作"
具体请查看互助需知
我知道了
×
提示
确定
请完成安全验证×
copy
已复制链接
快去分享给好友吧!
我知道了
右上角分享
点击右上角分享
0
联系我们:info@booksci.cn Book学术提供免费学术资源搜索服务,方便国内外学者检索中英文文献。致力于提供最便捷和优质的服务体验。 Copyright © 2023 布克学术 All rights reserved.
京ICP备2023020795号-1
ghs 京公网安备 11010802042870号
Book学术文献互助
Book学术文献互助群
群 号:604180095
Book学术官方微信