gpt4 book ai didi

multithreading - 在 Dart/Flutter 中使用 GPU 而非图形

转载 作者:行者123 更新时间:2023-12-03 02:51:05 25 4
gpt4 key购买 nike

是啊是好人,

如果我可以“使用”(“调用”,“线程”?),我就在徘徊

带有 Dart 和 Flutter 的 GPU。

documentation 状态

The GPU thread executes graphics code from the Flutter Engine. This thread takes the layer tree and displays it by talking to the GPU (graphic processing unit). You cannot directly access the GPU thread or its data, but if this thread is slow, it’s a result of something you’ve done in the Dart code. Skia, the graphics library, runs on this thread, which is sometimes called the rasterizer thread.[...] More information on profiling the GPU thread can be found at flutter.dev. (which doesn't add much)



但是如果我不想将它用于图形呢?

例如,假设我想使用 Monte carlo method
对于一些计算,

我可以打电话或向 GPU 发送一个线程吗?

感谢您的关注

最佳答案

“GPU 线程”是一个令人困惑的名称,因此我们将其重命名为“光栅线程”。这个线程实际上是运行在一个 CPU 核上,它的作用是将图形光栅化发送给 GPU。许多人认为线程在 GPU 本身上运行,但事实并非如此。于是,改名。
(我们最近对其进行了重命名。您最初的问题当时使用了正确的术语。)
不幸的是,您无法编译 Dart 代码以在 GPU 上运行(如 CUDA),例如,您可以这样做 with C++
一种选择是用 C++ 之类的东西编写您的 Monte Carlo 例程,然后使用 Dart 的 FFI 从 Dart 代码中调用该例程。这将同步运行,并尽可能快地运行 C++ 代码。

关于multithreading - 在 Dart/Flutter 中使用 GPU 而非图形,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55333539/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com