Functional version.

#thr/block not good.
also full opencl on cpu would be better