How to get thread ID in nn.DataParallel

Hi all,

How can I get the thread ID in nn.DataParallel? I am running my code on a single node with 4 GPUs and I am not sure how I can get the value of a tensor for each specific thread?

Any thoughts?
Thanks,

I haven’t used nn.DataParallel so default to someone who knows more, but surely couldn’t you just print .device and that would return one of the following: cuda:0, cuda:1, cuda:2, cuda:3?

1 Like

@AlphaBetaGamma96 Yes that makes sense. I am using this and it shows the device which is basically different for each thread.