tags:

views:

51

answers:

2

is it better to use a float instead of an int in cuda? does a float decrease bank conflicts and insures coalescence? or it has nothing to do with this?

+2  A: 

Bank conflicts when reading shared memory are all about the amount of data read. So, since int and float are the same size (at least I think they are on all CUDA platforms), there's no difference.

Coalescence usually refers to global memory accesses - and again, this is to do with the number of bytes read, not the datatype.

Edric
A: 

Both int and float are four bytes, so it doesn't make any difference (if you're accessing them both the same way) which you use in terms of coalescing your global memory accesses or bank conflicts on shared memory accesses.

Having said that, you may have better performance with floats since the devices are designed to crunch them as fast as possible, ints are often used for control and indexes etc. and hence have lower performance. Of course it's really more complicated than that - if you had nothing but floats then the integer hardware would sit idle which would be a waste.

Tom