Nvidia-smi不显示任何进程

时间:2020-08-01 09:49:28

标签: python-3.x tensorflow

我正在使用Tensorflow处理一个小案例。 安装版本:tensorflow(1.13.1版),tensorflow-gpu == 1.13.1,cuda10.0,cudnn7.4,Windows10,GPU:740M,兼容性:3.5。

运行代码以检查是否使用GPU来加速进程nvidia-smi时出现问题,找不到正在运行的进程。

这是我的代码的一部分:

class DQN():
    # DQN Agent
    def __init__(self, env):
        self.replay_buffer = deque()
        self.time_step = 0
        self.epsilon = INITIAL_EPSILON
        self.state_dim = env.observation_space.shape[0]  
        self.action_dim = env.action_space.n            

        # Init session
        import os
        os.environ["CUDA_VISIBLE_DEVICES"]= "0,1,2"
        config=tf.ConfigProto(log_device_placement=True, allow_soft_placement=True,device_count = {'GPU': 3} )
        config.gpu_options.allow_growth = True
        config.gpu_options.per_process_gpu_memory_fraction = 0.8
        self.session = tf.InteractiveSession(config = config)
        self.create_Q_network()
        self.create_training_method()
        self.session.run(tf.global_variables_initializer())

        # loading networks
        self.saver = tf.train.Saver()
        global summary_writer
        summary_writer = tf.summary.FileWriter('~/car_logs',graph=self.session.graph)

,我使用log_device_placement来记录设备的状态,我可以得到结果。从显示的日志看来,GPU已成功在此过程中使用? enter image description here

由于我使用self.session = tf.InteractiveSession(config = config),所以我猜所有操作都将在此会话中运行。但是,为什么nvidia-smi甚至不会显示GPU的过程?

我在程序运行时不断调用``nvidia -smi`'',但得到相同的结果。我知道在wdmm模式下可能不会显示内存使用情况,但是我猜该过程应该在那里。 enter image description here

如果它可以在我的GPU上成功运行,我应该如何检查呢?

谢谢你!

1 个答案:

答案 0 :(得分:0)

一个 shim 驱动程序允许 in-docker nvidia-smi 显示正确的进程列表而无需修改任何内容。

见:https://github.com/matpool/mpu