Chapter 9. Development with Java and Python
This chapter covers
- Building Java-based OpenCL classes with Aparapi
- Using the JavaCL toolset to build host applications in Java
- Creating Python-based host applications with the PyOpenCL toolset
In chapter 1, I explained that OpenCL makes it possible to “write once, run on anything,” and I contrasted that with Java’s motto, “Write once, run anywhere.” In this chapter, we’re going to combine the two and obtain the best of both worlds. That is, we’re going to explore how to build high-performance applications using Java and OpenCL. Then we’re going to investigate host application development with Python.
Tip
If you’re unfamiliar with Java, I strongly recommend reading Head First Java by Kathy Sierra and Bert Bates (O’Reilly, 2005). If you’d like to know more about Python, you can’t do much better than The Quick Python Book, Second Edition by Vern Ceder (Manning, 2010).
This chapter presents three freely available toolsets that allow you to access OpenCL’s capabilities using object-oriented development:
- Aparapi—Released by AMD and translates Java and deploys kernel code
- JavaCL—Released by Olivier Chafik and binds Java classes to the structures in an OpenCL host application
- PyOpenCL—Released by Andreas Klöckner and makes it possible to code host applications in Python