本文介绍了如何曼德尔布罗的每个象素计算分成不同节点?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在这里的问题是,什么样的数据结构,我应该使用的工作分发到每个线程,并从他们那里得到的计算值。在我的脑海里的第一件事就是填写矢量[0] ...矢量[63999](用于为800x800像素)与结构保存x,y和iterate_value。通过这些载体,每个节点 - >然后给定的载体进一步划分到每个核心(OS线程) - >然后给定的载体进一步划分给每个线程。是否有发送和接收的值的任何其他可能的方式?而且,如果我在向量的方式做到这一点,我应该用合格合格矢量通过值或引用传递,其中之一将是在这种情况下更好?

My question here is what data structure should I use to distribute the work to each threads and get the calculated value from them. First thing in my mind is fill vector[0] .. vector[63999] (for 800x800 pixel) with struct that holds x,y and iterate_value. Pass those vector to each node -> then further divide the given vector to each core(Os-thread) -> then further divide the given vector to each thread. Is there any other possible way to send and received the values? and also if I do it in vector way should I pass the vector by pass by value or pass by reference, which one would be better in this case ?

推荐答案

Mandelbrot集的不同点需要不同的时间来计算(靠近边缘点更贵),因此给每个工人偶数的像素会有一些人完成的比别人快。

Different points of the mandelbrot set take varying amounts of time to compute (points near the edge are more expensive), so giving each worker an even number of pixels will have some of them finishing faster than others.

突破影像分为小的矩形(砖)。创建使用多线程队列中的工作表,并用瓷砖填充它。每个工作线程循环,挑选瓷砖扫尾工作清单并提交结果,直到工作列表是空的。

Break the image into small rectangles (tiles). Create a work list using a multithreaded queue, and fill it with the tiles. Each worker thread loops, picking a tile off the work list and submitting the results, until the work list is empty.

这篇关于如何曼德尔布罗的每个象素计算分成不同节点?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-27 20:26