Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 23 additions & 17 deletions numba_dpex/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,30 +6,36 @@
The numba-dpex extension module adds data-parallel offload support to Numba.
"""

import numba_dpex.core.dpjit_dispatcher
import numba_dpex.core.offload_dispatcher
from numba.np.ufunc import array_exprs

# Initialize the _dpexrt_python extension
import numba_dpex.core.runtime
import numba_dpex.core.targets.dpjit_target
from .numba_patches.patch_is_ufunc import _dpex_is_ufunc

# Re-export types itself
import numba_dpex.core.types as types
from numba_dpex.core.kernel_interface.indexers import NdRange, Range
array_exprs._is_ufunc = _dpex_is_ufunc

# Re-export all type names
from numba_dpex.core.types import *
from numba_dpex.retarget import offload_to_sycl_device
if True: # noqa: E402
import numba_dpex.core.dpjit_dispatcher
import numba_dpex.core.offload_dispatcher

from . import config
# Initialize the _dpexrt_python extension
import numba_dpex.core.runtime
import numba_dpex.core.targets.dpjit_target

if config.HAS_NON_HOST_DEVICE:
from .device_init import *
else:
raise ImportError("No non-host SYCL device found to execute kernels.")
# Re-export types itself
import numba_dpex.core.types as types
from numba_dpex.core.kernel_interface.indexers import NdRange, Range

# Re-export all type names
from numba_dpex.core.types import *
from numba_dpex.retarget import offload_to_sycl_device

from ._version import get_versions
from . import config

if config.HAS_NON_HOST_DEVICE:
from .device_init import *
else:
raise ImportError("No non-host SYCL device found to execute kernels.")

from ._version import get_versions

__version__ = get_versions()["version"]
del get_versions
Expand Down
3 changes: 3 additions & 0 deletions numba_dpex/numba_patches/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# SPDX-FileCopyrightText: 2020 - 2023 Intel Corporation
#
# SPDX-License-Identifier: Apache-2.0
13 changes: 13 additions & 0 deletions numba_dpex/numba_patches/patch_is_ufunc.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# SPDX-FileCopyrightText: 2020 - 2023 Intel Corporation
#
# SPDX-License-Identifier: Apache-2.0


import numpy as np
from numba.np.ufunc.dufunc import DUFunc


def _dpex_is_ufunc(func):
return isinstance(func, (np.ufunc, DUFunc)) or hasattr(
func, "is_dpnp_ufunc"
)