简体   繁体   中英

Sorting networks costs and delay

From what I read I could not figure out how the cost and delay are calculated.

  • Cost: the number of sticks or compare-exchange blocks.
  • Delay: the number of compare-exchanges in sequence.

I have posted my example bellow 例

From what I can see, your answer is correct.

Cost is the total number compare exchanges done in the sorting network. I believe here it's 28.

Delay is the number of stages that must be done in sequence, ie have data dependencies. In the example there is a delay of 13.

Why do we care about the difference? Cost represents the amount of work we have to do in a serial implementation however the benefit of using a sorting network is that many of the compare-exchanges can be done in parallel. When you have as much parallelism available as there are compare-exchanges in a single stage, you can calculate that stage concurrently.

In a perfectly parallel system, the latency of the algorithm is going to be related to the delay rather than the cost. In a completely serial system, the latency is going to be related to the cost rather than the delay.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM