Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Vectorize decorator stopped working for dpex #807

Closed
diptorupd opened this issue Oct 19, 2022 · 1 comment
Closed

Vectorize decorator stopped working for dpex #807

diptorupd opened this issue Oct 19, 2022 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@diptorupd
Copy link
Contributor

The vectorize decorator no longer works for dpex. Here is the reproducer:


import dpctl
import numpy as np
from numba import float64, vectorize


@vectorize(nopython=True)
def ufunc_kernel(x, y):
    return x + y


def get_device():
    device = None
    try:
        device = dpctl.select_gpu_device()
    except:
        try:
            device = dpctl.select_cpu_device()
        except:
            raise RuntimeError("No device found")
    return device


def test_njit():
    N = 10
    dtype = np.float64

    A = np.arange(N, dtype=dtype)
    B = np.arange(N, dtype=dtype) * 10

    # Use the environment variable SYCL_DEVICE_FILTER to change the default device.
    # See https://github.com/intel/llvm/blob/sycl/sycl/doc/EnvironmentVariables.md#sycl_device_filter.
    device = dpctl.select_default_device()
    print("Using device ...")
    device.print_device_info()

    with dpctl.device_context(device):
        C = ufunc_kernel(A, B)

    print(C)

    print("Done...")


@vectorize([float64(float64, float64)], target="dpex")
def vector_add(a, b):
    return a + b


def test_vectorize():
    A = np.arange(10, dtype=np.float64).reshape((5, 2))
    B = np.arange(10, dtype=np.float64).reshape((5, 2))

    device = dpctl.select_default_device()
    with dpctl.device_context(device):
        C = vector_add(A, B)

    print(C)


if __name__ == "__main__":
    test_njit()
    test_vectorize()

@diptorupd
Copy link
Contributor Author

The broken vectorize feature was fully removed from numba-dpex in #1298. I am closing this issue in favour of #1299. We will use #1299 to track the redevelopment of the vectorize feature in future.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant