i'm a newbie general questions about cuda

Hello, i have to optimize a code but i’ve no experience in cuda developing. i was wondering what are the situations in which i should launch parallel threads. as i’ve seen in some examples all the threads have the same code and for this reason it seems to me that we can launch kernel only when our problem is divisible in identical subproblems (divide et impera). am i right or do you think there are other situations (indeterminism or something else) in which is recommendable to launch parallel computation?
thanks for your help

It is all situations where you should launch parallel threads. If the code has no parallelism, you shouldn’t be running it on a GPU. The potential performance gains that can be had with GPUs are because multiple threads can execute the same code concurrently, and defining more threads that can run simultaneously allows the hardware to hide the latency associated with global memory references to gain very large speed-ups.

You can assign different work to different blocks. But to evaluate when it is advisable to use parallelization at all is something that you can probably learn best from a good book. The power of CUDA is best harnessed in processing data-parallel problems, though.