コード例 #1
0
ファイル: cumath.py プロジェクト: thecobb/PyCUDA
def modf(arg, stream=None):
    """Return a tuple `(fracpart, intpart)` of arrays containing the
    integer and fractional parts of `arg`. 
    """

    intpart = gpuarray.GPUArray(arg.shape, arg.dtype)
    fracpart = gpuarray.GPUArray(arg.shape, arg.dtype)

    func = elementwise.get_modf_kernel()
    func.set_block_shape(*arg._block),
    func.prepared_async_call(arg._grid, stream, arg.gpudata, intpart.gpudata,
                             fracpart.gpudata, arg.mem_size)

    return fracpart, intpart
コード例 #2
0
ファイル: cumath.py プロジェクト: spatel81/pycuda
def modf(arg, stream=None):
    """Return a tuple `(fracpart, intpart)` of arrays containing the
    integer and fractional parts of `arg`.
    """

    intpart = gpuarray.GPUArray(arg.shape, arg.dtype)
    fracpart = gpuarray.GPUArray(arg.shape, arg.dtype)

    func = elementwise.get_modf_kernel()
    func.set_block_shape(*arg._block),
    func.prepared_async_call(arg._grid, stream,
            arg.gpudata, intpart.gpudata, fracpart.gpudata,
            arg.mem_size)

    return fracpart, intpart
コード例 #3
0
ファイル: cumath.py プロジェクト: hvcl-old/Vivaldi
def modf(arg, stream=None):
    """Return a tuple `(fracpart, intpart)` of arrays containing the
    integer and fractional parts of `arg`.
    """
    if not arg.flags.forc:
        raise RuntimeError("only contiguous arrays may "
                           "be used as arguments to this operation")

    intpart = gpuarray.GPUArray(arg.shape, arg.dtype)
    fracpart = gpuarray.GPUArray(arg.shape, arg.dtype)

    func = elementwise.get_modf_kernel()
    func.prepared_async_call(arg._grid, arg._block, stream, arg.gpudata,
                             intpart.gpudata, fracpart.gpudata, arg.mem_size)

    return fracpart, intpart
コード例 #4
0
ファイル: cumath.py プロジェクト: DirkHaehnel/pycuda
def modf(arg, stream=None):
    """Return a tuple `(fracpart, intpart)` of arrays containing the
    integer and fractional parts of `arg`.
    """
    if not arg.flags.forc:
        raise RuntimeError("only contiguous arrays may "
                "be used as arguments to this operation")

    intpart = gpuarray.GPUArray(arg.shape, arg.dtype)
    fracpart = gpuarray.GPUArray(arg.shape, arg.dtype)

    func = elementwise.get_modf_kernel()
    func.prepared_async_call(arg._grid, arg._block, stream,
            arg.gpudata, intpart.gpudata, fracpart.gpudata,
            arg.mem_size)

    return fracpart, intpart