Python PyViennaCL返回segfault

Python PyViennaCL返回segfault,python,viennacl,Python,Viennacl,我已经开始用OpenCL编程了,到目前为止我使用的是pyopencl包,它非常适合于简单的计算,但很难计算更高级的东西。这个想法是使用pyViennaCL,高级替代品。我已经安装了ViennaCL和pyOpenCL(由pip提供),而且我还安装了pip。当我从ViennaCL页面运行官方示例时: #!/usr/bin/python # Import PyViennaCL and NumPy import pyviennacl as p import numpy as np # Create o

我已经开始用OpenCL编程了,到目前为止我使用的是pyopencl包,它非常适合于简单的计算,但很难计算更高级的东西。这个想法是使用pyViennaCL,高级替代品。我已经安装了ViennaCL和pyOpenCL(由pip提供),而且我还安装了pip。当我从ViennaCL页面运行官方示例时:

#!/usr/bin/python
# Import PyViennaCL and NumPy
import pyviennacl as p
import numpy as np

# Create our datastructures on the host
x = [1.0, 2.0, 3.0, 4.0, 5.0] # We can create PyViennaCL Vectors from lists
a = np.array([[1.0, 2.0, 3.0],
              [0.0, 3.0, 4.0],
              [0.0, 0.0, 5.0]]) # We can create PyViennaCL Matrices from arrays

# Create corresponding ViennaCL datastructures on the compute device
y = p.Vector(x)
b = p.Matrix(a) # This is a dense matrix

# Copy the data back to the host and check that it's equal
z = y.value # z is now a 1-D numpy array with dtype float64
c = b.value # c is now a 2-D numpy array with dtype float64

if (z == x).all() and (c == a).all():
    print("Successfully transferred data to and from the compute device!")

# We can modify elements of the ViennaCL device structures, but since this 
# incurs a compute kernel initialisation and buffer transfer, it is very slow!
#y[0] = 0.0
#b[2, 2] = -1.0

#x[0] = 0.0     # We should also modify our original data to keep track..
#a[2, 2] = -1.0

# And we can do comparisons seamlessly between NumPy and PyViennaCL types!
#if (a == b).all() and (x == y).all():
#    print("Successfully modified data structures on host and device!")

# We also need to be sure that we are consistent with respect to the data-types
# we use. For instance, we should not mix integer and floating point types.
#
# By default, PyViennaCL objects inherit the dtype of the objects from which
# they are created, or (if that is ambiguous), float64.
print("a and b have dtypes of %s and %s" %
      (np.result_type(a), np.result_type(b)))

# PyViennaCL makes an effort to convert objects to the appropriate dtype where
# dtypes have been mixed, but this is often ambiguous and unpredictable, and
# so it is recommended that users make efforts to keep they dtypes consistent.
i = 1L # Create a long integer
print("i has dtype of %s" % (np.result_type(i)))
y[0] = i # Remember, this sort of elementwise assignation is *very slow*!
print("y has values %s and dtype %s" %
      (y, np.result_type(y)))

# And, of course, we can perform basic arithemetic operations with PyViennaCL,
# mixing native Python types with NumPy and PyViennaCL types:
z = (x + y + z) / 2.0
print("z is now of type %s, dtype %s, and with values %s" 
      % (type(z), np.result_type(z), z))
# Notice that z has `Div' type. This is because the z object represents the
# arithmetic expression `(x + y + z) / 2.0', and this is only computed when
# the result is needed, in order to maximise performance.

# And we can do less basic arithmetic!
print("The sine of the values of z is %s" %
      p.sin(z))
# PyViennaCL exposes many elementwise mathematical functions.
# See help(p.math) for more information. 
我得到这个输出:

Successfully transferred data to and from the compute device!
a and b have dtypes of float64 and float64
i has dtype of int64
y has values [ 1.  2.  3.  4.  5.] and dtype float64
z is now of type <class 'pyviennacl.pycore.Div'>, dtype float64, and with values [ 1.5  3.   4.5  6.   7.5]
Stack dump:
0.      Running pass 'Intel OpenCL Vectorizer' on module 'main'.
1.      Running pass 'Intel OpenCL VectorizerCore' on function '@__Vectorized_.element_op'
2.      Running pass 'WeightedInstCounter' on function '@__Vectorized_.element_op'
Segmentation fault (core dumped)
成功地向计算设备传输数据!
a和b的数据类型为float64和float64
我的数据类型是int64
y有值[1.2.3.4.5]和数据类型float64
z现在的类型是dtype float64,值为[1.5 3.4.5 6.7.5]
堆栈转储:
0在模块“main”上运行pass“英特尔OpenCL矢量器”。
1在函数“@\uu矢量化元素\uu op”上运行“英特尔OpenCL矢量核心”
2在函数“@u矢量化元素\uu op”上运行“加权计数器”
分段故障(堆芯转储)
怎么了