shared memory calculation