0139
V2EX  ›  问与答

是不是买到假 gpu 了

  •  
  •   0139 · Dec 26, 2018 · 2050 views
    This topic created in 2765 days ago, the information mentioned may be changed or developed.

    采购了 3 块 1080ti 显卡,使用的时候发现这样的情况:

    gpu0 和 2 的显存使用率一模一样,跑程序时 0 的使用率上去了,2 也会跟着上去,指定使用 gpu:0 也没用

    这里是不是有什么猫腻?

    https://i.imgur.com/csN4dRj.png

    Supplement 1  ·  Dec 26, 2018

    我意思是有没有可能在显存上做了手脚,比如gpu:0和1实际共享了同一块显存

    写一个简单程序试了下,在gpu:0上分配一个超大的变量,结果gpu:2上可用显存也同步变少了

    ··· from pynvml import * import torch as t

    def get_memory(id): handle = nvmlDeviceGetHandleByIndex(id) info = nvmlDeviceGetMemoryInfo(handle) return info.used / info.total * 100

    def print_memory(): print('=' * 40) print('gpu:0 {:.2f}%, gpu:1 {:.2f}% gpu:2 {:.2f}%'.format(get_memory(0), get_memory(1), get_memory(2))) print('=' * 40)

    nvmlInit() print('NvmlInit done.')

    deviceCount = nvmlDeviceGetCount() print('{} gpus detected.'.format(deviceCount))

    print_memory()

    print('Creating tensor [999, 99, 99, 99] on gpu:0 ..........') a = t.rand(999, 99, 99, 99).to('cuda:0') print('Done.')

    print_memory() ···

    ··· NvmlInit done. 3 gpus detected.

    gpu:0 16.60%, gpu:1 1.15% gpu:2 16.60%

    Creating tensor [999, 99, 99, 99] on gpu:0 .......... Done.

    gpu:0 53.28%, gpu:1 1.15% gpu:2 53.28%

    ···

    2 replies    2018-12-26 13:31:14 +08:00
    327beckham
        1
    327beckham  
       Dec 26, 2018
    跑 keras,用环境变量指定显卡,试一下就知道了
    dachuige
        2
    dachuige  
       Dec 26, 2018
    跑个挖矿程序试试看看算力就知道了。
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   1094 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 38ms · UTC 18:31 · PVG 02:31 · LAX 11:31 · JFK 14:31
    ♥ Do have faith in what you're doing.