hmp2g icon indicating copy to clipboard operation
hmp2g copied to clipboard

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

Open GreenBeanCake opened this issue 2 years ago • 1 comments
trafficstars

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? 谢谢您

GreenBeanCake avatar Mar 09 '23 14:03 GreenBeanCake

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)

binary-husky avatar Mar 11 '23 07:03 binary-husky