Skip to main content
Log in

Optimal computation of prefix sums on a binary tree of processors

  • Published:
International Journal of Parallel Programming Aims and scope Submit manuscript

Abstract

Givenn numbersa 0,a 1,...,a n −1, it is required to compute all sums of the forma 0+a 1+...+a i , fori=0, 1,...,n−1. This problem arises in many applications and is trivial to solve sequentially in O(n) time. Besides its practical importance, the problem gains an additional theoretical interest in parallel computation. A technique known asrecursive doubling allows all sums to be computed in O(logn) time on a model of computation wheren processors communicate through aninverse perfect suffle interconnection network. In this paper we show how the problem can be solved on a simple network, namely abinary tree of processors. In addition, we show how to extend our solution to obtain an optimal-cost algorithm. The algorithm usesp processors and runs in O((n/p)+logp) time, for a cost of O(n+p logp). This cost is optimal whenp logp=O(n). Finally, two applications of our results are illustrated, namely job scheduling with deadlines and the knapsack problem.

This is a preview of subscription content, log in via an institution to check access.

Access this article

Price excludes VAT (USA)
Tax calculation will be finalised during checkout.

Instant access to the full article PDF.

Similar content being viewed by others

References

  1. S. G. Akl,Parallel Sorting Algorithms, Academic Press, Orlando, Florida (1985).

    Google Scholar 

  2. E. Dekel and S. Sahni, Binary Trees and Parallel Scheduling Algorithms,IEEE Transactions on Computers C-32(3):307–315 (March 1983).

    Google Scholar 

  3. F. E. Fich, New Bounds For Parallel Prefix Circuits,Proc. of the 15th Annual ACM Symposium on Theory of Computing, Boston, Massachusetts, pp. 100–109 (May 1983).

  4. P. M. Kogge, Parallel Solution of Recurrence Problems,IBM Journal of Research and Development, pp. 138–148 (March 1974).

  5. P. M. Kogge and H. S. Stone, A Parallel Algorithm for the Efficient Solution of a General Class of Recurrence Equations,IEEE Transactions on Computers C-22(8):786–792 (August 1973).

    Google Scholar 

  6. C. P. Kruskal, L. Rudolph, and M. Snir, The Power of Parallel Prefix,IEEE Transactions on Computers C-34 (10):965–968 (October 1985).

    Google Scholar 

  7. R. E. Ladner and M. J. Fischer, Parallel Prefix Computation,Journal of the ACM 27(4):831–838 (October 1980).

    Google Scholar 

  8. H. Meijer and S. G. Akl, Bit Serial Addition Trees and Their Applications,Proceedings of the Canadian Information Processing Society Congress '87, Winnipeg, Manitoba, pp. 319–322 (May 1987).

  9. J. Reif, Probabilistic Parallel Prefix Computation,Proceeding of the International Conference on Parallel Processing, Bellaire, Michigan, pp. 291–298 (August 1984).

  10. J. T. Schwartz, Ultracomputers,ACM Transactions on Programming Languages and Systems 2(4):484–521 (October 1980).

    Google Scholar 

  11. H. S. Stone, (ed.),Introduction to Computer Architecture, Science Research Associates, Chicago, Illinois (1980).

    Google Scholar 

  12. R. Wagner and Y. Han, Parallel Algorithms For Bucket Sorting and the Data Dependent Prefix Problem,Proceedings of the Internatinal Conference on Parallel Processing, St. Charles, Illinois, pp. 924–930 (August 1986).

  13. R. P. Brent, The Parallel Evaluation of General Arithmetic Expressions,Journal of the ACM 21(2):201–206 (1974).

    Google Scholar 

  14. E. Horowitz and S. Sahni,Fundamentals of Computer Algorithms, Computer Science Press, Potomac, Maryland (1978).

    Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Additional information

This work was supported by the Natural Sciences and Engineering Research Council of Canada under Grants A0282 and A3336.

Rights and permissions

Reprints and permissions

About this article

Cite this article

Meijer, H., Akl, S.G. Optimal computation of prefix sums on a binary tree of processors. Int J Parallel Prog 16, 127–136 (1987). https://doi.org/10.1007/BF01379098

Download citation

  • Received:

  • Accepted:

  • Issue Date:

  • DOI: https://doi.org/10.1007/BF01379098

Key Words

Navigation