video analysis2.0拆分,ffmpeg封装go接口库
zhangmeng
2020-10-09 d64868c215e35088bfeda67aeb04db0800bf2844
csrc/common/gpu/info.cpp
@@ -412,6 +412,27 @@
    return -1;
}
bool satisfy(const int index, const int need, const int reserved){
    nvGpuInfo_t gpu_info;
    int ret = get_gpu_info(&gpu_info);
    if(!ret){
        if (gpu_info.device_count == 0) return -1;
        for(int i = 0; i < gpu_info.device_count; i++){
            if (i == index){
                int mem_free = (gpu_info.devices[i].memory_free >> 20) - reserved - need;
                if(mem_free > 0){
                    return true;
                }
            }
        }
    }
    return false;
}
int test(void)
{
    nvGpuInfo_t gpu_buf;