Gforth并行处理

发布于 2024-10-09 07:27:22 字数 373 浏览 4 评论 0原文

我已经编写了一个 Forth Mandelbrot 分形绘图仪,与其他技术练习一样,我想尝试通过一些并行处理来加速它。

目前,如果我可以只使用两个核心(让一个核心处理图像的一半,另一个核心处理另一半),我会很高兴。

我注意到 Windows XP 会非常乐意管理 Gforth 的两个实例,并尝试使用尽可能多的处理器容量尽可能,因此运行两个进程可能是一个开始。但是我不确定它们是否可以共享内存,或者它们是否可以同时写入文件(或者如何告诉一个进程从文件开头开始写入 x 字节)。

总而言之,如何在 Windows XP 上使用 Gforth 进行并行处理?

I have written a Forth Mandelbrot fractal plotter, and as much as a technical exercise as anything else I would like to try to speed it up with some parallel processing.

For the time being I would be happy if I could just use both of my cores (have one core do one half of the image and the other the other half).

I have noticed that Windows XP will quite happily manage two instances of Gforth and try use as much processor capacity as possible, so running two processes could be a start. However I am not sure if they can share memory, or if they can both write to a file at the same time (or how to tell one process to start writing at x bytes from the start of the file).

In summary, how can I do parallel processing using Gforth on Windows XP?

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

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

发布评论

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

评论(2

胡大本事 2024-10-16 07:27:22

您可以让每个程序执行像素网格而不是单个像素,然后最后重新组合它们。

AFAIK,Mandelbrot 集中的像素是彼此独立的(如果我错了,有人纠正我),但是每个像素的计算都是不确定的,这使得在没有某种中央调度线程的情况下正确并行化成为一个难题(然后你会再次遇到潜在的争用问题)。

You could have each program do a grid of pixels rather than a single pixel, and then recombine them in the end.

AFAIK, pixels in Mandelbrot sets are independent of each other (someone correct me if I am wrong), however the computation of each of them is non-deterministic, making it a hard problem to properly parallelize, without having some kind of central dispatch thread (then again you run into potential problems with contention).

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