shenyunhang / APE

[CVPR 2024] Aligning and Prompting Everything All at Once for Universal Visual Perception
https://arxiv.org/abs/2312.02153
Apache License 2.0
459 stars 28 forks source link

如何设置device设备号? #29

Open David-19940718 opened 4 months ago

David-19940718 commented 4 months ago

您好,很感谢您的出色工作!

现在服务器有多张卡,请问是否支持每张卡跑一个程序,我想并发推理,这个要如何如设置?

shenyunhang commented 3 months ago

感谢您的关注!

如果是用demo/demo_lazy.py进行推理,有两种方法并发

  1. 第一种是把这一行改成

    demo = VisualizationDemo(cfg, parallel=True, args=args)
  2. 第二种是设置CUDA_VISIBLE_DEVICES

    CUDA_VISIBLE_DEVICES=0 python3.9 demo/demo_lazy.py ...
    
    CUDA_VISIBLE_DEVICES=1 python3.9 demo/demo_lazy.py ...
    
    CUDA_VISIBLE_DEVICES=2 python3.9 demo/demo_lazy.py ...
    ....
SilenceWinter commented 2 months ago

感谢您的关注!

如果是用demo/demo_lazy.py进行推理,有两种方法并发

  1. 第一种是把这一行改成
    demo = VisualizationDemo(cfg, parallel=True, args=args)
  2. 第二种是设置CUDA_VISIBLE_DEVICES

    CUDA_VISIBLE_DEVICES=0 python3.9 demo/demo_lazy.py ...
    
    CUDA_VISIBLE_DEVICES=1 python3.9 demo/demo_lazy.py ...
    
    CUDA_VISIBLE_DEVICES=2 python3.9 demo/demo_lazy.py ...
    ....

请问,预测阶段,如果两块3090GPU分别加载一个VisualizationDemo模型,同时启动,这种情况,怎么改 demo/demo_lazy.py? 我在demo/demo_lazy.py中,增加了 cfg.train.device = "cuda:1" ,让一个模型加载到第二块GPU,但是遇到报错如下 RuntimeError: CUDA error: CUBLAS_STATUS_EXECUTION_FAILED when calling `cublasLtMatmul( ltHandle, computeDesc.descriptor(), &alpha_val......

shenyunhang commented 2 months ago

有可能是一些参数或者数据不在同一个卡上导致的。