Hi,
I'm just getting my feet wet with OpenCL, so it is likely that
something is wrong on my end, but it seems like a lot of the
other tests pass, and this looks like just an error on the python
side, so I decided to ask on here.
I'm getting a bunch of erors like this (array.py:621)
> size = int(ceil((stop-start)/step))
E OverflowError: math range error
I appreciate any feedback,
Paul Ivanov
$ python examples/dump-properties.py
===========================================================================
<pyopencl.Platform 'NVIDIA CUDA' at 0xbf7c80>
===========================================================================
EXTENSIONS: cl_khr_byte_addressable_store cl_khr_icd cl_khr_gl_sharing
cl_nv_compiler_options cl_nv_device_attribute_query cl_nv_pragma_unroll
NAME: NVIDIA CUDA
PROFILE: FULL_PROFILE
VENDOR: NVIDIA Corporation
VERSION: OpenCL 1.0 CUDA 3.1.1
---------------------------------------------------------------------------
<pyopencl.Device 'GeForce 8800 GTX' at 0xba1d00>
---------------------------------------------------------------------------
ADDRESS_BITS: 32
AVAILABLE: 1
COMPILER_AVAILABLE: 1
DRIVER_VERSION: 256.35
ENDIAN_LITTLE: 1
ERROR_CORRECTION_SUPPORT: 0
EXECUTION_CAPABILITIES: 1
EXTENSIONS: cl_khr_byte_addressable_store cl_khr_icd cl_khr_gl_sharing
cl_nv_compiler_options cl_nv_device_attribute_query cl_nv_pragma_unroll
GLOBAL_MEM_CACHELINE_SIZE: 0
GLOBAL_MEM_CACHE_SIZE: 0
GLOBAL_MEM_CACHE_TYPE: 0
GLOBAL_MEM_SIZE: 804585472
IMAGE2D_MAX_HEIGHT: 8192
IMAGE2D_MAX_WIDTH: 8192
IMAGE3D_MAX_DEPTH: 2048
IMAGE3D_MAX_HEIGHT: 2048
IMAGE3D_MAX_WIDTH: 2048
IMAGE_SUPPORT: 1
LOCAL_MEM_SIZE: 16384
LOCAL_MEM_TYPE: 1
MAX_CLOCK_FREQUENCY: 1350
MAX_COMPUTE_UNITS: 16
MAX_CONSTANT_ARGS: 9
MAX_CONSTANT_BUFFER_SIZE: 65536
MAX_MEM_ALLOC_SIZE: 201146368
MAX_PARAMETER_SIZE: 4352
MAX_READ_IMAGE_ARGS: 128
MAX_SAMPLERS: 16
MAX_WORK_GROUP_SIZE: 512
MAX_WORK_ITEM_DIMENSIONS: 3
MAX_WORK_ITEM_SIZES: [512, 512, 64]
MAX_WRITE_IMAGE_ARGS: 8
MEM_BASE_ADDR_ALIGN: 256
MIN_DATA_TYPE_ALIGN_SIZE: 16
NAME: GeForce 8800 GTX
PLATFORM: <pyopencl.Platform 'NVIDIA CUDA' at 0xbf7c80>
PREFERRED_VECTOR_WIDTH_CHAR: 1
PREFERRED_VECTOR_WIDTH_DOUBLE: 0
PREFERRED_VECTOR_WIDTH_FLOAT: 1
PREFERRED_VECTOR_WIDTH_INT: 1
PREFERRED_VECTOR_WIDTH_LONG: 1
PREFERRED_VECTOR_WIDTH_SHORT: 1
PROFILE: FULL_PROFILE
PROFILING_TIMER_RESOLUTION: 1000
QUEUE_PROPERTIES: 3
SINGLE_FP_CONFIG: 62
TYPE: 4
VENDOR: NVIDIA Corporation
VENDOR_ID: 4318
VERSION: OpenCL 1.0 CUDA
$ make tests
echo "running tests"
running tests
find ./test -type f -name "*.py" -exec python {} \;
============================= test session starts ==============================
platform linux2 -- Python 2.5.2 -- pytest-1.3.4
test path 1: ./test/test_clmath.py
test/test_clmath.py F..FF.FFF.FF.FF.....
=================================== FAILURES ===================================
test_exp[ctx_getter=<context getter for <pyopencl.Device 'GeForce 8800 GTX' at
0x1143050>>]
ctx_getter = <pyopencl.tools.ContextGetter instance at 0x1177fc8>
def test(ctx_getter):
context = ctx_getter()
queue = cl.CommandQueue(context)
gpu_func = getattr(clmath, name)
cpu_func = getattr(numpy, numpy_func_names.get(name, name))
if has_double_support(context.devices[0]):
dtypes = [numpy.float32, numpy.float64]
else:
dtypes = [numpy.float32]
for s in sizes:
for dtype in dtypes:
args = cl_array.arange(context, queue, a, b, (b-a)/s,
> dtype=numpy.float32)
test/test_clmath.py:64:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
context = <pyopencl.Context at 0x11f18f0 on <pyopencl.Device 'GeForce 8800 GTX'
at 0x1143050>>
queue = <pyopencl._cl.CommandQueue object at 0x103a260>
def arange(context, queue, *args, **kwargs):
"""Create an array filled with numbers spaced `step` apart,
starting from `start` and ending at `stop`.
For floating point arguments, the length of the result is
`ceil((stop - start)/step)`. This rule may result in the last
element of the result being greater than stop.
"""
# argument processing
-----------------------------------------------------
# Yuck. Thanks, numpy developers. ;)
from pytools import Record
class Info(Record):
pass
explicit_dtype = False
inf = Info()
inf.start = None
inf.stop = None
inf.step = None
inf.dtype = None
if isinstance(args[-1], numpy.dtype):
dtype = args[-1]
args = args[:-1]
explicit_dtype = True
argc = len(args)
if argc == 0:
raise ValueError, "stop argument required"
elif argc == 1:
inf.stop = args[0]
elif argc == 2:
inf.start = args[0]
inf.stop = args[1]
elif argc == 3:
inf.start = args[0]
inf.stop = args[1]
inf.step = args[2]
else:
raise ValueError, "too many arguments"
admissible_names = ["start", "stop", "step", "dtype"]
for k, v in kwargs.iteritems():
if k in admissible_names:
if getattr(inf, k) is None:
setattr(inf, k, v)
if k == "dtype":
explicit_dtype = True
else:
raise ValueError, "may not specify '%s' by position and
keyword" % k
else:
raise ValueError, "unexpected keyword argument '%s'" % k
if inf.start is None:
inf.start = 0
if inf.step is None:
inf.step = 1
if inf.dtype is None:
inf.dtype = numpy.array([inf.start, inf.stop, inf.step]).dtype
# actual functionality
----------------------------------------------------
dtype = numpy.dtype(inf.dtype)
start = dtype.type(inf.start)
step = dtype.type(inf.step)
stop = dtype.type(inf.stop)
if not explicit_dtype:
raise TypeError("arange requires dtype argument")
from math import ceil
> size = int(ceil((stop-start)/step))
E OverflowError: math range error
../../tmp/local/lib/python2.5/site-packages/pyopencl-0.92-py2.5-linux-x86_64.egg/pyopencl/array.py:621:
OverflowError
test_sinh[ctx_getter=<context getter for <pyopencl.Device 'GeForce 8800 GTX'
at 0x1143050>>]
ctx_getter = <pyopencl.tools.ContextGetter instance at 0x117dab8>
def test(ctx_getter):
context = ctx_getter()
queue = cl.CommandQueue(context)
gpu_func = getattr(clmath, name)
cpu_func = getattr(numpy, numpy_func_names.get(name, name))
if has_double_support(context.devices[0]):
dtypes = [numpy.float32, numpy.float64]
else:
dtypes = [numpy.float32]
for s in sizes:
for dtype in dtypes:
args = cl_array.arange(context, queue, a, b, (b-a)/s,
> dtype=numpy.float32)
test/test_clmath.py:64:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
context = <pyopencl.Context at 0x14c71c0 on <pyopencl.Device 'GeForce 8800 GTX'
at 0x1143050>>
queue = <pyopencl._cl.CommandQueue object at 0x13277e0>
def arange(context, queue, *args, **kwargs):
"""Create an array filled with numbers spaced `step` apart,
starting from `start` and ending at `stop`.
For floating point arguments, the length of the result is
`ceil((stop - start)/step)`. This rule may result in the last
element of the result being greater than stop.
"""
# argument processing
-----------------------------------------------------
# Yuck. Thanks, numpy developers. ;)
from pytools import Record
class Info(Record):
pass
explicit_dtype = False
inf = Info()
inf.start = None
inf.stop = None
inf.step = None
inf.dtype = None
if isinstance(args[-1], numpy.dtype):
dtype = args[-1]
args = args[:-1]
explicit_dtype = True
argc = len(args)
if argc == 0:
raise ValueError, "stop argument required"
elif argc == 1:
inf.stop = args[0]
elif argc == 2:
inf.start = args[0]
inf.stop = args[1]
elif argc == 3:
inf.start = args[0]
inf.stop = args[1]
inf.step = args[2]
else:
raise ValueError, "too many arguments"
admissible_names = ["start", "stop", "step", "dtype"]
for k, v in kwargs.iteritems():
if k in admissible_names:
if getattr(inf, k) is None:
setattr(inf, k, v)
if k == "dtype":
explicit_dtype = True
else:
raise ValueError, "may not specify '%s' by position and
keyword" % k
else:
raise ValueError, "unexpected keyword argument '%s'" % k
if inf.start is None:
inf.start = 0
if inf.step is None:
inf.step = 1
if inf.dtype is None:
inf.dtype = numpy.array([inf.start, inf.stop, inf.step]).dtype
# actual functionality
----------------------------------------------------
dtype = numpy.dtype(inf.dtype)
start = dtype.type(inf.start)
step = dtype.type(inf.step)
stop = dtype.type(inf.stop)
if not explicit_dtype:
raise TypeError("arange requires dtype argument")
from math import ceil
> size = int(ceil((stop-start)/step))
E OverflowError: math range error
../../tmp/local/lib/python2.5/site-packages/pyopencl-0.92-py2.5-linux-x86_64.egg/pyopencl/array.py:621:
OverflowError
test_sin[ctx_getter=<context getter for <pyopencl.Device 'GeForce 8800 GTX' at
0x1143050>>]
ctx_getter = <pyopencl.tools.ContextGetter instance at 0x117ddd0>
def test(ctx_getter):
context = ctx_getter()
queue = cl.CommandQueue(context)
gpu_func = getattr(clmath, name)
cpu_func = getattr(numpy, numpy_func_names.get(name, name))
if has_double_support(context.devices[0]):
dtypes = [numpy.float32, numpy.float64]
else:
dtypes = [numpy.float32]
for s in sizes:
for dtype in dtypes:
args = cl_array.arange(context, queue, a, b, (b-a)/s,
> dtype=numpy.float32)
test/test_clmath.py:64:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
context = <pyopencl.Context at 0x15daa50 on <pyopencl.Device 'GeForce 8800 GTX'
at 0x1143050>>
queue = <pyopencl._cl.CommandQueue object at 0x1327890>
def arange(context, queue, *args, **kwargs):
"""Create an array filled with numbers spaced `step` apart,
starting from `start` and ending at `stop`.
For floating point arguments, the length of the result is
`ceil((stop - start)/step)`. This rule may result in the last
element of the result being greater than stop.
"""
# argument processing
-----------------------------------------------------
# Yuck. Thanks, numpy developers. ;)
from pytools import Record
class Info(Record):
pass
explicit_dtype = False
inf = Info()
inf.start = None
inf.stop = None
inf.step = None
inf.dtype = None
if isinstance(args[-1], numpy.dtype):
dtype = args[-1]
args = args[:-1]
explicit_dtype = True
argc = len(args)
if argc == 0:
raise ValueError, "stop argument required"
elif argc == 1:
inf.stop = args[0]
elif argc == 2:
inf.start = args[0]
inf.stop = args[1]
elif argc == 3:
inf.start = args[0]
inf.stop = args[1]
inf.step = args[2]
else:
raise ValueError, "too many arguments"
admissible_names = ["start", "stop", "step", "dtype"]
for k, v in kwargs.iteritems():
if k in admissible_names:
if getattr(inf, k) is None:
setattr(inf, k, v)
if k == "dtype":
explicit_dtype = True
else:
raise ValueError, "may not specify '%s' by position and
keyword" % k
else:
raise ValueError, "unexpected keyword argument '%s'" % k
if inf.start is None:
inf.start = 0
if inf.step is None:
inf.step = 1
if inf.dtype is None:
inf.dtype = numpy.array([inf.start, inf.stop, inf.step]).dtype
# actual functionality
----------------------------------------------------
dtype = numpy.dtype(inf.dtype)
start = dtype.type(inf.start)
step = dtype.type(inf.step)
stop = dtype.type(inf.stop)
if not explicit_dtype:
raise TypeError("arange requires dtype argument")
from math import ceil
> size = int(ceil((stop-start)/step))
E OverflowError: math range error
../../tmp/local/lib/python2.5/site-packages/pyopencl-0.92-py2.5-linux-x86_64.egg/pyopencl/array.py:621:
OverflowError
test_cosh[ctx_getter=<context getter for <pyopencl.Device 'GeForce 8800 GTX'
at 0x1143050>>]
ctx_getter = <pyopencl.tools.ContextGetter instance at 0x1180560>
def test(ctx_getter):
context = ctx_getter()
queue = cl.CommandQueue(context)
gpu_func = getattr(clmath, name)
cpu_func = getattr(numpy, numpy_func_names.get(name, name))
if has_double_support(context.devices[0]):
dtypes = [numpy.float32, numpy.float64]
else:
dtypes = [numpy.float32]
for s in sizes:
for dtype in dtypes:
args = cl_array.arange(context, queue, a, b, (b-a)/s,
> dtype=numpy.float32)
test/test_clmath.py:64:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
context = <pyopencl.Context at 0x16ee240 on <pyopencl.Device 'GeForce 8800 GTX'
at 0x1143050>>
queue = <pyopencl._cl.CommandQueue object at 0x1327680>
def arange(context, queue, *args, **kwargs):
"""Create an array filled with numbers spaced `step` apart,
starting from `start` and ending at `stop`.
For floating point arguments, the length of the result is
`ceil((stop - start)/step)`. This rule may result in the last
element of the result being greater than stop.
"""
# argument processing
-----------------------------------------------------
# Yuck. Thanks, numpy developers. ;)
from pytools import Record
class Info(Record):
pass
explicit_dtype = False
inf = Info()
inf.start = None
inf.stop = None
inf.step = None
inf.dtype = None
if isinstance(args[-1], numpy.dtype):
dtype = args[-1]
args = args[:-1]
explicit_dtype = True
argc = len(args)
if argc == 0:
raise ValueError, "stop argument required"
elif argc == 1:
inf.stop = args[0]
elif argc == 2:
inf.start = args[0]
inf.stop = args[1]
elif argc == 3:
inf.start = args[0]
inf.stop = args[1]
inf.step = args[2]
else:
raise ValueError, "too many arguments"
admissible_names = ["start", "stop", "step", "dtype"]
for k, v in kwargs.iteritems():
if k in admissible_names:
if getattr(inf, k) is None:
setattr(inf, k, v)
if k == "dtype":
explicit_dtype = True
else:
raise ValueError, "may not specify '%s' by position and
keyword" % k
else:
raise ValueError, "unexpected keyword argument '%s'" % k
if inf.start is None:
inf.start = 0
if inf.step is None:
inf.step = 1
if inf.dtype is None:
inf.dtype = numpy.array([inf.start, inf.stop, inf.step]).dtype
# actual functionality
----------------------------------------------------
dtype = numpy.dtype(inf.dtype)
start = dtype.type(inf.start)
step = dtype.type(inf.step)
stop = dtype.type(inf.stop)
if not explicit_dtype:
raise TypeError("arange requires dtype argument")
from math import ceil
> size = int(ceil((stop-start)/step))
E OverflowError: math range error
../../tmp/local/lib/python2.5/site-packages/pyopencl-0.92-py2.5-linux-x86_64.egg/pyopencl/array.py:621:
OverflowError
test_cos[ctx_getter=<context getter for <pyopencl.Device 'GeForce 8800 GTX' at
0x1143050>>]
ctx_getter = <pyopencl.tools.ContextGetter instance at 0x1180cf8>
def test(ctx_getter):
context = ctx_getter()
queue = cl.CommandQueue(context)
gpu_func = getattr(clmath, name)
cpu_func = getattr(numpy, numpy_func_names.get(name, name))
if has_double_support(context.devices[0]):
dtypes = [numpy.float32, numpy.float64]
else:
dtypes = [numpy.float32]
for s in sizes:
for dtype in dtypes:
args = cl_array.arange(context, queue, a, b, (b-a)/s,
> dtype=numpy.float32)
test/test_clmath.py:64:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
context = <pyopencl.Context at 0x1680060 on <pyopencl.Device 'GeForce 8800 GTX'
at 0x1143050>>
queue = <pyopencl._cl.CommandQueue object at 0x1330418>
def arange(context, queue, *args, **kwargs):
"""Create an array filled with numbers spaced `step` apart,
starting from `start` and ending at `stop`.
For floating point arguments, the length of the result is
`ceil((stop - start)/step)`. This rule may result in the last
element of the result being greater than stop.
"""
# argument processing
-----------------------------------------------------
# Yuck. Thanks, numpy developers. ;)
from pytools import Record
class Info(Record):
pass
explicit_dtype = False
inf = Info()
inf.start = None
inf.stop = None
inf.step = None
inf.dtype = None
if isinstance(args[-1], numpy.dtype):
dtype = args[-1]
args = args[:-1]
explicit_dtype = True
argc = len(args)
if argc == 0:
raise ValueError, "stop argument required"
elif argc == 1:
inf.stop = args[0]
elif argc == 2:
inf.start = args[0]
inf.stop = args[1]
elif argc == 3:
inf.start = args[0]
inf.stop = args[1]
inf.step = args[2]
else:
raise ValueError, "too many arguments"
admissible_names = ["start", "stop", "step", "dtype"]
for k, v in kwargs.iteritems():
if k in admissible_names:
if getattr(inf, k) is None:
setattr(inf, k, v)
if k == "dtype":
explicit_dtype = True
else:
raise ValueError, "may not specify '%s' by position and
keyword" % k
else:
raise ValueError, "unexpected keyword argument '%s'" % k
if inf.start is None:
inf.start = 0
if inf.step is None:
inf.step = 1
if inf.dtype is None:
inf.dtype = numpy.array([inf.start, inf.stop, inf.step]).dtype
# actual functionality
----------------------------------------------------
dtype = numpy.dtype(inf.dtype)
start = dtype.type(inf.start)
step = dtype.type(inf.step)
stop = dtype.type(inf.stop)
if not explicit_dtype:
raise TypeError("arange requires dtype argument")
from math import ceil
> size = int(ceil((stop-start)/step))
E OverflowError: math range error
../../tmp/local/lib/python2.5/site-packages/pyopencl-0.92-py2.5-linux-x86_64.egg/pyopencl/array.py:621:
OverflowError
test_ceil[ctx_getter=<context getter for <pyopencl.Device 'GeForce 8800 GTX'
at 0x1143050>>]
ctx_getter = <pyopencl.tools.ContextGetter instance at 0x1181488>
def test(ctx_getter):
context = ctx_getter()
queue = cl.CommandQueue(context)
gpu_func = getattr(clmath, name)
cpu_func = getattr(numpy, numpy_func_names.get(name, name))
if has_double_support(context.devices[0]):
dtypes = [numpy.float32, numpy.float64]
else:
dtypes = [numpy.float32]
for s in sizes:
for dtype in dtypes:
args = cl_array.arange(context, queue, a, b, (b-a)/s,
> dtype=numpy.float32)
test/test_clmath.py:64:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
context = <pyopencl.Context at 0x1b77070 on <pyopencl.Device 'GeForce 8800 GTX'
at 0x1143050>>
queue = <pyopencl._cl.CommandQueue object at 0x1330890>
def arange(context, queue, *args, **kwargs):
"""Create an array filled with numbers spaced `step` apart,
starting from `start` and ending at `stop`.
For floating point arguments, the length of the result is
`ceil((stop - start)/step)`. This rule may result in the last
element of the result being greater than stop.
"""
# argument processing
-----------------------------------------------------
# Yuck. Thanks, numpy developers. ;)
from pytools import Record
class Info(Record):
pass
explicit_dtype = False
inf = Info()
inf.start = None
inf.stop = None
inf.step = None
inf.dtype = None
if isinstance(args[-1], numpy.dtype):
dtype = args[-1]
args = args[:-1]
explicit_dtype = True
argc = len(args)
if argc == 0:
raise ValueError, "stop argument required"
elif argc == 1:
inf.stop = args[0]
elif argc == 2:
inf.start = args[0]
inf.stop = args[1]
elif argc == 3:
inf.start = args[0]
inf.stop = args[1]
inf.step = args[2]
else:
raise ValueError, "too many arguments"
admissible_names = ["start", "stop", "step", "dtype"]
for k, v in kwargs.iteritems():
if k in admissible_names:
if getattr(inf, k) is None:
setattr(inf, k, v)
if k == "dtype":
explicit_dtype = True
else:
raise ValueError, "may not specify '%s' by position and
keyword" % k
else:
raise ValueError, "unexpected keyword argument '%s'" % k
if inf.start is None:
inf.start = 0
if inf.step is None:
inf.step = 1
if inf.dtype is None:
inf.dtype = numpy.array([inf.start, inf.stop, inf.step]).dtype
# actual functionality
----------------------------------------------------
dtype = numpy.dtype(inf.dtype)
start = dtype.type(inf.start)
step = dtype.type(inf.step)
stop = dtype.type(inf.stop)
if not explicit_dtype:
raise TypeError("arange requires dtype argument")
from math import ceil
> size = int(ceil((stop-start)/step))
E OverflowError: math range error
../../tmp/local/lib/python2.5/site-packages/pyopencl-0.92-py2.5-linux-x86_64.egg/pyopencl/array.py:621:
OverflowError
test_tanh[ctx_getter=<context getter for <pyopencl.Device 'GeForce 8800 GTX'
at 0x1143050>>]
ctx_getter = <pyopencl.tools.ContextGetter instance at 0x105b248>
def test(ctx_getter):
context = ctx_getter()
queue = cl.CommandQueue(context)
gpu_func = getattr(clmath, name)
cpu_func = getattr(numpy, numpy_func_names.get(name, name))
if has_double_support(context.devices[0]):
dtypes = [numpy.float32, numpy.float64]
else:
dtypes = [numpy.float32]
for s in sizes:
for dtype in dtypes:
args = cl_array.arange(context, queue, a, b, (b-a)/s,
> dtype=numpy.float32)
test/test_clmath.py:64:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
context = <pyopencl.Context at 0x1978d10 on <pyopencl.Device 'GeForce 8800 GTX'
at 0x1143050>>
queue = <pyopencl._cl.CommandQueue object at 0x1327520>
def arange(context, queue, *args, **kwargs):
"""Create an array filled with numbers spaced `step` apart,
starting from `start` and ending at `stop`.
For floating point arguments, the length of the result is
`ceil((stop - start)/step)`. This rule may result in the last
element of the result being greater than stop.
"""
# argument processing
-----------------------------------------------------
# Yuck. Thanks, numpy developers. ;)
from pytools import Record
class Info(Record):
pass
explicit_dtype = False
inf = Info()
inf.start = None
inf.stop = None
inf.step = None
inf.dtype = None
if isinstance(args[-1], numpy.dtype):
dtype = args[-1]
args = args[:-1]
explicit_dtype = True
argc = len(args)
if argc == 0:
raise ValueError, "stop argument required"
elif argc == 1:
inf.stop = args[0]
elif argc == 2:
inf.start = args[0]
inf.stop = args[1]
elif argc == 3:
inf.start = args[0]
inf.stop = args[1]
inf.step = args[2]
else:
raise ValueError, "too many arguments"
admissible_names = ["start", "stop", "step", "dtype"]
for k, v in kwargs.iteritems():
if k in admissible_names:
if getattr(inf, k) is None:
setattr(inf, k, v)
if k == "dtype":
explicit_dtype = True
else:
raise ValueError, "may not specify '%s' by position and
keyword" % k
else:
raise ValueError, "unexpected keyword argument '%s'" % k
if inf.start is None:
inf.start = 0
if inf.step is None:
inf.step = 1
if inf.dtype is None:
inf.dtype = numpy.array([inf.start, inf.stop, inf.step]).dtype
# actual functionality
----------------------------------------------------
dtype = numpy.dtype(inf.dtype)
start = dtype.type(inf.start)
step = dtype.type(inf.step)
stop = dtype.type(inf.stop)
if not explicit_dtype:
raise TypeError("arange requires dtype argument")
from math import ceil
> size = int(ceil((stop-start)/step))
E OverflowError: math range error
../../tmp/local/lib/python2.5/site-packages/pyopencl-0.92-py2.5-linux-x86_64.egg/pyopencl/array.py:621:
OverflowError
test_fabs[ctx_getter=<context getter for <pyopencl.Device 'GeForce 8800 GTX'
at 0x1143050>>]
ctx_getter = <pyopencl.tools.ContextGetter instance at 0x1180c20>
def test(ctx_getter):
context = ctx_getter()
queue = cl.CommandQueue(context)
gpu_func = getattr(clmath, name)
cpu_func = getattr(numpy, numpy_func_names.get(name, name))
if has_double_support(context.devices[0]):
dtypes = [numpy.float32, numpy.float64]
else:
dtypes = [numpy.float32]
for s in sizes:
for dtype in dtypes:
args = cl_array.arange(context, queue, a, b, (b-a)/s,
> dtype=numpy.float32)
test/test_clmath.py:64:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
context = <pyopencl.Context at 0x18dadf0 on <pyopencl.Device 'GeForce 8800 GTX'
at 0x1143050>>
queue = <pyopencl._cl.CommandQueue object at 0x1330db8>
def arange(context, queue, *args, **kwargs):
"""Create an array filled with numbers spaced `step` apart,
starting from `start` and ending at `stop`.
For floating point arguments, the length of the result is
`ceil((stop - start)/step)`. This rule may result in the last
element of the result being greater than stop.
"""
# argument processing
-----------------------------------------------------
# Yuck. Thanks, numpy developers. ;)
from pytools import Record
class Info(Record):
pass
explicit_dtype = False
inf = Info()
inf.start = None
inf.stop = None
inf.step = None
inf.dtype = None
if isinstance(args[-1], numpy.dtype):
dtype = args[-1]
args = args[:-1]
explicit_dtype = True
argc = len(args)
if argc == 0:
raise ValueError, "stop argument required"
elif argc == 1:
inf.stop = args[0]
elif argc == 2:
inf.start = args[0]
inf.stop = args[1]
elif argc == 3:
inf.start = args[0]
inf.stop = args[1]
inf.step = args[2]
else:
raise ValueError, "too many arguments"
admissible_names = ["start", "stop", "step", "dtype"]
for k, v in kwargs.iteritems():
if k in admissible_names:
if getattr(inf, k) is None:
setattr(inf, k, v)
if k == "dtype":
explicit_dtype = True
else:
raise ValueError, "may not specify '%s' by position and
keyword" % k
else:
raise ValueError, "unexpected keyword argument '%s'" % k
if inf.start is None:
inf.start = 0
if inf.step is None:
inf.step = 1
if inf.dtype is None:
inf.dtype = numpy.array([inf.start, inf.stop, inf.step]).dtype
# actual functionality
----------------------------------------------------
dtype = numpy.dtype(inf.dtype)
start = dtype.type(inf.start)
step = dtype.type(inf.step)
stop = dtype.type(inf.stop)
if not explicit_dtype:
raise TypeError("arange requires dtype argument")
from math import ceil
> size = int(ceil((stop-start)/step))
E OverflowError: math range error
../../tmp/local/lib/python2.5/site-packages/pyopencl-0.92-py2.5-linux-x86_64.egg/pyopencl/array.py:621:
OverflowError
test_atan[ctx_getter=<context getter for <pyopencl.Device 'GeForce 8800 GTX'
at 0x1143050>>]
ctx_getter = <pyopencl.tools.ContextGetter instance at 0x11800e0>
def test(ctx_getter):
context = ctx_getter()
queue = cl.CommandQueue(context)
gpu_func = getattr(clmath, name)
cpu_func = getattr(numpy, numpy_func_names.get(name, name))
if has_double_support(context.devices[0]):
dtypes = [numpy.float32, numpy.float64]
else:
dtypes = [numpy.float32]
for s in sizes:
for dtype in dtypes:
args = cl_array.arange(context, queue, a, b, (b-a)/s,
> dtype=numpy.float32)
test/test_clmath.py:64:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
context = <pyopencl.Context at 0x13b62f0 on <pyopencl.Device 'GeForce 8800 GTX'
at 0x1143050>>
queue = <pyopencl._cl.CommandQueue object at 0x1344310>
def arange(context, queue, *args, **kwargs):
"""Create an array filled with numbers spaced `step` apart,
starting from `start` and ending at `stop`.
For floating point arguments, the length of the result is
`ceil((stop - start)/step)`. This rule may result in the last
element of the result being greater than stop.
"""
# argument processing
-----------------------------------------------------
# Yuck. Thanks, numpy developers. ;)
from pytools import Record
class Info(Record):
pass
explicit_dtype = False
inf = Info()
inf.start = None
inf.stop = None
inf.step = None
inf.dtype = None
if isinstance(args[-1], numpy.dtype):
dtype = args[-1]
args = args[:-1]
explicit_dtype = True
argc = len(args)
if argc == 0:
raise ValueError, "stop argument required"
elif argc == 1:
inf.stop = args[0]
elif argc == 2:
inf.start = args[0]
inf.stop = args[1]
elif argc == 3:
inf.start = args[0]
inf.stop = args[1]
inf.step = args[2]
else:
raise ValueError, "too many arguments"
admissible_names = ["start", "stop", "step", "dtype"]
for k, v in kwargs.iteritems():
if k in admissible_names:
if getattr(inf, k) is None:
setattr(inf, k, v)
if k == "dtype":
explicit_dtype = True
else:
raise ValueError, "may not specify '%s' by position and
keyword" % k
else:
raise ValueError, "unexpected keyword argument '%s'" % k
if inf.start is None:
inf.start = 0
if inf.step is None:
inf.step = 1
if inf.dtype is None:
inf.dtype = numpy.array([inf.start, inf.stop, inf.step]).dtype
# actual functionality
----------------------------------------------------
dtype = numpy.dtype(inf.dtype)
start = dtype.type(inf.start)
step = dtype.type(inf.step)
stop = dtype.type(inf.stop)
if not explicit_dtype:
raise TypeError("arange requires dtype argument")
from math import ceil
> size = int(ceil((stop-start)/step))
E OverflowError: math range error
../../tmp/local/lib/python2.5/site-packages/pyopencl-0.92-py2.5-linux-x86_64.egg/pyopencl/array.py:621:
OverflowError
test_floor[ctx_getter=<context getter for <pyopencl.Device 'GeForce 8800 GTX'
at 0x1143050>>]
ctx_getter = <pyopencl.tools.ContextGetter instance at 0x117db00>
def test(ctx_getter):
context = ctx_getter()
queue = cl.CommandQueue(context)
gpu_func = getattr(clmath, name)
cpu_func = getattr(numpy, numpy_func_names.get(name, name))
if has_double_support(context.devices[0]):
dtypes = [numpy.float32, numpy.float64]
else:
dtypes = [numpy.float32]
for s in sizes:
for dtype in dtypes:
args = cl_array.arange(context, queue, a, b, (b-a)/s,
> dtype=numpy.float32)
test/test_clmath.py:64:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
context = <pyopencl.Context at 0x148a940 on <pyopencl.Device 'GeForce 8800 GTX'
at 0x1143050>>
queue = <pyopencl._cl.CommandQueue object at 0x1344578>
def arange(context, queue, *args, **kwargs):
"""Create an array filled with numbers spaced `step` apart,
starting from `start` and ending at `stop`.
For floating point arguments, the length of the result is
`ceil((stop - start)/step)`. This rule may result in the last
element of the result being greater than stop.
"""
# argument processing
-----------------------------------------------------
# Yuck. Thanks, numpy developers. ;)
from pytools import Record
class Info(Record):
pass
explicit_dtype = False
inf = Info()
inf.start = None
inf.stop = None
inf.step = None
inf.dtype = None
if isinstance(args[-1], numpy.dtype):
dtype = args[-1]
args = args[:-1]
explicit_dtype = True
argc = len(args)
if argc == 0:
raise ValueError, "stop argument required"
elif argc == 1:
inf.stop = args[0]
elif argc == 2:
inf.start = args[0]
inf.stop = args[1]
elif argc == 3:
inf.start = args[0]
inf.stop = args[1]
inf.step = args[2]
else:
raise ValueError, "too many arguments"
admissible_names = ["start", "stop", "step", "dtype"]
for k, v in kwargs.iteritems():
if k in admissible_names:
if getattr(inf, k) is None:
setattr(inf, k, v)
if k == "dtype":
explicit_dtype = True
else:
raise ValueError, "may not specify '%s' by position and
keyword" % k
else:
raise ValueError, "unexpected keyword argument '%s'" % k
if inf.start is None:
inf.start = 0
if inf.step is None:
inf.step = 1
if inf.dtype is None:
inf.dtype = numpy.array([inf.start, inf.stop, inf.step]).dtype
# actual functionality
----------------------------------------------------
dtype = numpy.dtype(inf.dtype)
start = dtype.type(inf.start)
step = dtype.type(inf.step)
stop = dtype.type(inf.stop)
if not explicit_dtype:
raise TypeError("arange requires dtype argument")
from math import ceil
> size = int(ceil((stop-start)/step))
E OverflowError: math range error
../../tmp/local/lib/python2.5/site-packages/pyopencl-0.92-py2.5-linux-x86_64.egg/pyopencl/array.py:621:
OverflowError
===================== 10 failed, 10 passed in 6.34 seconds =====================
============================= test session starts ==============================
platform linux2 -- Python 2.5.2 -- pytest-1.3.4
test path 1: ./test/test_wrapper.py
test/test_wrapper.py ============================= test session starts
==============================
platform linux2 -- Python 2.5.2 -- pytest-1.3.4
test path 1: ./test/test_array.py
test/test_array.py .....................
========================== 21 passed in 14.90 seconds ==========================
--
Paul Ivanov
314 address only used for lists, off-list direct email at:
http://pirsquared.org | GPG/PGP key id: 0x0F3E28F7
_______________________________________________
PyOpenCL mailing list
[email protected]
http://lists.tiker.net/listinfo/pyopencl