0

I have several int arrays which I need to check against each other, to check for duplicates. Since I wanted to avoid having to loop through each of the arrays, and checking each element of the array against every element of the other arrays, I wanted to use a hash function to generate and identifier for each of the arrays. I have used hash_combine in the past for generating such identifier, but I can't seem to find similar functions for use in CUDA. I am using thrust but I haven't found anything similar. Does thrust have such functions, or would you suggest any other method for validating the existance of duplicates?

Blacktempel
  • 3,935
  • 3
  • 29
  • 53
Miguel Mesquita Alfaiate
  • 2,851
  • 5
  • 30
  • 56
  • I don't think CUDA aims to support hash tables. I see many efficiency issues here... CUDA leans its efficiency on threads doing similar stuff. I can imagine CUDA kernel to count hashes for the array, it would be impractical to create a collection such as hashset or hashmap reside on the graphics card. Maybe this is why you have problem with finding the appropriate function... – W.F. Mar 11 '15 at 10:43
  • I have a easy way,but not perfect.The array average is divided into several blocks, random sampling of several elements in each block, composed of Hash values using these feature elements – Ron Tang Mar 11 '15 at 10:43
  • @WojciechFrohmberg Do you suggest any other approach? I could make CUDA go through each and every element of every array, but that surely has efficiency issues too... – Miguel Mesquita Alfaiate Mar 11 '15 at 10:53
  • @RonTang What do you mean by hash values? How can I generate an hash with cuda / thrust? Using some binary operator or something like that? – Miguel Mesquita Alfaiate Mar 11 '15 at 10:55
  • I suggest that if you just need to perform hashing on your array and then throw the hashvalue back to the host it might be efficient. It depends on the array size etc. – W.F. Mar 11 '15 at 10:56
  • I don't see practical application of hashes on the collection that resides on graphics cards though. – W.F. Mar 11 '15 at 10:58
  • @WojciechFrohmberg Does Cuda / thrust have such type of functions, or would I have to implement an hashing function? Hashing several arrays in the GPU allows me to generate their hashes faster, since I have more parallelism in the GPU. – Miguel Mesquita Alfaiate Mar 11 '15 at 11:00
  • you might be interested in this: http://www.golubev.com/hashgpu.htm – W.F. Mar 11 '15 at 11:05
  • @WojciechFrohmberg that is an executable program, I was after some directions or code samples. I found this: https://code.google.com/p/cuda-thrust-extensions/source/browse/trunk/hash%20map/template/hash_map_template.h?r=8 so I will try to do something based on that. – Miguel Mesquita Alfaiate Mar 11 '15 at 11:18
  • @BlunT I don't familiar with CUDA, just a idea for you.I hope can help you. – Ron Tang Mar 11 '15 at 11:30

0 Answers0