Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to make the program use the GPU as much as possible? #5

Open
GreenBeanCake opened this issue Mar 9, 2023 · 1 comment
Open

Comments

@GreenBeanCake
Copy link

I am using GPU to run this program, but the GPU usage is very low. How can I increase the GPU usage to make the program execute faster? What settings in the code need to be changed to make the best possible use of the GPU? 谢谢您

@binary-husky
Copy link
Owner

Try changing "device" and "gpu_party" in launch json:

{
    // --- Part1: config HMP core --- 
    "config.py->GlobalConfig": {
        ............
        "device": "cuda:0",
        "gpu_party": "off",
        ............
    },
}

The former setting intialize gpu in main.py and set the device flag in "config.py->GlobalConfig".
The latter setting disables gpu memory sharing between HMP experiments, which slightly increases speed and safety.
Then, in wherever you'd like to use gpu:

from config import GlobalConfig as cfg
...
model.to(cfg.device)
tensor.to(cfg.device)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants