Doubt about "shuffle" algorithm

Hi,

I’ve been studying parallel computing (and CUDA) for the past couple days , the main kind of examples I read is the “add vectors kind” , but I’m wonder about how to implement a algorithm that generate all the possible combination for a 4 numbers array

Thanks,

How does the title relate to your question? Are you attempting to use the __shfl() for your algorithm?

Sorry I wasn’t very clear. What I meant was, for example, I have a array {“1”,“2”,“3”,4",“5”} , I would like to know if there is a way of listing every possible combination of these numbers on CUDA way.

This is easy to do with CUDA, both for combinations and permutations of an array. I have already written and posted the code for both, so you can take it from there.

for combinations:

https://github.com/OlegKonings/CUDA_ALL_SUBSETS

for permutations:

https://github.com/OlegKonings/CUDA_next_permutation

‘there is one thing we do know: that man is here for the sake of other men’