0

今天一觉醒来突然得到

C:\Python27\lib\site-packages\pyopencl\__init__.py:61: CompilerWarning: Non-empty compiler output encountered. Set the environment variable PYOPENCL_COMPILER_OUTPUT=1 to see more.
  "to see more.", CompilerWarning)
C:\Python27\lib\site-packages\pyopencl\cache.py:101: UserWarning: could not obtain cache lock--delete 'c:\users\User\appdata\local\temp\pyopencl-compiler-cache-v2-uiduser-py2.7.3.final.0\lock' if necessary
  % self.lock_file)

当我运行任何类型的 PqOpenCL 代码时,例如:

import numpy
import pyopencl as cl
import pyopencl.array as clarray
from pyopencl.reduction import ReductionKernel

ctx = cl.create_some_context()
queue = cl.CommandQueue(ctx)
krnl = ReductionKernel(ctx, numpy.float32, neutral="0",
                       reduce_expr="a+b", map_expr="x[i]*y[i]",
                       arguments="__global float *x, __global float *y")
x = clarray.arange(queue, 400, dtype=numpy.float32)
y = clarray.arange(queue, 400, dtype=numpy.float32)
m = krnl(x, y).get()

样品和部分解决方案来自这里

解决方案建议回滚 numpy,这是我从 1.8.0 到 1.7.2 所做的,但仍然是同样的问题

编辑 1

按建议添加

import os os.environ['PYOPENCL_COMPILER_OUTPUT'] = '1'

C:\Python27\lib\site-packages\pyopencl\__init__.py:57: CompilerWarning: From-source build succeeded, but resulted in non-empty logs:
Build on <pyopencl.Device 'Intel(R) HD Graphics 4000' on 'Intel(R) OpenCL' at 0x51eadff0> succeeded, but said:

fcl build 1 succeeded.
fcl build 2 succeeded.
bcl build succeeded.

  warn(text, CompilerWarning)
4

1 回答 1

4
import os
os.environ['PYOPENCL_COMPILER_OUTPUT'] = '1'

这样做是为了查看编译器输出,我之前也收到过同样的信息。只是英特尔 opencl 编译器说它已经矢量化\优化了 opencl 内核。

于 2013-12-21T18:58:54.757 回答