简体   繁体   English

“/ bin / bash -l”无效选项

[英]“/bin/bash -l” Invalid option

Well, I am trying to run serial MPI jobs masked as a one job on our supercomputer. 好吧,我试图在我们的超级计算机上运行作为一个工作掩盖的串行MPI工作。 The main submission script basically looks like that: 主提交脚本基本上看起来像这样:

#!/bin/bash -l
#PBS -l nodes=4:ppn=8,walltime=24:00:00

cat $PBS_NODEFILE | uniq | tr '\\012' ' ' > tmp-$PBS_JOBID
read -a NODE < tmp-$PBS_JOBID
rm tmp-$PBS_JOBID

inode=-1
ijob=0

for ((K=1;K<=8;K++))
do
        [ $((ijob++ % 2)) -eq 0 ] && ((inode++))
        ssh ${NODE[inode]} _somepath_/RUN$K/sub.script &
done
wait
exit 0

Each sub.script looks like: 每个sub.script看起来像:

#!/bin/bash -l
#PBS -l walltime=24:00:00,nodes=1:ppn=4

module load intel
module load ompi
export FORT_BUFFERED=1

*run executable* 

wait
exit 0

And sometimes I encounter an error for each sub.script (jobs die immediately): 有时我会遇到每个sub.script的错误(作业立即死亡):

/bin/bash: -
: invalid option
Usage:  /bin/bash [GNU long option] [option] ...
        /bin/bash [GNU long option] [option] script-file ...
*etc.*

The most interesting thing is that it is a random error meaning if I run the same script for the second (or 3rd etc.) time it will run without any problems. 最有趣的是它是一个随机错误意味着如果我在第二个(或第三个等)时间运行相同的脚本它将运行没有任何问题。 Sometimes I'm lucky, sometimes I'm not... Removing -l won't help because in that case modules cannot be loaded and mpirun won't work. 有时我很幸运,有时我不是......删除-l将无济于事,因为在这种情况下模块无法加载,mpirun将无法正常工作。 Any suggestions how to fix it? 任何建议如何解决?

Thanks a lot in advance! 非常感谢提前!

You script probably has characters in it that you cannot see. 您的脚本可能包含您无法看到的字符。 Perhaps it was copy/pasted using the wrong character set translation or is in DOS format. 也许是使用错误的字符集翻译进行复制/粘贴或者是DOS格式。 In the case of the latter you can use the tofrodos or dos2unix package to correct. 对于后者,您可以使用tofrodos或dos2unix包进行更正。

In either case you could pull it up in 'vi' or another application which will usually show weird characters like ^@ or ^M. 在任何一种情况下,你都可以在'vi'或其他应用程序中提取它,这些应用程序通常会显示奇怪的字符,如^ @或^ M. You could try cat -v filename which might help see these oddities. 你可以试试cat -v filename ,这可能有助于看到这些奇怪的东西。 Push comes to shove try hexdump (or hd, or od). 推动尝试hexdump(或高清,或od)。

I just encountered this and I had invalid line endings. 我刚遇到这个,我的行结尾无效。 I changed from CRLF to LF and that fixed it! 我从CRLF改为LF并修复了它!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM