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

Precedence of with statement versus njit kwargs #318

Closed
hameerabbasi opened this issue Aug 11, 2020 · 1 comment
Closed

Precedence of with statement versus njit kwargs #318

hameerabbasi opened this issue Aug 11, 2020 · 1 comment

Comments

@hameerabbasi
Copy link

There is one side-effect of with statements: Their effects propagate down the call stack, even into library code. Consider the following code:

# In library.py
@njit(parallel=False)
def library_func(...):
    ...

# In user.py
with dppl.device_context(gpu):
    ...
    library_func(...)
    ...

In this case, if the with statement is preferred, the library loses control of what's executed inside library_func . Raising an error is okay, IMO, but for this reason, we shouldn't prefer what the with statement says.

Personally, I'd be okay with changing the default value of parallel to parallel=unspecified.

@diptorupd diptorupd transferred this issue from IntelPython/dpctl Apr 16, 2021
@diptorupd
Copy link
Collaborator

The design of numba-dpex has been changed to follow the Python Array API's compute-follows-data programming model. As such, the device_context is no longer used to specify the offload device. All offload decisions are handled at the typing phase based on whether the jit function is operating on dpnp arrays that have a queue attribute.

Closing as the issue is no longer relevant.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants