Hi,
I managed to get pyOpenCl working. Apparently, when I select the device
'by hand' all works fine:
device = cl.get_platforms()[0].get_devices()[1]
ctx = cl.Context(devices=[device])
queue = cl.CommandQueue(ctx)
I've attached my demo script to this e-mail. It prints out some device
info and runs the program. Looks like the problem is with the demo.py
from the website.
Problem now is with an outdated libc which crashes the program with a
malloc error. But I'll leave that up to the sys admin ;-)
Thanks for the input,
Sven
Citeren Jerome Kieffer <jerome.kief...@esrf.fr>:
Hi,
Is the MPSS deamon started ?
Cheers,
Jerome
_______________________________________________
PyOpenCL mailing list
PyOpenCL@tiker.net
http://lists.tiker.net/listinfo/pyopencl
import numpy as np
import pyopencl as cl
import time
init = 20
vectorSize= init*init
groupSize = init
device = cl.get_platforms()[0].get_devices()[1]
ctx = cl.Context(devices=[device])
queue = cl.CommandQueue(ctx)
#some info:
print("Group size: {}".format(device.get_info(cl.device_info.MAX_WORK_GROUP_SIZE)))
print("Work item size: {}".format(device.get_info(cl.device_info.MAX_WORK_ITEM_SIZES)))
print("Max global RAM: {}".format(device.get_info(cl.device_info.GLOBAL_MEM_SIZE)))
print("Max alloc RAM: {}".format(device.get_info(cl.device_info.MAX_MEM_ALLOC_SIZE)))
print("Max local RAM: {}".format(device.get_info(cl.device_info.LOCAL_MEM_SIZE)))
print("Compute units: {}".format(device.get_info(cl.device_info.MAX_COMPUTE_UNITS)))
results = cl.Buffer(ctx, cl.mem_flags.READ_WRITE, size=vectorSize*4)
values_h = np.ones((vectorSize), dtype=np.int32)
values = cl.Buffer(ctx, cl.mem_flags.READ_ONLY | cl.mem_flags.COPY_HOST_PTR, hostbuf=values_h)
results_h = np.zeros((vectorSize), dtype=np.int32)
cl.enqueue_copy(queue, results, results_h)
print(results_h)
prg = cl.Program(ctx, """
__kernel void copy(__global const int *a_g, __global int *res_g, const unsigned int init) {
int gid = get_global_id(0);
for (int i=0; i < init; i++) {
res_g[gid*init+i] = a_g[gid*init+i];
}
}
""").build()
copy = prg.copy
copy.set_scalar_arg_dtypes([None, None, np.uint32])
start = time.clock()
copy(queue, (groupSize,),None, values, results, init).wait()
cl.enqueue_copy(queue, results_h, results)
print("Wall clock: {}".format(time.clock() - start))
print(results_h)
_______________________________________________
PyOpenCL mailing list
PyOpenCL@tiker.net
http://lists.tiker.net/listinfo/pyopencl