我已经使用 openMP 在 C++ 中实现了一个凸壳算法。
代码可以在这里找到:http ://codepad.org/VVQdSdfM
Below are the results when tested in my Mac Book Pro:
Processor Name: Intel Core i5
Processor Speed: 2.5 GHz
Number of Processors: 1
Total Number of Cores: 2
L2 Cache (per Core): 256 KB
L3 Cache: 3 MB
Memory: 4 GB
处理器运行代码所需的时间:
With two Threads:
(here size represents the number of points in the input and time in Seconds)
Average Sequential Time Elapsed in seconds for size:10=8.29697e-06
Average Parallel Time Elapsed in seconds for size:10=5.0807e-05
Average Sequential Time Elapsed in seconds for size:100=5.18084e-05
Average Parallel Time Elapsed in seconds for size:100=8.13007e-05
Average Sequential Time Elapsed in seconds for size:1000=0.000471377
Average Parallel Time Elapsed in seconds for size:1000=0.000283003
Average Sequential Time Elapsed in seconds for size:10000=0.00483506
Average Parallel Time Elapsed in seconds for size:10000=0.0032198
Average Sequential Time Elapsed in seconds for size:100000=0.0471328
Average Parallel Time Elapsed in seconds for size:100000=0.0333489
Average Sequential Time Elapsed in seconds for size:1000000=0.460131
Average Parallel Time Elapsed in seconds for size:1000000=0.267305
With four threads:
Average Sequential Time Elapsed in seconds for size:10=1.00136e-05
Average Parallel Time Elapsed in seconds for size:10=0.000106597
Average Sequential Time Elapsed in seconds for size:100=5.91993e-05
Average Parallel Time Elapsed in seconds for size:100=0.000114727
Average Sequential Time Elapsed in seconds for size:1000=0.000503755
Average Parallel Time Elapsed in seconds for size:1000=0.000302839
Average Sequential Time Elapsed in seconds for size:10000=0.00478158
Average Parallel Time Elapsed in seconds for size:10000=0.00235724
Average Sequential Time Elapsed in seconds for size:100000=0.0465738
Average Parallel Time Elapsed in seconds for size:100000=0.0223478
Average Sequential Time Elapsed in seconds for size:1000000=0.466074
Average Parallel Time Elapsed in seconds for size:1000000=0.221905
我在我的 CPU 活动监视器中找到了四个插槽,并且我知道这个版本的英特尔处理器支持超线程。
如果是这种情况,我不应该在使用 4 个线程时获得 4 个加速吗?
请提供任何可以帮助我使用英特尔处理器中的超线程功能的指示。
谢谢,维杰