TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

The Cache and Multithreading

36 点作者 jlemoine大约 11 年前

3 条评论

replicant大约 11 年前
The first 2 examples are not dividing the work between the threads, but having each of the threads repeat the full work, which is not poor OpenMP use, but wrong use. I would have also used the collapse directive and played a little bit with the schedule. Finally, looping in the inner loop through the first index is not a good idea not only when working with OpenMP.
deletes大约 11 年前
Comment on the blog that got deleted:<p>I did a similar test in C and have gotten very similar results. When N is around 4000 the trashing version starts to differ substantially. A 3x difference can already be seen when N is 1000.<p><i>This means if your program is running on two threads over different parts of the matrix, every single iteration requires a request to RAM.</i><p>I&#x27;m skeptical over this part, I have tried to replicate this behavior but was unsuccessful. Even though cores are sharing L3, I doubt that a thread will overwrite the entire cache on every iteration.
评论 #7496118 未加载
pron大约 11 年前
For all those interested in this subject, I&#x27;d like to recommend Nitsan Wakart&#x27;s blog, <a href="http://psy-lob-saw.blogspot.com/" rel="nofollow">http:&#x2F;&#x2F;psy-lob-saw.blogspot.com&#x2F;</a>, which is dedicated to mechanical sympathy relating to concurrency and the memory system.
评论 #7495922 未加载