【问题标题】:Is it possible to run slurm commands within a singularity container?是否可以在奇异容器中运行 slurm 命令?
【发布时间】:2018-03-28 23:43:51
【问题描述】:

我想进入一个具有奇点的容器,然后运行 ​​slurm 命令。例如:

singularity shell docker://tensorflow/tensorflow:1.0.0-gpu-py3

然后在其中运行我想要运行我的脚本的脚本:

python tf_test.py

tf_test 的内容是:

import tensorflow as tf
print(tf.random_uniform((3,2)))

我遇到的问题是容器不知道我在 HPC 中或存在 slurm。是否可以在我们进入容器后才运行 slurm 命令?我对使用sbatch 特别感兴趣。使用 srun 然后进入容器是作弊,而不是我想要的。

【问题讨论】:

    标签: docker machine-learning containers slurm singularity-container


    【解决方案1】:

    不确定您正在运行的版本,但这应该适用于 2.4.x 系列。

    您可以在容器中安装 slurm,或者如果它安装在您的集群上,例如:

    /apps/sched/slurm/[ver]
    

    您可以使用 -B / --bind 选项来绑定挂载它:

    singularity shell -B /apps/sched/slurm/[ver] -B /etc/slurm
    

    但是,作业在运行时将在容器中。要强制这样做,您可以提交一个执行类似以下内容的运行脚本:

    singularity exec docker://tensorflow/tensorflow:1.0.0-gpu-py3 python /path/to/tf_test.py
    

    编辑: 一旦你对运行感到满意,IMO 最好从 Docker 源构建一个 Singularity 映像。在定义文件中,设置一个 %runscript 部分,如

    %runscript
        python "$@"
    

    然后你就可以提交了:

    /path/to/imagename.img /path/to/tf_test.py
    

    奇点图像可以像应用程序一样运行,默认情况下它将执行 %runscript 部分中的任何内容。

    【讨论】:

      猜你喜欢
      • 2018-09-28
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-05-30
      • 2021-05-15
      • 2022-08-14
      • 2021-11-14
      • 1970-01-01
      相关资源
      最近更新 更多