accessing the same variable from different threads?

hi all,

is there a problem with acessing the same variable (from an array in global memory) in different threads. i.e. will it give me a runtime error?

thanks
sachin

Reading the same global memory variable from different threads isn’t a problem. Writing to the same global memory array from multiple threads simultaneously isn’t a problem either, as long if two threads never write to the same array element. Writing to the same array element or address from multiple threads will cause a race or inconsistency that will effect the correctness of the program. It will not give a runtime error, provided the address/index is valid and in bounds.