Atomics function , what is it ?
Functions that ensure access to variable (memory) only by one thread at the time.
They are used to implement counters and cross-thread communication.
Functions that ensure access to variable (memory) only by one thread at the time.
They are used to implement counters and cross-thread communication.
How can i avoid that effect ?
Yours Sincerely .
Rafał Bator
How can i avoid that effect ?
Yours Sincerely .
Rafał Bator
I am not sure if I understand your question.
If you write your code without usage of atomic functions, each thread runs independently (not counting memory access conflicts, etc. but those influence performance). So writing code without usage of atomic functions avoids limiting access to memory by only one thread at a time.
On the other hand, if you call e.g. atomicInc, it will ensure that only one thread increases value, thus avoiding nasty errors.
In summary - atomic functions are not called without programmer effort. You as author of kernel use them to ensure that there is no risk of modification of shared data by more than one thread at the time.
By looking at your questions you seem not to know much about techniques used concurrent programming. While you can still use CUDA without deep knowledge, I would advice you to read some literature about threads, locks, etc. I recommend book “Principles of Concurrent and Distributed Programming” by M Ben-Ari.
I am not sure if I understand your question.
If you write your code without usage of atomic functions, each thread runs independently (not counting memory access conflicts, etc. but those influence performance). So writing code without usage of atomic functions avoids limiting access to memory by only one thread at a time.
On the other hand, if you call e.g. atomicInc, it will ensure that only one thread increases value, thus avoiding nasty errors.
In summary - atomic functions are not called without programmer effort. You as author of kernel use them to ensure that there is no risk of modification of shared data by more than one thread at the time.
By looking at your questions you seem not to know much about techniques used concurrent programming. While you can still use CUDA without deep knowledge, I would advice you to read some literature about threads, locks, etc. I recommend book “Principles of Concurrent and Distributed Programming” by M Ben-Ari.