fixed reduce kernel to compute elements_per_block properly.