Esempio n. 1
0
def main():

    ca = CLArrayContext(device_type=cl.Device.GPU)

    size = 8

    device_input = ca.arange(size)

    output = ca.add.reduce(device_input)

    print output.item()
    with output.map() as view:
        print "device sum", np.asarray(view).item()
Esempio n. 2
0
def main():
    
    ca = CLArrayContext(device_type=cl.Device.GPU)
    
    size = 8
    
    device_input = ca.arange(size)
    
    output = ca.add.reduce(device_input)
    
    print output.item()
    with output.map() as view:
        print "device sum", np.asarray(view).item()
Esempio n. 3
0
Created on Dec 15, 2011

@author: sean
"""

import opencl as cl
from clyther.array import CLArrayContext

# Always have to create a context.
ca = CLArrayContext()

# can print the current devices
print ca.devices

# Create an array
a = ca.arange(12)

print a

# map is the same as a memory map
with a.map() as arr:
    print arr

# can clice
b = a[1::2]

with b.map() as arr:
    print arr

# ufuncs
c = a + 1
Esempio n. 4
0
'''
Created on Dec 15, 2011

@author: sean
'''

import opencl as cl
from clyther.array import CLArrayContext
#Always have to create a context.
ca = CLArrayContext()

#can print the current devices
print ca.devices

#Create an array
a = ca.arange(12)

print a

#map is the same as a memory map
with a.map() as arr:
    print arr

#can clice
b = a[1::2]

with b.map() as arr:
    print arr

#ufuncs
c = a + 1