通用物理引擎

发布于 2024-08-23 13:31:37 字数 119 浏览 14 评论 0原文

是否有任何通用物理引擎可以对刚体进行大量模拟?我使用的是 Nvidia 的 PhysX,但该引擎的重点是游戏开发、软体。我想知道是否存在运行在 PS3 单元处理器或 CUDA 核心之上的物理引擎,允许进行大规模科学物理模拟。

Is there any general purpose physics engine that allows huge simulations of rigid bodies? I'm using PhysX from Nvidia, but the focus of this engine is game development, soft bodies. I want to know if exists physics engine that runs on top of PS3 cell processors or CUDA cores allowing massive scientific physics simulations.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

怀里藏娇 2024-08-30 13:31:37

不存在“通用”物理库。例如,您能想象一种将相对论效应考虑在内的有用的手术软组织模拟吗?你还可以想象更多的例子。

你谈到了科学模拟和刚体模拟,所以不清楚你想要有多现实。刚体是一种近似值:没有什么是绝对刚性的。但是,如果你的模拟中没有发生太大的变形,并且你可以接受一堆不切实际的摩擦和快速运动近似(所有视频游戏都很常见),并且你想要开箱即用的解决方案,我怀疑在现代CPU将为您提供最佳性能。

PS/3 目前是最后一代。虽然我当时很喜欢为它编写物理学,但我必须承认,具有 6 核的现代 i7 为您提供了比一个 Cell 更高的性能(无论是理论上还是在实践中)。

CUDA 目前是未经证实的物理技术。我没有从中写任何东西,但我对读者非常感兴趣:)如果你想接近现代 CPU 的 IPC(每周期指令比率),那么编写基于 CUDA 的物理的挑战是非常重要的,而且我不知道有谁成功地做到了这一点。如果你不接近基于 CPU 物理的 IPC,那么 CUDA 物理就没有意义,因为它需要更多的努力。

算一下:500 美元的 Kepler GPU 有 1536 个核心 @1GHz = 1.5 petaflops。售价 590 美元的 Sandy Bridge CPU 有 6 个核心/12 个超线程 AVX(8 宽)@3.8GHz = 0.36 petaflop。现在,如果您能够实现 5 比 1 奇偶校验(平均使用 5 个 GPU 周期对应 1 个 CPU 周期),您的理论 CUDA 物理将以与 CPU 物理相同的速度运行。现在,有效地使用 12 个超线程和 AVX(8 宽 SIMD)并不是一件容易的事。但是,跨 1536 个(!)CUDA 线程并行化物理任务也不是一件容易的事,这些线程必须非常一致,并且以更加受控的方式使用内存。我并不是说这是不可能的(我很想尝试一下,但我有一份日常工作和其他宠物项目:)),但物理社区需要一些时间才能提出可跨数千个线程扩展的东西。

最终速度提升只是 5 倍左右...:)

无论如何,如果您自己编写 sim,并且您不想要一般的刚体模拟,那么 CUDA 可能是您的朋友。例如,如果您想模拟银河系中所有恒星的运动,具有相对论,但没有超新星和其他离散效应...很清楚如何将其传播到 1536 个(以及更多)线程。但如果你想要一座刚体山,以与目前游戏相同的方式进行模拟,那么你就不走运了

There is no "universal" physics library. E.g. can you imagine a useful surgery soft tissue simulation that would take relativistic effects into account? You could imagine dozens more examples.

You talk about both scientific and rigid body simulation, so it's not clear how realistic you wanna be. Rigid body is an approximation: nothing is absolutely rigid. But if nothing deforms very much in your simulation, and you're fine with a bunch of unrealistic approximations to friction and fast motion (common to all videogames), and you want out-of-the-box solution, I suspect running Havok on modern CPU will give you the best performance.

PS/3 is currently last gen. While I enjoyed writing physics for it in my day a lot, I must admit that a modern i7 with 6 cores gives you more performance - both theoretically and in practice - than one Cell.

CUDA is currently unproven tech for physics. I didn't write anything from it, but I'm very interested reader :) The challenges of writing CUDA-based physics are quite non-trivial if you want to approach IPC (instruction per cycle ratio) of a modern CPU, and I don't know of anyone successfully accompishing that. And if you don't approach the IPC of CPU-based physics, there's no point in CUDA physics, as it takes more effort.

Just do the math: a $500 Kepler GPU has 1536 cores @1GHz = 1.5 petaflops. A $590 Sandy Bridge CPU has 6 cores / 12 hyperthreads AVX (8-wide) @3.8GHz = 0.36 petaflop. Now, if you are able to achieve 5-to-1 parity (use 5 GPU cycles on average for 1 CPU cycle), your theoretical CUDA physics will run at the same speed as the CPU physics. Now, using 12 hyperthreads and AVX (8-wide SIMD) efficiently is not really easy. But parallelizing physics tasks across 1536 (!) CUDA threads, which must be very coherent and use memory in much more controlled way is no small feat either. I'm not saying it's impossible (and I'd love to try it, but I have a day job and other pet projects:)) but it'll take some time before physics community comes up with something scalable across thousands of threads.

And in the end the speed improvement is just 5-fold or so...:)

Anyway, if you write the sim yourself, and you don't want a general rigid body simulation, then CUDA may be your friend. E.g. If you want to simulate the motion of all the stars in Milky Way, with relativism, but without supernova and other discrete effects... It's quite clear how to spread that across 1536 (and more) threads. But if you want to have a mountain of rigid bodies, simulated the same way games do it currently, you're out of luck

别低头,皇冠会掉 2024-08-30 13:31:37

Simbody 多体动力学库用于包含数千个分子(刚体)的分子模拟。请参阅 Simbody 的 GitHub 存储库中的 GIF:http://github.com/simbody/simbody

该库还被生物力学界大量使用来模拟人体运动。在这种情况下,人类被建模为一个刚体系统。

如果您正在寻找科学图书馆,那么您应该看看 Simbody。然而,它尚未在 PS3 单元处理器或 CUDA 核心上使用。

The Simbody multibody dynamics library is used for molecular simulations that contain thousands of molecules (rigid bodies). See the GIF at Simbody's GitHub repository: http://github.com/simbody/simbody.

The library is also used heavily by the biomechanics community to simulate human motion. In such a case, the humans are modeled as a system of rigid bodies.

If you're looking for a library for science, then you should check out Simbody. However, it has not been used on PS3 cell processors or CUDA cores.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文