I have four different experiment factors.
For each of the experiments I need to vary three parameters and call a fortran program. I pass the parameters to the fortran program using an EOF construction.
Here is an example of the code:
set expfac=(0.1 0.3 0.5 0.7)
set fact1=(1 3 2 8)
set fact2=(9 2 1 4)
set fact3=(5 6 1 4)
@ exp = 1
while ( $exp <= $#expfac )
foreach i ($fact1)
foreach k ($fact2)
foreach h ($fact3)
./PROGRAM << EOF
expfac |$expfac[$exp]
fact1 |${i}
fact2 |${k}
fact3 |${h}
EOF
end
end
end
@ exp += 1
end
How can I parallelize respect to the while loop? Using GNU parallel maybe?
My csh skills are crap, so here it is in bash:
The above will unfortunately fail if the values include characters that need shell quoting ("&\'* and the likes). From your example it seems it will not be a problem for you, though.