We show that the problem of constructing tree-structured descriptions of data layouts that are optimal with respect to space or other criteria from given sequences of displacements, can be solved in polynomial time. The problem is relevant for efficient compiler and library support for communication of noncontiguous data, where tree-structured descriptions with low-degree nodes and small index arrays are beneficial for the communication soft- and hardware. An important example is the Message-Passing Interface (MPI) which has a mechanism for describing arbitrary data layouts as trees using a set of increasingly general constructors. Our algorithm shows that the so-called MPI datatype reconstruction problem by trees with the full set of MPI constructors can be solved optimally in polynomial time, refuting previous conjectures that the problem is NP-hard. Our algorithm can handle further, natural constructors, currently not found in MPI.
Our algorithm is based on dynamic programming, and requires the solution of a series of shortest path problems on an incrementally built, directed, acyclic graph. The algorithm runs in $O(n^4)$ time steps and requires $O(n^2)$ space for input displacement sequences of length $n$.
Efficient Tree Layout in a Multilevel Memory Hierarchy
我们考虑的问题,布局一棵树与固定的父/子结构的层次存储器。我们的目标是最大限度地减少预期数量的块传输搜索期间沿根到叶路径,叶上的概率分布。这个问题以前被Gil和Itai考虑过,他们在块传输大小B已知的情况下开发了最优但速度较慢的算法。我们提出了更快的,但近似算法相同的问题,最快的算法运行在线性时间,并产生一个解决方案,是在一个附加常数的最佳。此外,我们将展示如何扩展任何近似最优算法的缓存不经意设置中的块传输大小是未知的算法。缓存无关布局的查询性能是在一个恒定的因素的查询性能的最佳已知块大小的布局。计算缓存无关布局只需要在数学上多次调用已知块大小的布局算法;特别是,缓存无关布局可以在O(N lg N)时间内计算,其中N是节点数。最后,我们分析了两个贪婪的策略,并表明,他们有一个性能比之间的Omega(lg B / lg lg B)和O(lg B)的最佳布局相比。
Stony Brook University(石溪大学);Tokutek, Inc.(Tokutek公司);Computer Science and Artificial Intelligence Laboratory, Massachusetts Institute of Technology(麻省理工学院计算机科学与人工智能实验室);University of Southern California(南加州大学);Akamai Technologies, Inc.(Akamai科技公司);Boston University(波士顿大学)