Open main menu

CDOT Wiki β

Changes

GPU621/Distributed Workload

1,185 bytes added, 01:46, 3 December 2018
no edit summary
== Comparison ==
Both libraries use C++ templates to provide generic programming structures. The libraries do overlap when it comes to the functionality they provide, however STL is designed to be more general use and TBB specializes on parallel programming with threads. <br />
'''==== Iterators''': ==== Both libraries use random access iterators to ease navigation of containers. TBB follows the standard set by STL and the ISO C++ standard, but they also extend them so that <code>tbb::iteratorconcurrent_vector<T></code> can be used safely in concurrent parallel threads. <br />==== Containers ==== '''STL''' implements the following common containers* vector* list* queue* stack* map'''TBB''' does not implement as many containers however it does include some that are useful in parallel programming and extends their functionality.* concurrent_hash_map<T>* cuncurrent_vector<T>* concurrent_queue<T>==== Algorithms ====Some serial algorithms exist for STL that can preform tasks such like searching and sorting. These functions are typically used to operate on the containers like <code>std::merge()</code> and <code>std::sort()</code> <br />The algorithms in '''TBB''' are much more vital to the usefulness of the library. '''TBB''' uses templated functions like* parallel_for(range, body [, partitioner]);* parallel_scan(range, body [, partitioner]); * parallel_reduce(range, body [, partitioner]);These functions operate on the <code> blocked_range </code> container class in '''TBB''' to preform operations in parallel as described in the <code> body </code> object, typically by overloading the <code>() operator</code>. The following code snippet will demonstrate a simple <code>parallel_reduce</code> implementation.
24
edits