Suggestion of an annotation for GPU computing

Lippold, Dietmar Dietmar.Lippold at
Fri Aug 4 07:14:31 UTC 2017


I have a suggestion for using Java on GPUs. Because project Sumatra is
currently inactive [1] and the suggestion is not related to technical details
I send it to this list.

I think there are (at least) two important distinctions for ways of using
the GPU, the used data structures and the defined program elements.

The data structures can be:

 * Single elements which are processed individually (e.g. in Streams)
 * Combinations of elements which are processed as a whole (e.g. Vectors)

The first is more flexible but the second is easier to use. In project
Sumatra the streams were of primary importance [2] but vectors are currently
defined in project Panama [3].

The defined program elements for the GPU can be:

 * Methods (e.g. used in Streams [2])
 * Classes (e.g. kernels in Aparapi [4])

An important distinction is that classes can contain data. This is important
in cases when the time for transferring the data from the CPU to the GPU is
significant for the runtime and the data can be reused in repeated calls of

When combining the usage of vectors with classes the usage of GPUs can be
very easy I think. One only has to add an annotation like "@OnGpu" to the
class which shall "live" on the GPU (i.e. its data are stored on the GPU and
its methods are executed on the GPU). Data are transferred between CPU and
GPU exactly when a method from a CPU class calls a method (or constructor)
from a GPU class. That is obvious to the developer and he/she can optimize
that (minimize the transferred data).

So my suggestion is: Define such an annotation.



More information about the discuss mailing list