Urutu

A Python library for GPU Programming.

View My GitHub Profile

Introduction

Urutu is a Python library which accelerates methods conforming to python syntax using GPUs. The code example is a simple example for adding elements of two vectors of type "long". Data management and data type checks are managed by Urutu. Urutu supports OpenCL and CUDA enabled devices with PyOpenCL or PyCUDA installed for them.

Requirements

Urutu runs well on linux machines with NumPy, Python and GPU programming drivers and toolkits installed in them. Urutu is built against CUDA - v5.0 and OpenCL v1. Urutu uses PyOpenCL and PyCUDA as backends to run the python code. These can be downloaded from the Python-Pip repository where latest versions are available.

Installation

Installation of Urutu is straight forward. Download the source and unzip with your favorite extractor and change your working directory in terminal to the project and run $sudo python setup.py install

Usage

Urutu supports two paradigms.

Thread-Level Parallelism:

GPU programming introduces thread-level programming for developers to extract every last bit of performance from GPUs. Urutu exposes these features to Python by adding new thread level syntax. By using the reserved syntax tx ty tz bx by bz Tx Ty Tz Bx By Bz the threads and blocks can be controlled. Urutu also introduce different memory pools inside GPU to programmers. __global __shared __register __constant variables with these qualifiers allocate memory in different segments of memory which differ in size and performance. The qualifiers can be added before variable declaration to allocate and access memory in different memory locations. The reserved syntaxes represents:
tx: Threads across X-d
ty: Threads across Y-d
tz: Threads across Z-d
Tx: Total number of threads across X-d (Or) Block size in X-d
Ty: Total number of threads across Y-d (Or) Block size in Y-d
Tz: Total number of threads across Z-d (Or) Block size in Z-d
bx: Blocks across X-d
by: Blocks across Y-d
bz: Blocks across Z-d
Bx: Total number of blocks across X-d (Or) Grid size in X-d
By: Total number of blocks across Y-d (Or) Grid size in Y-d
Bz: Total number of blocks across Z-d (Or) Grid size in Z-d

Usage of these syntaxes is depicted in the code above.
__global: Global Memory pool, which is accessable to all the threads running in the kernel
__shared: Shared Memory pool, which is accessable to all the threads running in the same thread block
__register: Register Memory pool, which is accessable only to the thread.
__constant: Constant Memory pool, variables declared in this memory pool holds the same value till end of life time of the kernel. (Cannot be changed by the kernel)

In the above example variables x and y are shared variables which reside on shared memory pool. The data residing in global memory pool which is stored in variables a , b and c are transfered to shared pools by assigning the data to variables. These variables can be used as regular variables for computation.

Data-Level Parallelism

Data level parallelism applies functions to each element in the vast data arraysthere by expoliting parallelism of independent nature of the data elements. The below examples shows how to use it using Urutu. The code represent a simple DAXPY BLAS algorithm widely used in algebraic computations. As the algorithm operate on each element separately, the execution of the function can be made general for each element. The code shows this, as there are no threads involved in computation, all the processing is data driven.

Features

Lazy Data Transfer Automated Type Check Multiple Backends Multiple Paradigms Productivity

Creating pages manually

If you prefer to not use the automatic generator, push a branch named gh-pages to your repository to create a page manually. In addition to supporting regular HTML content, GitHub Pages support Jekyll, a simple, blog aware static site generator. Jekyll makes it easy to create site-wide headers and footers without having to copy them across every page. It also offers intelligent blog support and other advanced templating features.

Authors and Contributors

You can @mention a GitHub username to generate a link to their profile. The resulting <a> element will link to the contributor’s GitHub Profile. For example: In 2007, Chris Wanstrath (@defunkt), PJ Hyett (@pjhyett), and Tom Preston-Werner (@mojombo) founded GitHub.

Support or Contact

Having trouble with Pages? Check out our documentation or contact support and we’ll help you sort it out.