使用 OpenMP 在 ioquake3 这样的传统单线程游戏引擎上可以实现什么样的优化?
您能想出一些方法来对 id tech 3 这样的传统引擎进行重大改进吗?通过尝试在音频子系统上执行此操作,我注意到它会导致速度减慢而不是加速。我怀疑它需要循环计算大量数据,并且很少与核心通信。
Can you think of ways to achieve significant improvement on a traditional engine like id tech 3? By attempting to do it on the Audio Subsystem I noticed it inflicts a slow down rather than a speed up. I suspect it would need big chunks of data to be calculated in loops and only rarely communicate with the core.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我对 ioquake3 或 id tech 3 一无所知,但对 OpenMP 有一定了解,所以我会立即将问题发回给您。
OpenMP 最初的开发目的是将循环迭代分布在跨处理器的大型数组上,并可访问共享内存。这是大部分科学和工程程序的要求,因此 OpenMP 大量用于此类程序也就不足为奇了。
最近,随着 OpenMP 3.0 的出现,它具有良好的主管/工作人员任务分解功能,从而扩展了其应用范围。我对这些新功能没有太多经验,但它们看起来很有希望。
因此,您面临的问题是:您的计算核心与 OpenMP 支持的计算模型的契合程度如何?
I don't know anything about ioquake3 or id tech 3 but a fair bit about OpenMP so I'll fire the question right back to you.
OpenMP was, initially, developed to distribute loop iterations over large arrays across processors with access to shared memory. This is a requirement in a large fraction of scientific and engineering programs so it will be no surprise that OpenMP is much used for such programs.
More recently, with OpenMP 3.0, it has good facilities for director/worker task decomposition which extend its range of application. I don't have a lot of experience with these new features, but they look promising.
So the question for you is: how well does your computational core fit the model of computation that OpenMP supports ?
在处理不依赖于循环中其他元素的数据时,OpenMP 非常有效。例如:
使用 OpenMP 可以很好地优化,但
不会。
您还可以尝试一下 OpenMP 设置,看看它们是否可以改善您的结果。有关更多信息,http://www.amazon.com/Multi-Threaded-Engine- Design-Jonathan-Harbour/dp/1435454170 有整整一章介绍 OpenMP(以及 boost、posix-threads 和 Windows 线程)。
OpenMP is very effective when operating on data that doesn't depend on other elements in loop. For example:
would optimize well with OpenMP, but
would not.
You can also play around with the OpenMP settings to see if they improve your results. For more information, http://www.amazon.com/Multi-Threaded-Engine-Design-Jonathan-Harbour/dp/1435454170 has a whole chapter on OpenMP (as well as boost, posix-threads, and Windows Threads).