InternEvo icon indicating copy to clipboard operation
InternEvo copied to clipboard

[Bug] do not use torch.cuda.current_device() as device, since it only retures an int

Open sunpengsdu opened this issue 1 year ago • 3 comments

Describe the bug

we have a lot of cases like following:

data = torch.empty(partition_size, dtype=tensor.dtype, device=torch.cuda.current_device(), requires_grad=False)

where we directly use device=torch.cuda.current_device(). However, it is not recommended to do like it, since torch.cuda.current_device() only returns device id. It is OK to run such codes on GPUs. However, maybe there are some problems when running on NPU

Environment

python3.8 + torch2.1

Other information

No response

sunpengsdu avatar Mar 26 '24 11:03 sunpengsdu

企业微信截图_96b76769-6b40-4504-b17a-102e3ae70efa ![Uploading 企业微信截图_f6b71604-f3a9-4917-b0f4-e36960e097c3.png…]()

sunpengsdu avatar Mar 27 '24 02:03 sunpengsdu

企业微信截图_f6b71604-f3a9-4917-b0f4-e36960e097c3

sunpengsdu avatar Mar 27 '24 02:03 sunpengsdu

already removed currently

https://github.com/InternLM/InternEvo/pull/139/files

sallyjunjun avatar Mar 27 '24 09:03 sallyjunjun