8 logical threads at 4 cores will at a maximum run 4 times faster in parallel?

前端 未结 5 555
悲哀的现实
悲哀的现实 2021-02-04 08:28

I\'m benchmarking software which executes 4x faster on Intel 2670QM then my serial version using all 8 of my \'logical\' threads. I would like some community feedback on my

5条回答
  •  清歌不尽
    2021-02-04 09:14

    Some actual numbers:

    CPU-intensive task on my i7, (adding numbers from 1-1000000000 into an int var, 16 times), averaged over 8 tests:

    Summary, threads/ticks:

    1/26414
    4/8923
    8/6659
    12/6592
    16/6719
    64/6811
    128/6778
    

    Note that in the 'using X threads' line in the reports below, X is one greater than the number of threads available to do the tasks - one thread submits the tasks and waits on a countdown-latch evnet for their completion - it processes none of the CPU-heavy tasks and used no CPU.

    8 tests,
    16 tasks,
    counting to 1000000000,
    using 2 threads:
    Ticks: 26286
    Ticks: 26380
    Ticks: 26317
    Ticks: 26474
    Ticks: 26442
    Ticks: 26426
    Ticks: 26474
    Ticks: 26520
    Average: 26414 ms
    
    8 tests,
    16 tasks,
    counting to 1000000000,
    using 5 threads:
    Ticks: 8799
    Ticks: 9157
    Ticks: 8829
    Ticks: 9002
    Ticks: 9173
    Ticks: 8720
    Ticks: 8830
    Ticks: 8876
    Average: 8923 ms
    
    8 tests,
    16 tasks,
    counting to 1000000000,
    using 9 threads:
    Ticks: 6615
    Ticks: 6583
    Ticks: 6630
    Ticks: 6599
    Ticks: 6521
    Ticks: 6895
    Ticks: 6848
    Ticks: 6583
    Average: 6659 ms
    
    8 tests,
    16 tasks,
    counting to 1000000000,
    using 13 threads:
    Ticks: 6661
    Ticks: 6599
    Ticks: 6552
    Ticks: 6630
    Ticks: 6583
    Ticks: 6583
    Ticks: 6568
    Ticks: 6567
    Average: 6592 ms
    
    8 tests,
    16 tasks,
    counting to 1000000000,
    using 17 threads:
    Ticks: 6739
    Ticks: 6864
    Ticks: 6599
    Ticks: 6693
    Ticks: 6676
    Ticks: 6864
    Ticks: 6646
    Ticks: 6677
    Average: 6719 ms
    
    8 tests,
    16 tasks,
    counting to 1000000000,
    using 65 threads:
    Ticks: 7223
    Ticks: 6552
    Ticks: 6879
    Ticks: 6677
    Ticks: 6833
    Ticks: 6786
    Ticks: 6739
    Ticks: 6802
    Average: 6811 ms
    
    8 tests,
    16 tasks,
    counting to 1000000000,
    using 129 threads:
    Ticks: 6771
    Ticks: 6677
    Ticks: 6755
    Ticks: 6692
    Ticks: 6864
    Ticks: 6817
    Ticks: 6849
    Ticks: 6801
    Average: 6778 ms
    

提交回复
热议问题