【问题标题】:SLURM, using srun to print outputsSLURM,使用 srun 打印输出
【发布时间】:2019-10-02 13:45:20
【问题描述】:

我正在使用srun 运行我的程序,但是它无法打印输出。

me@home:~$ srun -p K80q --gres=gpu:1 -N 1 python3 main.py 
2019-05-15 19:56:43.305156: I tensorflow/core/platform/cpu_feature_guard.cc:141] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2 FMA
2019-05-15 19:56:43.543516: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1392] Found device 0 with properties: 
name: Tesla K80 major: 3 minor: 7 memoryClockRate(GHz): 0.8235
pciBusID: 0000:85:00.0
totalMemory: 11.17GiB freeMemory: 11.10GiB
2019-05-15 19:56:43.543567: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1471] Adding visible gpu devices: 0
2019-05-15 19:56:43.900189: I tensorflow/core/common_runtime/gpu/gpu_device.cc:952] Device interconnect StreamExecutor with strength 1 edge matrix:
2019-05-15 19:56:43.900248: I tensorflow/core/common_runtime/gpu/gpu_device.cc:958]      0 
2019-05-15 19:56:43.900257: I tensorflow/core/common_runtime/gpu/gpu_device.cc:971] 0:   N 
2019-05-15 19:56:43.900619: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1084] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 10761 MB memory) -> physical GPU (device: 0, name: Tesla K80, pci bus id: 0000:85:00.0, compute capability: 3.7)

我只得到了上面的输出,它不能打印出我期望的信息。我该如何解决?

顺便定义一个测试代码

import tensorflow 

if __name__ == '__main__':
    for i in range(10):
        print('Hello')

可以打印Hello 10次。

更新:

20 分钟后,它会输出一些我预期的信息。如何让它立即输出?

【问题讨论】:

    标签: slurm


    【解决方案1】:

    试试srun-u选项:

    -u, --无缓冲 默认情况下,slurmstepd 和用户启动的应用程序之间的连接是通过管道进行的。由编写的 stdio 输出 该应用程序是 由 glibc 缓冲,直到它被刷新或输出设置为无缓冲。请参阅 setbuf(3)。如果指定了这个选项 任务被执行 使用伪终端,以便应用程序输出无缓冲。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2019-06-09
      • 1970-01-01
      • 1970-01-01
      • 2015-10-29
      • 1970-01-01
      • 1970-01-01
      • 2017-10-01
      • 2020-10-11
      相关资源
      最近更新 更多