Use prepare; Eliminate the use of shared mem in scan_kernel; Allocate the GPU memory only once