pygpu package

pygpu.gpuarray module

pygpu.elemwise module

class pygpu.elemwise.GpuElemwise
class pygpu.elemwise.arg
name
read
scalar
type
write
pygpu.elemwise.as_argument(o, name, read=False, write=False)
pygpu.elemwise.compare(a, op, b, broadcast=False, convert_f16=True)
pygpu.elemwise.elemwise1(a, op, oper=None, op_tmpl='res = %(op)sa', out=None, convert_f16=True)
pygpu.elemwise.elemwise2(a, op, b, ary, odtype=None, oper=None, op_tmpl='res = (%(out_t)s)a %(op)s (%(out_t)s)b', broadcast=False, convert_f16=True)
pygpu.elemwise.ielemwise2(a, op, b, oper=None, op_tmpl='a = a %(op)s b', broadcast=False, convert_f16=True)

pygpu.operations module

pygpu.reduction module

pygpu.blas module

pygpu.collectives module

pygpu.dtypes module

Type mapping helpers.

pygpu.dtypes.dtype_to_ctype(dtype)

Return the C type that corresponds to dtype.

Parameters:

dtype (data type) – a numpy dtype

pygpu.dtypes.get_common_dtype(obj1, obj2, allow_double)

Returns the proper output type for a numpy operation involving the two provided objects. This may not be suitable for certain obscure numpy operations.

If allow_double is False, a return type of float64 will be forced to float32 and complex128 will be forced to complex64.

pygpu.dtypes.get_np_obj(obj)

Returns a numpy object of the same dtype and comportement as the source suitable for output dtype determination.

This is used since the casting rules of numpy are rather obscure and the best way to imitate them is to try an operation ans see what it does.

pygpu.dtypes.parse_c_arg_backend(c_arg, scalar_arg_class, vec_arg_class)
pygpu.dtypes.register_dtype(dtype, c_names)

Associate a numpy dtype with its C equivalents.

Will register dtype for use with the gpuarray module. If the c_names argument is a list then the first element of that list is taken as the primary association and will be used for generated C code. The other types will be mapped to the provided dtype when going in the other direction.

Parameters:
  • dtype (numpy.dtype or string) – type to associate

  • c_names (str or list) – list of C type names

pygpu.dtypes.upcast(*args)

pygpu.tools module

Module contents