CUDA operations are executed asynchronously, so you would need to synchronize the code before starting and stopping the timers to get a valid profile of the runtime. The std::cout operation is most likely a synchronization point, since the result is needed so that it can be printed in the terminal.