Hi,everyone! I’m a new coder using Pytorch.I have a question, why the time spent on cpu is equal to time spent on gpu? The time costs on cpu and time costs on cuda is very approximate,and I suspect the code run on cpu, but with tool of top and ‘watch -n 3 nvidia-smi’ in another terminal, I saw the change with the gpu when code run on gpu. Is there any method to show, the code really run on cuda? Thank you very much! My Pytorch version is 1.3.0, CUDA 9.0.
code is:
import torch
input = torch.randn(1000, 3, 224, 224)
conv1 = torch.Conv2d(3, 5, (3, 3))
conv2 = torch.Conv2d(5, 7, (5, 5))

with torch.autograd.Profiler.profile(use_cuda=True) as prof:
    out = conv1(input)
    out = torch.relu(out)
    out = conv2(out)
    out = torch.relu(out)
    out = torch.relu(out)

print("prof is:\n{}".format(prof))