1

I need to execute the command below (as part of a script) but I don't know in what order to put things so that it executes correctly. What I am trying to do is to give file.smt2 as input to optimathsat, execute it, get the execution time. But I want this to be done several times in parallel using all CPU cores.

parallel -j+0 time Desktop/optimathsat-1.5.1-macos-64-bit/bin/optimathsat < file.smt2 &>results.csv 

I added #!/bin/bash -x at the beginning of my file to look at what is happening and this was the output:

+ parallel -j+0 time file.smt2
parallel: Warning: Input is read from the terminal. You are either an expert
parallel: Warning: (in which case: YOU ARE AWESOME!) or maybe you forgot.
parallel: Warning: ::: or :::: or -a or to pipe data into parallel.

...from the 1st line, I can tell the order is wrong. From line 2,3 and 4 the syntax is lacking. How can I fix this?

Patrick Trentin
  • 7,126
  • 3
  • 23
  • 40
basel117
  • 189
  • 1
  • 10
  • Hint: `foo bar > baz` redirects the output of `foo bar` to overwrite the file *baz*. – agc Apr 02 '19 at 22:22
  • @agc I have fixed the typo. I know that > is usually for redirection. the documentation of Optimathsat suggests this way. – basel117 Apr 04 '19 at 12:13

1 Answers1

0

So I take it you do not care about the results, but only the timing:

seq $(parallel --number-of-threads) |
  parallel -j+0 -N0 --joblog my.log 'Desktop/optimathsat-1.5.1-macos-64-bit/bin/optimathsat < file.smt2'
cat my.log

-N0 inserts 0 arguments.

Consider reading GNU Parallel 2018 (printed, online) - at least chapter 1+2. Your command line will thank you for it.

Ole Tange
  • 31,768
  • 5
  • 86
  • 104