GPU621/CamelCaseTeam

From CDOT Wiki
Revision as of 03:15, 22 July 2021 by Htruong (talk | contribs)
Jump to: navigation, search


GPU621/DPS921 | Participants | Groups and Projects | Resources | Glossary

Project Name

C++11 Threads Library Comparison to OpenMP

Group Members

Andrei Fedchenko Hung Truong Ren Ren

Overview

Our team will do a research on comparison between c++ 11 threads library and openmp. We will code problems with both libraries to demonstrate the coding differences and do the performance analysis on those two approaches. We will highlight the techniques and best practices to achieve the best performance and avoid the pitfalls.

C++ Threading

C++ threading consists of the creation of a thread that works on a function. By having multiple threads, multiple functions are able to be performed at the same time which enables parallel processing.

template<class Function, class... args>

explicit thread( Function&& f, Args&&... args);

As seen above, a single thread takes a function through overloading and performs the task by passing the arguments to the function parameter which would execute separate to other threads. Once these threads are finished performing their function, the child thread must be joined using the .join() function in the thread library to the parent thread.

OpenMP Threading

OpenMP threads consists of a parallel region that forks a master thread into multiple child threads that each performs a function in parallel amongst each other and joins back to its parent thread after reaching the end of the parallel region.

#pragma omp construct [clause, ...]

structured block

The construct identifies what block of code is being executed in parallel and the clause qualifies the parallel construct. In comparison to the C++ 11 thread library, the threads are performed in a region while the C++ 11 thread library have to be specifically created and joined back to the parent thread.