- False. This line represents a read-modify-write operation that can yield wrong results when multiple threads are trying to increment the same memory location, as in the case of histogram calculation.
- In the case of using shared memory, fewer threads are trying to access 256 memory elements in shared memory, instead of all threads as in the case without shared memory. This will help in reducing time overhead in the atomic operation.
- The kernel call function in case of using share memory is as follows:
atomic_hist(
drv.Out(h_result), drv.In(h_a), numpy.uint32(SIZE),
block=(n_threads,1,1), grid=(NUM_BIN,1),shared= 256*4)
The size of the shared memory should be defined, while calling the kernel. This is specified by using the shared argument in the kernel call function.
- The histogram is a statistical feature that gives important information regarding...