Call gather only if the object is a gpuArray

Actually, if the object is already in main memory, gather will do
nothing. However, early Matlab versions do not have gather function.
Thus, this could help improve the backward compatibility.