Coder Social home page Coder Social logo

Multi GPU training problem about di-engine HOT 8 CLOSED

opendilab avatar opendilab commented on August 22, 2024
Multi GPU training problem

from di-engine.

Comments (8)

zqh0253 avatar zqh0253 commented on August 22, 2024

The file demo/simple_rl/ppo_train.py is in DI-drive repo

from di-engine.

PaParaZz1 avatar PaParaZz1 commented on August 22, 2024

You can refer to this demo and add DistContext in your program

from di-engine.

zqh0253 avatar zqh0253 commented on August 22, 2024

Thanks for your suggestion. But I add DistContext and get the following error:

WARNING:root:If you want to use numba to speed up segment tree, please install numba first
pygame 1.9.6
Hello from the pygame community. https://www.pygame.org/contribute.html
Traceback (most recent call last):
File "imgppo_train.py", line 189, in
with DistContext():
File "/home/qhzhang/code/DI-engine/ding/utils/pytorch_ddp_dist_helper.py", line 114, in enter
dist_init()
File "/home/qhzhang/code/DI-engine/ding/utils/pytorch_ddp_dist_helper.py", line 81, in dist_init
raise RuntimeError("please indicate rank explicitly in dist_init method")
RuntimeError: please indicate rank explicitly in dist_init method

from di-engine.

PaParaZz1 avatar PaParaZz1 commented on August 22, 2024

Are you run multi-gpu program in your own machine? And I guess you should prepare related environment variables here.

We test this parts in slurm before so it would be a bit inconvenient in local machine. And you can add your own advice for multi-gpu training in local machine.

from di-engine.

zqh0253 avatar zqh0253 commented on August 22, 2024

I am running multi-gpu program in my own machine so your code based on slurm environment does not work.
I have gone through the relevant code about multi-gpu part. I think using torch.distributed.launch may help user to use your multi-gpu code in local machine.
But another problem for me is that I am actually using DI-drive and one di-drive program will lauch several (like 8) carla clients. When using torch.distributed.launch, the carla clients will be launched multiple times (like 8*N, the N is gpu num).
So I find a quick fix using torch.DataParallel to do multi-gpu training without your API.

from di-engine.

PaParaZz1 avatar PaParaZz1 commented on August 22, 2024

OK, we will support torch.DataParallel in next version, for some cases like you encountered. And you can pay attention to roadmap for further update.

from di-engine.

zxzzz0 avatar zxzzz0 commented on August 22, 2024

We have this same error today when running on a single machine with 2 GPUs.
raise RuntimeError("please indicate rank explicitly in dist_init method")

@PaParaZz1

from di-engine.

WangJuan6 avatar WangJuan6 commented on August 22, 2024

Hi, @PaParaZz1
I have the same error, can you provide a demo of how to use multi-GPU in the custom environment?
Thanks

from di-engine.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.