Giter Club home page Giter Club logo

A Python based parallel programming library for GPUs

About

Urutu integrates CUDA and OpenCL into a single code. That is, write a single code in Python run it using CUDA or OpenCL or both. It is portable to different hardware and operating systems.

System Requirements

  • Windows, Ubuntu (tested), Mac
  • Python 2.7, GCC 4.6
  • A GPU compatible with OpenCL or CUDA 5.0
  • PyOpenCL or PyCUDA installed

Setup

$ git clone https://github.com/urutu/Urutu.git
$ cd Urutu
$ sudo python2 setup.py install

For installing with Python 3, install PyCUDA and PyOpenCL with Python 3. Then, clone this repository and use

$ git clone https://github.com/urutu/Urutu.git
$ 2to3 -w Urutu
$ cd Urutu
$ sudo python3 setup.py install

=======

Sample Code

from Urutu import *
import numpy as np

@Urutu("CL")
def divmul(a, b, c, d):
	__global is x, y
	x = a[0:100]
	y = b[0:100]
	t, u, v, w = 10, 10.0, 'opencl', "open.cl"
	c[tx] = x[tx] / y[tx]
	d[tx] = x[tx] * y[tx]
	return c, d

@Urutu("CU")
def addsub(a, b, e, f):
	__shared is x , y
	x = a[0:100]
	y = b[0:100]
	t, u, v, w = 11, 11.0, 'cuda', "cu.da"
	e[tx] = x[tx] + y[tx]
	f[tx] = x[tx] - y[tx]
	return e, f

a = np.random.randint(10, size = 100)
b = np.random.randint(10, size = 100)
c = np.array(a, dtype = 'f')
d = np.empty_like(a)
e = np.empty_like(a)
f = np.empty_like(a)

print "The Array A is: \n", a
print "The Array B is: \n", b
print "Running on OpenCL.. \n", divmul([100,1,1], [1,1,1], a, b, c, d)
print "Running on CUDA.. \n", addsub([100,1,1], [1,1,1], a, b, e, f)

Keywords made available

and     elif    if      not
as      else    in      or
def     for     is      return

Urutu's Projects

pycuda icon pycuda

CUDA integration for Python, plus shiny features

pyopencl icon pyopencl

OpenCL integration for Python, plus shiny features

urutu icon urutu

A Python based parallel programming library for GPUs

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.