cuda.c: extract out declare_device_array