Title: ?????? ???????, Intel
1???????????? ???????? ?????? ??????????? ????? ?
?????? ? ?????? ???????????? ?????????? ???????
???????? ???? ? ???????????????????? ???????
- ?????? ???????, Intel
- ?????? ???????????, Intel
2?????????? ???????????
- ???????? ??????? ???????????? ?????????? ???????
- ?????????? ???????? ???????????? ??????????
??????? - ???????????? ???????? ??? ?????????????? ????
- ???????????? ???????? ??? ???????????????? ????
- ??????????
3??????????? ????????? ??????
- ??????????????? ?????????? ?????
- Min/max ????? ??????????????? ???????
- ??????????? ???????? ???????
- ??????? - ????????? ?????? ??????? ?? ????? ???
?????? ????????.
4???????? ??????????? ???????????? ???
- ????????????? ???????????? ??? ??????????
??????????????????? - ????????? ?????????
- ? ???????? ???????????? ??????????
- ??????? ??????????
- ??????????????? ???????
5????????? ??? ?????????????? ????
- ?????????????? ?? ???????
- ???????? ??????????? ?? ???????
- ???????? ?????? ?????? ?????????????? ???????????
6????????? ??? ?????????????? ????
- ??????????? ??????????????
- ??????? ????? ??????, ??? ???????? ??? ??
????????? - ??????? ??????????? ? ???????, ????? ???????
????? 0 - ???????? ? ??????? ????????? ??????????????
???????????
7????????? ??? ?????????????? ????
- ??????????? ??????????????
- ????? ??????? ???????? ??????????? ???????? ??
???? ?????????, ????? ??????? ????????? ? ??????.
8????????? ??? ?????????????? ????
- ??????????? ??????????????
9????????? ??? ?????????????? ????
10???????? ??? ?????????????????? ????
11???????? ??? ?????????????????? ????
12???????? ??? ?????????????????? ????
tbbparallel_do
tbbparallel_for
13??????????
14??????????
????? ????????? ????? ????????? ????? ???????? ????????? ????? ?????? ?? ????? ???? (???) ????? ?????? ?? 16 ????? (???) ?????????
3573 319 4 123.0 16.9 7.3
5228 390 3 144.0 26.0 5.5
5465 691 4 143.0 28.0 5.8
6756 138 3 203.0 23.0 8.9
19480 1528 3 333.4 43.0 7.8
15??????? ?? ????????!
16Backup
17??????????????? ?????????????????
- ????????
- ??????????????? ???????? ??????, ???? ??
??????-?????????? - ???????
- ???????? ?????, ??? ????????? ???????
- ???????????? ??????? ????????????????? ????????
??? ????????? ????? ?????
18TBB patterns and BKMs
- Basic TBB patterns
- parallel_do, parallel_for, concurent_hash_map,
concurrent_vector, mutex spin_lock and other - Composite parallel patterns
- Concurrent map-based cache load/access
- Concurrent map-based update-if-more
- Concurrent map and vector synchronous update
- Static object init and access
19Concurrent map-based cache load/access
define ConcurrentMapType tbbconcurrent_hash_map
lt..gt ConcurrentMapType cashConcurrentMap DataType
GetValue(KeyType key) ConcurrentMapTypeacc
essor ac if (cashConcurrentMap.insert(ac,key))
ltincremental cache data load etc.gt
ac-gtsecond data else data
ac-gtsecond return data
20Concurrent map and vector synchronous update
pattern
define ConcurrentMapType concurrent_hash_map
ltKeyType,DataType1gt tbbconcurrent_vector
ltDataType1gt vector1 tbbconcurrent_vector
ltDataTypeNgt vectorN ConcurrentMapType
indexConcurrentMap void Update (KeyType key,
DataType1 data1DataTypeN dataN)
ConcurrentMapTypeaccessor ac if
(indexConcurrentMap .insert(ac,key) )
vector2.push_back( DataType1() )
vectorN.push_back( DataTypeN() )
ac-gtsecond vector1.push_back(data1) -
vector1.begin() vector2-gtatac-gtsecond
data2 vectorN-gtatac-gtsecond
dataN else ltdata is already
loadedgt
21Cone BFS after incremental change
- ????? ?????? ????????? ?????, ?????? ??????
???????? ????????? ???????? ? ????? - ???? ??????????? ????? ???????????? ????? ??????
22Incremental BFS on a DAG
Start
Yes
Queue is empty?
Done
Source stages (with worsened events)
No
Extract random stage from the queue
Evaluate stage (ignore transparencies)
Enqueue source stages
Initialize fanin counters in the affected cone
Get next fanout stage S
TBBparallel_do
Is S entered by port with transp. arc to output?
Yes
No
Decrement fanin counter of S
Add to latches with updated inputs
Enqueue S if counter0
Last fanout stage?
No
TBBparallel_do
Yes
23Top algorithm Example
latch
input
output
latch
latch
24Top algorithm Example
Step 1 - BFS on DAG
latch
input
output
latch
latch
25Top algorithm Example
Step 2 - Latch propagation
latch
output
latch
input
latch
26Top algorithm Example
Step 5 - BFS on DAG. No events on latches were
updated.
latch
input
output
latch
latch
27Top algorithm Example
Step 3 - BFS on DAG
latch
input
output
latch
latch
28Top algorithm Example
Step 4 - Latch propagation. Loop detected!
latch
input
output
latch
latch
loop