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.
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
Preview
Unable to display preview. Download preview PDF.
References
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)
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)
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)
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)
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)
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)
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)
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)
Khronos, http://www.khronos.org/opencl/
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)
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)
Nickolls, J., Buck, I., Garland, M., Skadron, K.: Scalable Parallel Programming with CUDA. Queue 6(2), 40–53 (2008)
OpenMP C and C++ Application Program Interface, Version 2.0 (March 2002)
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)
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)
Author information
Authors and Affiliations
Editor information
Editors and Affiliations
Rights 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)