Ubuntu 命令行 指定GPU 运行 Python 程序

标签:#GPU##linux##python# 时间:2018/12/19 10:59:44 作者:somTian

CUDA_VISIBLE_DEVICES=1 python your_file.py

这样在跑你的网络之前,告诉程序只能看到1号GPU,其他的GPU它不可见

可用的形式如下:

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
CUDA_VISIBLE_DEVICES=”” No GPU will be visible

参考:
ubuntu 16.04上运行tensor flow 指定gpu

欢迎大家关注DataLearner官方微信,接受最新的AI技术推送