Code lines for sequential runs through PsN

3 messages 3 people Latest: Mar 30, 2016

Code lines for sequential runs through PsN

From: Ka Ho Hui Date: March 30, 2016 technical
Dear all, I have some 10,000 to 100,000 simulation files to run through PsN so I typed in cmd something which looks like the following lines: execute xxxxxyyyyy_000001.mod xxxxxyyyyy_000002.mod ... xxxxxyyyyy_030000.mod But the string is too long in this case. So, I created a batch file which breaks down the codes into 100 lines and hoped that each line will run sequentially, which looks like: execute xxxxxyyyyy_000001.mod xxxxxyyyyy_000002.mod ... xxxxxyyyyy_000300.mod execute xxxxxyyyyy_000301.mod xxxxxyyyyy_000302.mod ... xxxxxyyyyy_000600.mod execute xxxxxyyyyy_000601.mod xxxxxyyyyy_000602.mod ... xxxxxyyyyy_000900.mod ... execute xxxxxyyyyy_029701.mod xxxxxyyyyy_029702.mod ... xxxxxyyyyy_030000.mod The run started successful, unfortunately only the first line was run (so, the run stopped after the 300th file). It would be troublesome to manually run these 100 lines one by one. What would be an appropriate code for this purpose? Thanks! Matthew

RE: Code lines for sequential runs through PsN

From: Rik Schoemaker Date: March 30, 2016 technical
Hi Matthew, Use call execute in batch files to allow the process to return and continue with the next line. If you have multiple processors, use the -threads argument to spread across your processors. This would make: call execute -threads=8 xxxxxyyyyy_000001.mod ... xxxxxyyyyy_000300.mod call execute -threads=8 xxxxxyyyyy_000301.mod ... xxxxxyyyyy_000600.mod ...etc... Kind regards, Rik Rik Schoemaker, PhD Occams Malandolaan 10 1187 HE Amstelveen The Netherlands http://www.occams.eu/ +31 20 441 6410 [email protected]<mailto:[email protected]> [cid:[email protected]]
Quoted reply history
From: [email protected] [mailto:[email protected]] On Behalf Of HUI, Ka Ho Sent: 30 March 2016 10:27 To: [email protected] Subject: [NMusers] Code lines for sequential runs through PsN Dear all, I have some 10,000 to 100,000 simulation files to run through PsN so I typed in cmd something which looks like the following lines: execute xxxxxyyyyy_000001.mod xxxxxyyyyy_000002.mod ... xxxxxyyyyy_030000.mod But the string is too long in this case. So, I created a batch file which breaks down the codes into 100 lines and hoped that each line will run sequentially, which looks like: execute xxxxxyyyyy_000001.mod xxxxxyyyyy_000002.mod ... xxxxxyyyyy_000300.mod execute xxxxxyyyyy_000301.mod xxxxxyyyyy_000302.mod ... xxxxxyyyyy_000600.mod execute xxxxxyyyyy_000601.mod xxxxxyyyyy_000602.mod ... xxxxxyyyyy_000900.mod ... execute xxxxxyyyyy_029701.mod xxxxxyyyyy_029702.mod ... xxxxxyyyyy_030000.mod The run started successful, unfortunately only the first line was run (so, the run stopped after the 300th file). It would be troublesome to manually run these 100 lines one by one. What would be an appropriate code for this purpose? Thanks! Matthew
Hi Matthew,
Quoted reply history
On 3/30/2016 10:26, HUI, Ka Ho wrote: > I have some 10,000 to 100,000 simulation files to run through PsN so I > typed in cmd something which looks like the following lines: [...] > But the string is too long in this case. provided that you're trying to do this on linux, you could take a look at the xargs command. Specifically, you could try the following: ls xxxxxyyyyy_*mod | xargs execute You can use the --max-lines parameter if you want xargs to divide the job into chunks of a given size (say 300 models per execute). See "man xargs" for the full documentation. -- Paul Matthias Diderichsen, PhD Quantitative Solutions, a Certara company +31 624 330 706