use shared memory and atomic increments