SlideShare a Scribd company logo
OpenMP and C++ Sb î rlea Drago ș
Summary Why use C++ and OpenMP Why are there problems Objects in OpenMP clauses Parallelization of C++ loops STL Iterator loop problems STL Dataypes problems
Why use C++ and OpenMP? OpenMP = fast implementation for parallel programs C++ = fast and mentenable implementation for large programs Both are useful when TTM is important
Why are there problems? The OpenMP specification includes C++ Compiler implementations do offer consistent behaviour OpenMP standard too restrictive for C++ syntax parallelization
Objects in OpenMP clauses
Objects in OpenMP clauses Shared  =  All threads access the same storage   area for each shared object C all to  dummyfunc  expected
Objects in OpenMP clauses Private  =  Each thread should have its own instance of a variable. A new list item of the same type, with automatic storage duration, is allocated. Calls to constructor,  dummyfunc , destructor expected
Objects in OpenMP clauses Firstprivate  = Each thread should have its own instance of a variable, and the variable should be initialized with the value of the variable before the parallel construct. Copy constructor, dummyfunc, destructor calls expected
Objects in OpenMP clauses Lastprivate  = the enclosing context's version of the variable is set equal to the private version of whichever thread executes the final iteration (for-loop construct) or last section (#pragma sections). Assignment operator call expected
Parallelization of C++ loops OpenMP Requirement: “signed integer variable” as loop index Size_t  loop index stops parallelization STL iterators  stop parallelization
STL Iterator problem
STL Iterator problem
High Level code Parallelization Options: Internal parallelization Mixed parallelization
STL datatypes std:vallarray Guaranteed initialization with 0 All data in memory of one processor (ccNUMA disadvantage) Solutions: STL modification => compiler dependent Custom allocator (std:vector) Solaris page migration=>Solaris dependent
Reference OpenMP and C++ By Christian Terboven and Dieter an Mey
Questions? Thank You!

More Related Content

What's hot (20)

PPTX
MPI n OpenMP
Surinder Kaur
 
PPTX
Presentation on Shared Memory Parallel Programming
Vengada Karthik Rangaraju
 
PDF
Open mp library functions and environment variables
Suveeksha
 
PDF
Open mp directives
Prabhakaran V M
 
PDF
Open mp
Gopi Saiteja
 
ODP
OpenMp
Neel Bhad
 
PPTX
Openmp
Amirali Sharifian
 
PDF
Introduction to OpenMP
Akhila Prabhakaran
 
PDF
Introduction to OpenMP (Performance)
Akhila Prabhakaran
 
PPT
Programming using Open Mp
Anshul Sharma
 
PDF
Parallel Programming
Roman Okolovich
 
PPT
Parllelizaion
Vivek Kantariya
 
PDF
Numba: Flexible analytics written in Python with machine-code speeds and avo...
PyData
 
PDF
Towards an Integration of the Actor Model in an FRP Language for Small-Scale ...
Takuo Watanabe
 
PDF
Buzzwords Numba Presentation
kammeyer
 
PDF
Accelerate Your Python* Code through Profiling, Tuning, and Compilation Part ...
Intel® Software
 
PDF
Numba Overview
stan_seibert
 
PPT
Lecture8
tt_aljobory
 
PDF
A Language Support for Exhaustive Fault-Injection in Message-Passing System M...
Takuo Watanabe
 
PPT
Multicore
Birgit Plötzeneder
 
MPI n OpenMP
Surinder Kaur
 
Presentation on Shared Memory Parallel Programming
Vengada Karthik Rangaraju
 
Open mp library functions and environment variables
Suveeksha
 
Open mp directives
Prabhakaran V M
 
Open mp
Gopi Saiteja
 
OpenMp
Neel Bhad
 
Introduction to OpenMP
Akhila Prabhakaran
 
Introduction to OpenMP (Performance)
Akhila Prabhakaran
 
Programming using Open Mp
Anshul Sharma
 
Parallel Programming
Roman Okolovich
 
Parllelizaion
Vivek Kantariya
 
Numba: Flexible analytics written in Python with machine-code speeds and avo...
PyData
 
Towards an Integration of the Actor Model in an FRP Language for Small-Scale ...
Takuo Watanabe
 
Buzzwords Numba Presentation
kammeyer
 
Accelerate Your Python* Code through Profiling, Tuning, and Compilation Part ...
Intel® Software
 
Numba Overview
stan_seibert
 
Lecture8
tt_aljobory
 
A Language Support for Exhaustive Fault-Injection in Message-Passing System M...
Takuo Watanabe
 

Similar to OpenMP And C++ (20)

PPTX
Numerical Simulation of Nonlinear Mechanical Problems using Metafor
Romain Boman
 
PPTX
Threads and multi threading
Antonio Cesarano
 
