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

binary operations make a bool array #275

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Conversation

brumen
Copy link

@brumen brumen commented Mar 12, 2021

I feel binary operations should make a bool GPUarray, not the same as before.

@inducer
Copy link
Owner

inducer commented Mar 12, 2021

I feel like you might be misunderstanding something here... "binary" operator refers to "having two operands", i.e. "a+b". A unary operator is one with one operand, e.g. "-a".

@brumen
Copy link
Author

brumen commented Mar 12, 2021

Sorry, I wasn't precise enough - the function _make_binary_op is used only for comparison operators in gpuarray.py, (<, == , etc.) Shouldn't the output of that operation be a bool array?

@inducer
Copy link
Owner

inducer commented Mar 13, 2021

Gitlab sister MR for CI: https://gitlab.tiker.net/inducer/pycuda/-/merge_requests/47

@brumen
Copy link
Author

brumen commented Mar 14, 2021

One more question (i dont know if this is the relevant medium): Have you considered implementing GPUArrays for object dtypes? At least for example for subclasses of Enum?

@inducer
Copy link
Owner

inducer commented Mar 14, 2021

In general, make new issues for separate topics. (Spoiler alert: object arrays aren't happening. They're tied to the Python runtime, which doesn't exist on the GPU. Enums are more likely, but only if you can find a way to map them into the numpy type system.)

@inducer
Copy link
Owner

inducer commented Mar 14, 2021

Instead of hardcoding a bool return type to the (previously general) _make_binary_op, add an optional force_return_dtype=None argument.

@brumen
Copy link
Author

brumen commented Mar 14, 2021

Sure, I'll make another pull request tomorrow.

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

Successfully merging this pull request may close these issues.

2 participants