YoGA Philosophy » Historique » Version 2
Damien Gratadour, 10/11/2013 15:35
1 | 1 | Damien Gratadour | h1. YoGA Philosophy |
---|---|---|---|
2 | |||
3 | YoGA aims at providing the user with the ability to work on the GPU from within Yorick. It allows to easily build and debug high-level applications that run on the GPU thanks to Yorick's interpreted environment. |
||
4 | |||
5 | 2 | Damien Gratadour | Because the GPU is a "device" in a "host" GPU applications performance tend to be limited by memory operations between the host and the GPU. Depending on the memory bandwidth of the GPU used, data transfers (host->GPU & GPU->host) as well as memory allocation can kill your acceleration factor. In this scenario, you can allocate memory space once, then transfer- intensive compute -transfer back and then free memory. This can be very effective depending on the amount of data to transfer both ways. |
6 | 1 | Damien Gratadour | |
7 | h2. Yorick plugin |
||
8 | |||
9 | The Yorick implementation uses an opaque object that points to this C++ class : Yoga Object. It is built using the standard API for interfacing yorick packages to the interpreter. This way persistent objects on the GPU memory can be created and manipulated from Yorick. To this object in Yorick are also associated wrappers that allow to mimic basic operations on Yorick variables (alloc / create, destroy / free, print, eval). Hence a Yoga Object can be manipulated in the same way as a standard Yorick variable. Allocation is done once, and destroy is handled either by the user when needed or by Yorick when terminating (minimal chances for a leak). |
||
10 | |||
11 | Additionally, device2host and host2device routines are provided allowing the transfer between a standard Yorick variable and a Yoga Object. |
||
12 | |||
13 | C-wrappers aimed at being launched from within Yorick have also been added. They wrap calls to these yoga_obj methods using the content of the stack as arguments. These wrappers can be called as functions, in which case they will create new Yoga Objects to store the result or a subroutines in which case they will use pre-existing objects. They provide various mathematical functionalities. After object creation, using these wrappers, the user can build a fast sequence with a no memory space allocation , perform multiple complex operations on Yoga Objects, only on the GPU and then transfer back the result (for display for instance) and eventually (and optionaly) desallocate. See for instance the Practice YoGA page for some details and a practical example. |