PPT
OpenMP-Quinn17_L4bOpen <MP_Open MP_Open MP
Balasubramanian699229
 
PDF
Atlanta Spark User Meetup 09 22 2016
Chris Fregly
 
PPTX
Model-Based Co-Evolution of Production Systems and their Libraries with Auto...
Luca Berardinelli
 
PPTX
Heap and stack space in java
Talha Ocakçı
 
PPTX
Java 7 & 8 - A&BP CC
JWORKS powered by Ordina
 
PPT
Hs java open_party
Open Party
 
PDF
A Domain-Specific Embedded Language for Programming Parallel Architectures.
Jason Hearne-McGuiness
 
PDF
Porting a Streaming Pipeline from Scala to Rust
Evan Chan
 
PPT
Suyash Thesis Presentation
Tanvee Katyal
 
PPTX
Whats New in Visual Studio 2012 for C++ Developers
Rainer Stropek
 
PDF
Spark Summit EU talk by Mikhail Semeniuk Hollin Wilkins
Spark Summit
 
PPT
Os Reindersfinal
oscon2007
 
PPT
Os Reindersfinal
oscon2007
 
PDF
Charles Sharp: Java 8 Streams
jessitron
 
PPT
OPEN MP TO FOR knowing more in the front
bosdhoni7378
 
PDF
A Survey of Concurrency Constructs
Ted Leung
 
PPT
Inside LoLA - Experiences from building a state space tool for place transiti...
Universität Rostock
 
PPT
Parallelization of Coupled Cluster Code with OpenMP
Anil Bohare
 
Numerical Simulation of Nonlinear Mechanical Problems using Metafor
Romain Boman
 
Threads and multi threading
Antonio Cesarano
 
OpenMP-Quinn17_L4bOpen <MP_Open MP_Open MP
Balasubramanian699229
 
Atlanta Spark User Meetup 09 22 2016
Chris Fregly
 
Model-Based Co-Evolution of Production Systems and their Libraries with Auto...
Luca Berardinelli
 
Heap and stack space in java
Talha Ocakçı
 
Java 7 & 8 - A&BP CC
JWORKS powered by Ordina
 
Hs java open_party
Open Party
 
A Domain-Specific Embedded Language for Programming Parallel Architectures.
Jason Hearne-McGuiness
 
Porting a Streaming Pipeline from Scala to Rust
Evan Chan
 
Suyash Thesis Presentation
Tanvee Katyal
 
Whats New in Visual Studio 2012 for C++ Developers
Rainer Stropek
 
Spark Summit EU talk by Mikhail Semeniuk Hollin Wilkins
Spark Summit
 
Os Reindersfinal
oscon2007
 
Os Reindersfinal
oscon2007
 
Charles Sharp: Java 8 Streams
jessitron
 
OPEN MP TO FOR knowing more in the front
bosdhoni7378
 
A Survey of Concurrency Constructs
Ted Leung
 
Inside LoLA - Experiences from building a state space tool for place transiti...
Universität Rostock
 
Parallelization of Coupled Cluster Code with OpenMP
Anil Bohare
 
Ad

More from Dragos Sbîrlea (6)

PDF
SOA Architecture Example
Dragos Sbîrlea
 
PDF
INCITE - INtegrated Components for Interactive TEaching
Dragos Sbîrlea
 
PPT
Interfete4 Web
Dragos Sbîrlea
 
PPT
Interfete Web
Dragos Sbîrlea
 
SOA Architecture Example
Dragos Sbîrlea
 
INCITE - INtegrated Components for Interactive TEaching
Dragos Sbîrlea
 
Interfete4 Web
Dragos Sbîrlea
 
Interfete Web
Dragos Sbîrlea
 
Ad

Recently uploaded (20)

PDF
LOOPS in C Programming Language - Technology
RishabhDwivedi43
 
PDF
Book industry state of the nation 2025 - Tech Forum 2025
BookNet Canada
 
PDF
POV_ Why Enterprises Need to Find Value in ZERO.pdf
darshakparmar
 
PDF
UiPath DevConnect 2025: Agentic Automation Community User Group Meeting
DianaGray10
 
PDF
“NPU IP Hardware Shaped Through Software and Use-case Analysis,” a Presentati...
Edge AI and Vision Alliance
 
PPTX
Digital Circuits, important subject in CS
contactparinay1
 
PPTX
Agentforce World Tour Toronto '25 - MCP with MuleSoft
Alexandra N. Martinez
 
DOCX
Cryptography Quiz: test your knowledge of this important security concept.
Rajni Bhardwaj Grover
 
PDF
The 2025 InfraRed Report - Redpoint Ventures
Razin Mustafiz
 
PDF
Automating Feature Enrichment and Station Creation in Natural Gas Utility Net...
Safe Software
 
PDF
How do you fast track Agentic automation use cases discovery?
DianaGray10
 
