cuda.c: extract out copy_array_{to,from}_device
cuda.c: extract out copy_array_{to,from}_device

We will be able to reuse these functions when we add nodes for copying
arrays to and from the device directly to the schedule tree.

Signed-off-by: Sven Verdoolaege <e5350bbed4977f5eb8ae1dc6abd9ae59d21ace75@kotnet.org>

Meinersbur/ppcg,nicolasvasilache/ppcg,Meinersbur/ppcg,nicolasvasilache/ppcg