New GPU algorithm which uses two kernels