PaddlePaddle / PARL

A high-performance distributed training framework for Reinforcement Learning
https://parl.readthedocs.io/
Apache License 2.0
3.25k stars 820 forks source link

如何在remote_class修饰的类里使用GPU? #964

Open CCNUdhj opened 2 years ago

CCNUdhj commented 2 years ago

在job.py里修改了os.environ['CUDA_VISIBLE_DEVICES'] = '0',但是在remote_class修饰的类中使用print(torch.device('cuda:0' if torch.cuda.is_available() else 'cpu')) 输出的还是cpu。以下是我的版本信息: parl==2.0.5 torch=1.7.1

困扰了我很久,万分感激。

rical730 commented 1 year ago

感谢你的反馈,目前Actor是默认不使用GPU的,默认在CPU上跑Actor

https://github.com/PaddlePaddle/PARL/blob/7a910d3c586b01f18523ad45e4f8ecc7b49a249f/parl/remote/job.py#L17