Skip to content
This repository has been archived by the owner on Jan 25, 2023. It is now read-only.

Add initial version of ufunc tests #21

Open
wants to merge 8 commits into
base: pydppl
Choose a base branch
from
Open

Conversation

1e-to
Copy link

@1e-to 1e-to commented Aug 18, 2020

No description provided.


input_types = (input_type,) * ufunc.nin
output_types = (output_type,) * ufunc.nout
cfunc = dppl.kernel(pyfunc)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We are supposed to test the numpy compatibility for numba.njit(parallel:{'offload':True}) as well

continue

output_type = self._determine_output_type(
input_type, int_output_type, float_output_type)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The issue with testing some functions (e.g. sin, cos) for integer is the incompatibility of the dtype of the output buffer we pass and the actual output. For integer input we need a float type output for function like cos. We need to make changes in _determine_output_type() to accomodate this.

enable_pyobj_flags.set("no_rewrites")

no_pyobj_flags = Flags()
no_pyobj_flags.set("no_rewrites")
Copy link

@reazulhoque reazulhoque Sep 1, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This flag might prevent rewrite of numpy calls to array expressions, which in turn will prevent us from generating parfor nodes. The parfor nodes trigger the gpu code generation.

@1e-to
Copy link
Author

1e-to commented Sep 2, 2020

@reazulhoque I fixed all according your comments, could you please take a look?

input_types = (input_type,) * ufunc.nin
output_types = (output_type,) * ufunc.nout
cfunc_kernel = dppl.kernel(pyfunc)
cfunc = njit(parallel={'offload':True})(pyfunc)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately numba is not rewriting this ufuncs as array expression because the output argument is being provided. (https://github.com/IntelPython/numba/blob/pydppl/numba/np/ufunc/array_exprs.py#L88)

We need to find a solution to this as without the ufuncs being rewritten as array expression we will not generate a parfor node and in turn will not create a GPU kernel for it.

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

Successfully merging this pull request may close these issues.

2 participants