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

Add set operation functions #4

Closed
pavanky opened this issue Oct 29, 2014 · 7 comments · Fixed by #43
Closed

Add set operation functions #4

pavanky opened this issue Oct 29, 2014 · 7 comments · Fixed by #43
Assignees
Labels
Milestone

Comments

@pavanky
Copy link
Member

pavanky commented Oct 29, 2014

  • setunique
  • setunion
  • setintersect
@pavanky pavanky self-assigned this Oct 29, 2014
@kylelutz
Copy link
Contributor

kylelutz commented Nov 1, 2014

Boost.Compute has these algorithms implemented for OpenCL:

Let me know if you need help integrating them.

@pavanky
Copy link
Member Author

pavanky commented Nov 3, 2014

@kylelutz I think ArrayFire's behavior for set operations is slightly different from Boost.Compute. Let me have a look and see if they can be made compatible.

@pavanky
Copy link
Member Author

pavanky commented Nov 3, 2014

@kylelutz Do set_union and set_intersection require the inputs to be sorted ?

@kylelutz
Copy link
Contributor

kylelutz commented Nov 3, 2014

Yeah, they have the same behavior and requirements as the standard C++ algorithms (std::set_union() / std::set_intersection()).

@pavanky
Copy link
Member Author

pavanky commented Nov 3, 2014

@kylelutz All the set operations have two APIs like this:

AFAPI array setunique(const array& input);
AFAPI void setunique(array& values, array& indices, array& locations, const array& input);

ArrayFire does not expect the inputs to be sorted, so the input needs to be sorted internally. We can extend the API to include a default parameter bool isSorted=false. This way user can optionally turn off the internal sort.

For the first API we can use std (for CPU), thrust (for CUDA) and Boost.Compute (for OpenCL).
For the second API we can write the code using existing ArrayFire functions.

If you are interested in contributing code, I can create the skeleton and implement the CUDA and CPU backends and leave the OpenCL backend for you.

@kylelutz
Copy link
Contributor

kylelutz commented Nov 3, 2014

I'd be happy to! Probably won't be too much work.

@pavanky
Copy link
Member Author

pavanky commented Nov 4, 2014

@kylelutz I just pushed the skeleton and CPU implementation to the "set" branch. Let me know if you want to work on the OpenCL backend for these three functions.

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

Successfully merging a pull request may close this issue.

2 participants