Exemple #1
0
def binop(lhs, rhs, op, out_dtype):
    nvtx_range_push("PYGDF_BINARY_OP", "orange")
    masked = lhs.has_null_mask or rhs.has_null_mask
    out = columnops.column_empty_like(lhs, dtype=out_dtype, masked=masked)
    null_count = _gdf.apply_binaryop(op, lhs, rhs, out)
    out = out.replace(null_count=null_count)
    nvtx_range_pop()
    return out
Exemple #2
0
def numeric_column_binop(lhs, rhs, op, out_dtype):
    if lhs.dtype != rhs.dtype:
        raise TypeError('{} != {}'.format(lhs.dtype, rhs.dtype))

    nvtx_range_push("PYGDF_BINARY_OP", "orange")
    # Allocate output
    masked = lhs.has_null_mask or rhs.has_null_mask
    out = columnops.column_empty_like(lhs, dtype=out_dtype, masked=masked)
    # Call and fix null_count
    null_count = _gdf.apply_binaryop(op, lhs, rhs, out)
    out = out.replace(null_count=null_count)
    result = out.view(NumericalColumn, dtype=out_dtype)
    nvtx_range_pop()
    return result
Exemple #3
0
def numeric_column_binop(lhs, rhs, op, out_dtype):
    nvtx_range_push("CUDF_BINARY_OP", "orange")
    # Allocate output
    masked = lhs.has_null_mask or rhs.has_null_mask
    out = columnops.column_empty_like(lhs, dtype=out_dtype, masked=masked)
    # Call and fix null_count
    if lhs.dtype != rhs.dtype or op not in _binary_impl:
        # Use JIT implementation
        null_count = cpp_binops.apply_op(lhs=lhs, rhs=rhs, out=out, op=op)
    else:
        # Use compiled implementation
        null_count = _gdf.apply_binaryop(_binary_impl[op], lhs, rhs, out)

    out = out.replace(null_count=null_count)
    result = out.view(NumericalColumn, dtype=out_dtype)
    nvtx_range_pop()
    return result