使用OpenCL进行编译警告

时间:2013-12-21 18:38:00

标签: python numpy opencl pyopencl

今天醒来,突然得到了

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()

示例和部分解决方案来自here

解决方案建议回滚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)

1 个答案:

答案 0 :(得分:4)

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

执行此操作以查看编译器输出,之前我收到了相同的消息。这只是intel opencl编译器说它已经矢量化\优化了opencl内核。