I would like to run several cases in CFX one by one using a specific parallel method. How can I define this in Perl?




To run a case, say using the definition file case1.def, one can type the following command into the command line (a command window can be obtaining from the CFX Launcher by: CFX Launcher ->Tool->Command Line):
cfx5solve -batch -def case1.def

To do the same thing in Perl, one needs to quote the command and put system before it, i.e.:
system (`cfx5solve -batch -def case1.def`);
where system is a Perl function to execute a system command.

To run case1.def in parallel, say MPICH Local Parallel for Windows, one can type the following in command line:
cfx5solve -batch -def case1.def -start-method "MPICH Local Parallel for Windows" -part 2
where the part switch defines the number of partitions.

To do the same thing in Perl, one need to use escape `` in Perl, i.e.:
system ("cfx5solve -batch -def case1.def -start-method "MPICH Local Parallel for Windows" -part 2");

Basically, in a situation where we have double quotes within double quotes, one needs to use in Perl. This usually happens when user wants to specify parallel method and/or a host list.

Now, if one wants to run several cases batch using a specific parallel method, one can put the following lines in the Perl script:

system ("cfx5solve -batch -def case1.def -start-method "MPICH Local Parallel for Windows" -part 2");
sleep 5;
system ("cfx5solve -batch -def case2.def -start-method "MPICH Local Parallel for Windows" -part 2");
sleep 5;
system ("cfx5solve -batch -def case3.def -start-method "MPICH Local Parallel for Windows" -part 2");

The `sleep` command asks the script to wait for 5 seconds before initiating the next command.





Show Form
No comments yet. Be the first to add a comment!