我正在尝试在HPC上使用Slurm作业调度程序来获得一个非常基本的作业数组脚本。我得到错误:
slurmstepd: error: execve(): Rscript: No such file or directory
这与此类似,但我没有使用任何export
命令,所以这不是原因。一些消息来源说,这可能与在Windows中创建这些脚本有关,所以行的结尾对Unix不起作用。这可能是问题所在吗?如果是,我该如何检查?
我的shell脚本:
#!/bin/bash
# Example of running R script with a job array
#SBATCH --nodes=1
#SBATCH --array=1-10 # how many tasks in the array
#SBATCH --ntasks-per-node=10
#SBATCH -o hello-%j-%a.txt
#SBATCH --mail-user=user@email.address
# Load software
module load R/4.0.0-foss-2020a
# Run R script with a command line argument
srun Rscript hello.R $SLURM_ARRAY_TASK_ID
脚本-hello.R是:
#!/usr/bin/env
# Rscript
# accept command line arguments and save them in a list called args
args = commandArgs(trailingOnly=TRUE)
# print task number
print(paste0('Hello! I am a task number: ', args[1]))
多亏了一些离线帮助,我的问题得到了答案。似乎我不需要在shell脚本中使用srun
,而是需要在hello中的shebang行中包含Rscript
。R
外壳脚本是:
#!/bin/bash
# Example of running R script with a job array
#SBATCH --nodes=1
#SBATCH --array=1-10 # how many tasks in the array
#SBATCH --ntasks-per-node=10
#SBATCH -o hello-%j-%a.txt
#SBATCH --mail-user=tclewis1@sheffield.ac.uk
# Load software
module load R/4.0.0-foss-2020a
# Run R script with a command line argument
Rscript hello.R $SLURM_ARRAY_TASK_ID
你好。R现在是:
#!/usr/bin/env/Rscript
# accept command line arguments and save them in a list called args
args = commandArgs(trailingOnly=TRUE)
# print task number
print(paste0('Hello! I am a task number: ', args[1]))