[Beignet] beignet 0.9.2-2 looking for MesaOpenCL on Intel laptop, fedora 21
David Liebman
david.c.liebman at gmail.com
Fri Aug 29 09:45:45 PDT 2014
Hello.
I have compiled PyOpenCL for my fc21 computer. My computer has an Ivy
Bridge chipset and fc21 sports Beignet version 0.9.2-2.fc21. I am having
trouble with a simple program that computes sums. This is the program
listing:
import pyopencl as cl
import numpy
import sys
import time
class CL(object):
def __init__(self, size=10):
self.size = size
self.ctx = cl.create_some_context()
self.queue = cl.CommandQueue(self.ctx)
def load_program(self):
fstr="""
__kernel void part1(__global float* a, __global float* b,
__global float* c)
{
unsigned int i = get_global_id(0);
c[i] = a[i] + b[i];
}
"""
self.program = cl.Program(self.ctx, fstr).build()
def popCorn(self):
mf = cl.mem_flags
self.a = numpy.array(range(self.size), dtype=numpy.float32)
self.b = numpy.array(range(self.size), dtype=numpy.float32)
self.a_buf = cl.Buffer(self.ctx, mf.READ_ONLY | mf.COPY_HOST_PTR,
hostbuf=self.a)
self.b_buf = cl.Buffer(self.ctx, mf.READ_ONLY | mf.COPY_HOST_PTR,
hostbuf=self.b)
self.dest_buf = cl.Buffer(self.ctx, mf.WRITE_ONLY, self.b.nbytes)
def execute(self):
self.program.part1(self.queue, self.a.shape, None, self.a_buf,
self.b_buf, self.dest_buf)
c = numpy.empty_like(self.a)
cl.enqueue_read_buffer(self.queue, self.dest_buf, c).wait()
print ( "a", self.a)
print ( "b", self.b)
print ( "c", c )
def add(s=10) :
starttime = time.clock()
matrixmul = CL(s)
matrixmul.load_program()
matrixmul.popCorn()
matrixmul.execute()
endtime = time.clock()
print s, endtime - starttime
if __name__ == '__main__':
add(1)
add(2)
add(3)
This is the error I get when I run the program:
[dave at localhost awesome-test]$ ./arrays_opencl.py
Traceback (most recent call last):
File "./arrays_opencl.py", line 3, in <module>
import pyopencl as cl
File
"/usr/lib64/python2.7/site-packages/pyopencl-2014.1-py2.7-linux-x86_64.egg/pyopencl/__init__.py",
line 28, in <module>
import pyopencl._cl as _cl
ImportError: libMesaOpenCL.so.1: cannot open shared object file: No such
file or directory
NOTE: I do not have libMesaOpenCL on this computer. I uninstalled it and
then re-installed pyopencl when I fedup'd to fc21. In fc20 Beignet
worked correctly.
also for the record, this is the configuration line that I used when
installing pyopencl:
[dave at localhost awesome-test]$ ./configure.py
--cl-lib-dir=/usr/lib64/beignet --cl-libname=cl
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/beignet/attachments/20140829/8b35d14c/attachment.html>
More information about the Beignet
mailing list