Gforth并行处理
我已经编写了一个 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以让每个程序执行像素网格而不是单个像素,然后最后重新组合它们。
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).
请参阅 GForth 管道。
See GForth Pipes.