Main Page
Related Pages
Modules
Namespaces
Classes
Files
Examples
File List
File Members
•
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Modules
Pages
canvas
canvas
test
tbb
tbb_pfor_01_t.cc
Go to the documentation of this file.
1
////////////////////////////////////////////////////////////////////////
2
// tbb_pfor_01_t
3
//
4
// Demonstrate trivial use of blocked_range and parallel_for over a
5
// vector.
6
//
7
////////////////////////////////////////////////////////////////////////
8
#include "tbb/tbb.h"
9
10
#include <iostream>
11
12
int
13
main
()
14
{
15
size_t
const
n
= 500000;
16
std::vector<double> v(n, 27.64), vr;
17
vr.reserve(n);
18
typedef
tbb::blocked_range<typename std::vector<double>::const_iterator
>
br_t
;
19
tbb::parallel_for(
br_t
(v.cbegin(), v.cend()), [&vr](br_t
const
&
r
) ->
void
{
20
for
(
auto
i
: r) {
21
vr.emplace_back(
i
* 2.0);
22
}
23
});
24
std::cout << vr.back() << std::endl;
25
}
br_t
tbb::blocked_range< typename std::vector< double >::const_iterator > br_t
Definition:
tbb_preduce_01_t.cc:18
sensitivity_comps.i
int i
Definition:
sensitivity_comps.py:15
const_iterator
intermediate_table::const_iterator const_iterator
Definition:
intermediate_table.cc:25
main
int main()
Definition:
tbb_pfor_01_t.cc:13
test_gpu_visible.r
r
Definition:
test_gpu_visible.py:15
plotSensitivity.n
n
Definition:
plotSensitivity.py:109
Generated by
1.8.11