Urutu
所属分类:GPU/显卡
开发工具:Python
文件大小:155KB
下载次数:0
上传日期:2015-09-27 19:40:02
上 传 者:
sh-1993
说明: 基于Python的GPU并行编程库
(A Python based parallel programming library for GPUs)
文件列表:
Copyright (128, 2015-09-28)
LICENCE (10175, 2015-09-28)
Urutu (0, 2015-09-28)
Urutu\__init__.py (1140, 2015-09-28)
Urutu\cl (0, 2015-09-28)
Urutu\cl\__init__.py (22118, 2015-09-28)
Urutu\cl\blocks.py (1341, 2015-09-28)
Urutu\cl\declare.py (2961, 2015-09-28)
Urutu\cl\device.py (30, 2015-09-28)
Urutu\cl\execl.py (3566, 2015-09-28)
Urutu\cl\grammar.py (202, 2015-09-28)
Urutu\cl\threads.py (1290, 2015-09-28)
Urutu\cpu.py (3624, 2015-09-28)
Urutu\cu (0, 2015-09-28)
Urutu\cu\__init__.py (38533, 2015-09-28)
Urutu\cu\abstract.py (272, 2015-09-28)
Urutu\cu\blocks.py (1235, 2015-09-28)
Urutu\cu\declare.py (2943, 2015-09-28)
Urutu\cu\device.py (30, 2015-09-28)
Urutu\cu\dump.py (1748, 2015-09-28)
Urutu\cu\execu.py (2436, 2015-09-28)
Urutu\cu\grammar.py (201, 2015-09-28)
Urutu\cu\modules.py (793, 2015-09-28)
Urutu\cu\threads.py (1256, 2015-09-28)
samples (0, 2015-09-28)
samples\black_scholes.py (1693, 2015-09-28)
samples\count.py (406, 2015-09-28)
samples\csr_gpu.py (843, 2015-09-28)
samples\daxpy.py (355, 2015-09-28)
samples\daxpy_dp.py (345, 2015-09-28)
samples\dia_gpu.py (783, 2015-09-28)
samples\fft.py (592, 2015-09-28)
samples\image.jpg (119076, 2015-09-28)
samples\image_gpu.py (796, 2015-09-28)
samples\index.py (117, 2015-09-28)
samples\laplace.py (191, 2015-09-28)
samples\solve_poisson.py (629, 2015-09-28)
setup.py (350, 2015-09-28)
... ...
[Urutu](http://urutu.github.io)
=======
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](http://mathema.tician.de/software/pyopencl) or [PyCUDA](http://mathema.tician.de/software/pycuda) installed
Setup
------
```shell
$ 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
```shell
$ git clone https://github.com/urutu/Urutu.git
$ 2to3 -w Urutu
$ cd Urutu
$ sudo python3 setup.py install
```
=======
Sample Code
-----------
```python
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
--------------------------
```python
and elif if not
as else in or
def for is return
```
近期下载者:
相关文件:
收藏者: