Yesterday is the 7th week meeting with Mr.yamaguchi. I demonstrated what I’ve learned these days and he soleved lots of my questions.
昨天是第七次和山口老师交流,我首先报告了一下我学习了一些什么东西,然后他解答了很多我提出的问题。
Now the outline of programming seems more clear. What I need to do is programming on the PPE, and let the PPE controls the SPEs to work. Each SPE is the same as to the PPE, and the waiting mechanism is the main point I will work on in the PPE. Other things such as how to transfer data, and how to store are nothing with my business.
每次会议过后,思路都会更加清晰。我需要做的,主要是在PPE上面的编程,让PPE成为一个控制SPE的控制器,来调度运行。每个SPE对于PPE来说,都是相同的,这里我们就会产生一个数据等待的技术问题。关于怎样去传输数据,是不是有缓存,这个不是我们主要讨论的东西。
First, each SPE should develop some kinds of ordering listener to do what PPE ask them to do. And at the same time, PPE, as a controller will need serveral working session to decide what SPE should do depends on the detail information on it.
首先,每一个SPE需要执行一个自我运行的命令等待线程,来执行PPE安排的事务。同时,PPE,作为控制单元,自身会有很多工作流程,来告诉SPE需要做什么,存储SPE的一些详细的信息参数。
Second, the PPE hold each SPE’s detail information should include: name, tagid, thread, argp, tagidneed, status. Under the control of PPE, SPE will be assigned different work and after finishing working, send the result back. As feed back, the PPE will use the result which SPE sent back to activate other SPE.
然后,PPE应该保持有每个SPE的详细信息包括:名称,标签ID,线程信息,参数信息,需求信息,状态信息等。在PPE的控制下,SPE会被安排不同的事务,并且在每个事务运行完之后,将结果送回PPE。这时PPE就可以通过SPE送回的结果,唤醒其他SPE线程,开始工作。
Then, PPE will hold a storage space for data, and result cache. For each work pieces. It will create a SPE data block. Calculate and verify the dependency, and assign an SPE to work. If the data SPE need is not done yet, the SPE thread will sleep until all the data result finish sent from other SPE to the PPE.
PPE应该还有一些空间,作为结果的缓存,这样可以加速SPE的调度运行。对每个工作块,他都会划分一个SPE数据块,计算和验证相互依赖信息,然后指派SPE的工作。如果SPE需求的信息不能够满足,那么他将休眠,直到数据结果从其他已经完成的SPE那里传来。
Now we simulate what we discuss with PPE and SPE program.
所以,我们先做出如下的计算模拟:
我们假设有4个数据块需要被运算,分别为data_block0 ~ data_block3
他们的运算结果分别为:data_block0_result ~ data_block3_result
他们的运算依赖分别是:data_block0_init, data_block0_result, data_block0_result, data_block0&1&2_result
我们开始编程模拟这个的调度实现:
1.PPE创建了4个SPE线程,因为现在没有SPE在工作,有空闲SPE;
2.给出init信息,验证依赖信息,只有data_block0满足,所以运行spe0,其他3个进行等待。
3.spe0运行完毕送回结果data_block0_result,PPE更新依赖信息,激活spe1,spe2;同时缓存spe0结果。
4.同理,当1,2结果送回时,更新依赖信息,缓存spe1,spe2结果,此时spe3被激活。