Skip to main content

Safe and Familiar Multi-core Programming by Means of a Hybrid Functional and Imperative Language

  • Conference paper
Languages and Compilers for Parallel Computing (LCPC 2009)

Part of the book series: Lecture Notes in Computer Science ((LNTCS,volume 5898))

  • 820 Accesses

Abstract

Current (heterogeneous) multi-core environments such as gpGPU architectures are hard to program with normal imperative and object-oriented (OO) languages. There are two basic problems to tackle: (1) it is too easy to program race conditions and dead-locks with the available synchronization primitives, and (2) these environments do not support (or support inefficiently) the instructions required for efficient execution of OO programs, e.g., because function pointers and pointer arithmetic are lacking.

We address both problems with a new language that comprises both Functional Programming (FP) and OO programming. We solve problem (1) by auto-parallelization in the functional core where all loops and non-dependent calls can be executed in parallel. FP is to be used to write computational intensive code with safe concurrent memory access.

An alternative object model that does neither use pointer arithmetic nor function pointers but smart pointers/proxies (to implement polymorphism) as well as mixins and templates (to implement OO like code reuse) solves problem (2).

To cleanly integrate the two language cores, we propose a new integration model that even grants some restricted ways to access state from within FP mode.

With the new language and prototype compiler we can transparently parallelize code to target both Cuda and multi-core machines (without annotations from the programmer) and obtain good speedups.

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

Access this chapter

Chapter
USD 29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD 39.99
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD 54.99
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Institutional subscriptions

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. Barth, P.S., Nikhil, R.S., Arvind: M-Structures: Extending a Parallel, Non-strict, Functional Language with State. In: Proc. Conf. on Funct. Prog. Lang. and Comp. Arch., Cambridge, MA, USA, August 1991, pp. 538–568 (1991)

    Google Scholar 

  2. Buck, I., Foley, T., Horn, D., Sugerman, J., Fatahalian, K., Houston, M., Hanrahan, P.: Brook for GPUs: stream computing on graphics hardware. In: SIGGRAPH 2004, Los Angeles, CA, pp. 777–786 (2004)

    Google Scholar 

  3. Bull, J.M., Kambites, M.E.: JOMP—an OpenMP-like Interface for Java. In: Proc. Conf. on Java Grande, San Francisco, CA, pp. 44–53 (2000)

    Google Scholar 

  4. Chamberlain, B.L., Callahan, D., Zima, H.P.: Parallel Programmability and the Chapel Language. Intl. J. High Perform. Comput. Appl. 21(3), 291–312 (2007)

    Article  Google Scholar 

  5. Charles, P., Grothoff, C., Saraswat, V., Donawa, C., Kielstra, A., Ebcioglu, K., von Praun, C., Sarkar, V.: X10: an object-oriented approach to non-uniform cluster computing. In: OOPSLA 2005: Proc. Conf. on Object-Oriented Programming, Systems, Languages, and Applications, San Diego, CA, pp. 519–538 (2005)

    Google Scholar 

  6. Che, S., Boyer, M., Meng, J., Tarjan, D., Sheaffer, J.W., Skadron, K.: A performance study of general-purpose applications on graphics processors using CUDA. J. Parallel Distrib. Comput. 68(10), 1370–1380 (2008)

    Article  Google Scholar 

  7. Chopard, B., Masselot, A.: Cellular automata and lattice Boltzmann methods: a new approach to computational fluid dynamics and particle transport. Future Gener. Comput. Syst. 16(2-3), 249–257 (1999)

    Article  Google Scholar 

  8. Eichenberger, A.E., O’Brien, K., O’Brien, K., Wu, P., Chen, T., Oden, P.H., Prener, D.A., Shepherd, J.C., So, B., Sura, Z., Wang, A., Zhang, T., Zhao, P., Gschwind, M.: Optimizing Compiler for the CELL Processor. In: PACT 2005: Proc. Conf. on Parallel Architectures and Compilation Techniques, St. Louis, MO, pp. 161–172 (2005)

    Google Scholar 

  9. Khronos, http://www.khronos.org/opencl/

  10. Klemm, M., Bezold, M., Veldema, R., Philippsen, M.: JaMP: An Implementation of OpenMP for a Java DSM. Concurrency and Computation: Practice and Experience 18(19), 2333–2352 (2007)

    Article  Google Scholar 

  11. Lee, S., Chakravarty, M.M.T., Grover, V., Keller, G.: GPU Kernels as Data-Parallel Array Computations in Haskell. In: EPAHM 2009: Workshop on Exploiting Parallelism using GPUs and other Hardware-Assisted Methods, Seattle, WA, pp. 1–9 (2009)

    Google Scholar 

  12. Nickolls, J., Buck, I., Garland, M., Skadron, K.: Scalable Parallel Programming with CUDA. Queue 6(2), 40–53 (2008)

    Article  Google Scholar 

  13. OpenMP C and C++ Application Program Interface, Version 2.0 (March 2002)

    Google Scholar 

  14. Silberstein, M., Schuster, A., Geiger, D., Patney, A., Owens, J.D.: Efficient computation of sum-products on GPUs through software-managed cache. In: ICS 2008: Proc. Intl. Conf. on Supercomputing, Island of Kos, Greece, pp. 309–318 (2008)

    Google Scholar 

  15. Sulzmann, M., Lam, E.S.L., Marlow, S.: Comparing the performance of concurrent linked-list implementations in Haskell. In: DAMP 2009: Proc. Workshop on Declarative aspects of multicore programming, Savannah, GA, pp. 37–46 (2008)

    Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Editor information

Editors and Affiliations

Rights and permissions

Reprints and permissions

Copyright information

© 2010 Springer-Verlag Berlin Heidelberg

About this paper

Cite this paper

Veldema, R., Philippsen, M. (2010). Safe and Familiar Multi-core Programming by Means of a Hybrid Functional and Imperative Language. In: Gao, G.R., Pollock, L.L., Cavazos, J., Li, X. (eds) Languages and Compilers for Parallel Computing. LCPC 2009. Lecture Notes in Computer Science, vol 5898. Springer, Berlin, Heidelberg. https://doi.org/10.1007/978-3-642-13374-9_11

Download citation

  • DOI: https://doi.org/10.1007/978-3-642-13374-9_11

  • Publisher Name: Springer, Berlin, Heidelberg

  • Print ISBN: 978-3-642-13373-2

  • Online ISBN: 978-3-642-13374-9

  • eBook Packages: Computer ScienceComputer Science (R0)

Publish with us

Policies and ethics