CUDA_VISIBLE_DEVICES 环境变量说明

CUDA_VISIBLE_DEVICES 环境变量说明

If you are writing GPU enabled code, you would typically use a device query to select the desired GPUs. However, a quick and easy solution for testing is to use the environment variable CUDA_VISIBLE_DEVICES to restrict the devices that your CUDA application sees. This can be useful if you are attempting to share resources on a node or you want your GPU enabled executable to target a specific GPU.

Environment Variable Syntax Results
CUDA_VISIBLE_DEVICES=1 Only device 1 will be seen
CUDA_VISIBLE_DEVICES=0,1 Devices 0 and 1 will be visible
CUDA_VISIBLE_DEVICES=“0,1” Same as above, quotation marks are optional
CUDA_VISIBLE_DEVICES=0,2,3 Devices 0, 2, 3 will be visible; device 1 is masked

设置可见设备,例好你有0,1,2,3,4 五块GPU, CUDA_VISIBLE_DEVICES=3,4 ,那么当前环境可能为两个GPU, 编号为0,1。(可见设备会重新编号,跟原来编号无关)

你可能感兴趣的:(ffmpeg,cuda)