我有使用使用在一个bash脚本循环变量来传递不同的命令行参数
int main(int argc, char *argv[]){
double a,b;
a = atof(argv[1]);
b = atof(argv[2]);
further code.....
我上运行的代码C++程序,其余传递两个兼作从命令行输入使用qsub
实用性和我有一个名为“bash脚本jobsub.sh`提交它看起来像这样
#!/bin/csh -f
hostname
cd /home/roy/codes/3D # change directory first -- replace Mysubdir
set startdir = `pwd` # remember the directory we're in
if(! -d /scratch/$USER) then
mkdir /scratch/$USER # create scratch directory
endif # if it does not exist
#cp infile12 /scratch/$USER # copy input file to scratch directory
cd /scratch/$USER # change to scratch directory
#rm *.*
$HOME/codes/3D/autoA100.out 2.1 2.2 # run a program
cp * $startdir # copy outputfiles back to where we started
在我做终端的作业集群
但是,我想在不同的内核上并行运行a
和b
不同值的同一个可执行文件。是否有可能写在bash脚本循环,这样我可以做 类似,
for i=1;i<=10;i++ {
$HOME/codes/3D/autoA100.out 2+i*0.1 2+i*0.2
}
您的“bash”脚本类似于bash,但包含许多语法错误。 – jordanm 2012-07-06 01:21:20
@jordanm:在某些方面,它看起来像csh(例如'set')。 – 2012-07-06 02:05:05
@DennisWilliamson:是的,它看起来像csh – 2012-07-06 05:56:06