As far as I know I can use C++ templates in CUDA device code. So If i’m using map to create a dictionary will the operation of inserting new values be atomic?
I want to count the number of appearances of a certain values, i.e. create a code-dictionary with probabilities of the codes.
Thanks
Macs
You cannot use STL within device code. You could check thrust for similar functionality (check the experimental namespace in particular).
Templates are fine in device code, CUDA C currently supports quite a few C++ features although some of the big ones such as virtual functions and exceptions are not yet possible ( and will only be possible on Fermi hardware).
If you decide to implement this yourself, you can use the atomicAdd() intrinsic to get an atomic operation, check out the CUDA Programming Guide for more information.