beginner cuda question sequential programming


  I would like to know if there is a way to program a simple sequential array addition in cuda without it doing parallel calculations, IE think of a simple for loop on a x86 architecture with no parallelization. If there is I don't need the solution but need to know if it is possible or will cuda automatically convert to a parrallel solution.


I think it should be possible.

You should be able to do that by calling, for example:

dim3 GridDim(1,1,1), BlockDim(1,1,1);

MySequentialSum<<<GridDim, BlockDim>>>(a1, a2, a3);

This way your execution environment is limited to 1 block of 1 thread.

I can’t try this right now, though.


Yes - each CUDA thread is sequential.


Thanks for the assist.

Jut :))