Switch to Unified Virtual Address memory copies

CUDA [Unified Virtual Addressing](http://docs.nvidia.com/cuda/cuda-c-programming-guide/index.html#unified-virtual-address-space) makes host-device, device-host, and device-device communication transparent by distinguishing the cases through virtual addresses of the pointers. Switching to this mode is intended as a useful abstraction for parallelism so that blob data can be transferred by the same interface regardless of source and destination.

Here all `cudaMemcpy` calls are switched to `cudaMemcpyDefault` mode used by virtual addressing.

A counter-argument is that this makes host / device communication less explicit and perhaps confusing. However, the pointers and our practice of `{cpu,gpu}` prefixes keep this clear. Provided we continue in the direction of device abstraction, needing to explicitly reference cpu or gpu operation should go away on its own with the exception of data layers and future host / device parallelism.

To standardize the interface all `memcpy` are replaced by `caffe_copy` and all `memset` by `caffe_set` and `caffe_gpu_set` except for `SyncedMem` where it's awkward. Note this melds `caffe_gpu_copy` into `caffe_copy` now that addressing is virtual.
At one point I had the void version called "caffe_transfer" since it is
only used by SyncedMem to go from CPU to GPU and back. Perhaps that's still
not a good name, since it is a copy and the source stays where it is.

I'll try to think of a name, or if you come up with one you like then
commit it.

Le samedi 28 juin 2014, Jeff Donahue <notifications@github.com> a écrit :

> In include/caffe/util/math_functions.hpp:
>
> > @@ -59,6 +59,8 @@ void caffe_gpu_axpby(const int N, const Dtype alpha, const Dtype* X,
> >  template <typename Dtype>
> >  void caffe_copy(const int N, const Dtype *X, Dtype *Y);
> >
> > +void caffe_copy(const size_t N, const void *X, void *Y);
>
> I'm a little worried about this overloading -- it seems a little hard to
> figure out whether this generic version or the Dtype version is being
> called since each argument of the function signature is a static_cast away
> from the Dtype version, and then if you accidentally call this one, the
> size of the copy will probably be wrong. Google style guide recommends only
> overloading functions when it's very clear which version will be called
> [1]. I'd prefer if this had some other name (caffe_void_copy? not sure).
>
> [1]
> http://google-styleguide.googlecode.com/svn/trunk/cppguide.xml#Function_Overloading
>
> —
> Reply to this email directly or view it on GitHub
> <https://github.com/BVLC/caffe/pull/555/files#r14324838>.
>