在终端执行程序时指定GPU
CUDA_VISIBLE_DEVICES=0 python your_file.py # 指定GPU集群中第一块GPU使用,其他的屏蔽掉
在python代码中指定GPU
import os
os.environ["CUDA_VISIBLE_DEVICES"] = "0" #指定第一块gpu
终端指定GPU,后台挂起
CUDA_VISIBLE_DEVICES=0 nohup python train_facenet.py &
回车后显示[1] 18779 nohup: ignoring input and appending output to 'nohup.out',证明运行成功,同时把程序运行的输出信息放到当前目录的nohup.out文件中。
查看nohup.out里的日志
tailf nohup.out
查看进程
ps x 显示没有控制终端的进程