PDF
AI Agents in the Cloud: The Rise of Agentic Cloud Architecture
Lilly Gracia
 
PPTX
Q2 FY26 Tableau User Group Leader Quarterly Call
lward7
 
PPTX
COMPARISON OF RASTER ANALYSIS TOOLS OF QGIS AND ARCGIS
Sharanya Sarkar
 
PDF
[Newgen] NewgenONE Marvin Brochure 1.pdf
darshakparmar
 
PDF
Transforming Utility Networks: Large-scale Data Migrations with FME
Safe Software
 
PDF
Newgen 2022-Forrester Newgen TEI_13 05 2022-The-Total-Economic-Impact-Newgen-...
darshakparmar
 
PPTX
From Sci-Fi to Reality: Exploring AI Evolution
Svetlana Meissner
 
PPTX
New ThousandEyes Product Innovations: Cisco Live June 2025
ThousandEyes
 
PDF
Staying Human in a Machine- Accelerated World
Catalin Jora
 
LOOPS in C Programming Language - Technology
RishabhDwivedi43
 
Book industry state of the nation 2025 - Tech Forum 2025
BookNet Canada
 
POV_ Why Enterprises Need to Find Value in ZERO.pdf
darshakparmar
 
UiPath DevConnect 2025: Agentic Automation Community User Group Meeting
DianaGray10
 
“NPU IP Hardware Shaped Through Software and Use-case Analysis,” a Presentati...
Edge AI and Vision Alliance
 
Digital Circuits, important subject in CS
contactparinay1
 
Agentforce World Tour Toronto '25 - MCP with MuleSoft
Alexandra N. Martinez
 
Cryptography Quiz: test your knowledge of this important security concept.
Rajni Bhardwaj Grover
 
The 2025 InfraRed Report - Redpoint Ventures
Razin Mustafiz
 
Automating Feature Enrichment and Station Creation in Natural Gas Utility Net...
Safe Software
 
How do you fast track Agentic automation use cases discovery?
DianaGray10
 
AI Agents in the Cloud: The Rise of Agentic Cloud Architecture
Lilly Gracia
 
Q2 FY26 Tableau User Group Leader Quarterly Call
lward7
 
COMPARISON OF RASTER ANALYSIS TOOLS OF QGIS AND ARCGIS
Sharanya Sarkar
 
[Newgen] NewgenONE Marvin Brochure 1.pdf
darshakparmar
 
Transforming Utility Networks: Large-scale Data Migrations with FME
Safe Software
 
Newgen 2022-Forrester Newgen TEI_13 05 2022-The-Total-Economic-Impact-Newgen-...
darshakparmar
 
From Sci-Fi to Reality: Exploring AI Evolution
Svetlana Meissner
 
New ThousandEyes Product Innovations: Cisco Live June 2025
ThousandEyes
 
Staying Human in a Machine- Accelerated World
Catalin Jora
 

OpenMP And C++

  • 1. OpenMP and C++ Sb î rlea Drago ș
  • 2. Summary Why use C++ and OpenMP Why are there problems Objects in OpenMP clauses Parallelization of C++ loops STL Iterator loop problems STL Dataypes problems
  • 3. Why use C++ and OpenMP? OpenMP = fast implementation for parallel programs C++ = fast and mentenable implementation for large programs Both are useful when TTM is important
  • 4. Why are there problems? The OpenMP specification includes C++ Compiler implementations do offer consistent behaviour OpenMP standard too restrictive for C++ syntax parallelization
  • 6. Objects in OpenMP clauses Shared = All threads access the same storage area for each shared object C all to dummyfunc expected
  • 7. Objects in OpenMP clauses Private = Each thread should have its own instance of a variable. A new list item of the same type, with automatic storage duration, is allocated. Calls to constructor, dummyfunc , destructor expected
  • 8. Objects in OpenMP clauses Firstprivate = Each thread should have its own instance of a variable, and the variable should be initialized with the value of the variable before the parallel construct. Copy constructor, dummyfunc, destructor calls expected
  • 9. Objects in OpenMP clauses Lastprivate = the enclosing context's version of the variable is set equal to the private version of whichever thread executes the final iteration (for-loop construct) or last section (#pragma sections). Assignment operator call expected
  • 10. Parallelization of C++ loops OpenMP Requirement: “signed integer variable” as loop index Size_t loop index stops parallelization STL iterators stop parallelization
  • 13. High Level code Parallelization Options: Internal parallelization Mixed parallelization
  • 14. STL datatypes std:vallarray Guaranteed initialization with 0 All data in memory of one processor (ccNUMA disadvantage) Solutions: STL modification => compiler dependent Custom allocator (std:vector) Solaris page migration=>Solaris dependent
  • 15. Reference OpenMP and C++ By Christian Terboven and Dieter an Mey