I want to implement an algorithm, which performs operations on very large arrays (up to 10 million entries each), on the GPU. I have already achieved, that it runs on the GPU and even gives a speed up of up to factor 10, but I am not entirely sure, whether all operations and functions of the algorithm are running on the GPU, or whether there is still CPU-GPU transfers required. Specifically, I wonder whether Matlab offers an intuitive way of showing such unnecessary transfers.
So my question is whether the following operation b leads to such transfers:
If I define two variables amplitude and period on the CPU - let's say
and create an gpu array
and calculate b by using the function
b = @(u) b_st+amplitude*sin(u*2*pi/period);
be calculated entirely on the GPU? Or do I have to also define period and amplitude on the GPU via gpuarray()?
Thank you in advance!