我编写了这段代码,可以在我的 Linux 远程机器上执行一些不同输入的重复实验。
#!/bin/bash
#timeout 10m
trap "exit 1" INT
repeat() {
executiontime=$( /usr/bin/time /home/me/optimathsat-1.5.1-macos-64-bit/bin/optimathsat < file.smt2 2>&1 >/dev/null)
echo "$executiontime">>results.csv
}
export -f repeat
for length in 30 ; do
step=0.05
short=0 #0
long=1
for i in {1..10}; do
ratio=0
for j in {1..10}; do
declare -a listofresults
echo "$length $short $long $ratio">>results.csv
python3 main.py "$length" "$short" "$long" "$ratio">file.smt2
chmod 775 file.smt2
declare total=0
declare m=0
parallel -n0 repeat ::: {1..10}
ratio=$(echo "scale=10; ($ratio) + ($step)" | bc)
done
short=$(echo "scale=10; ($short) + ($step)" | bc)
long=$(echo "scale=10; ($long) - ($step)" | bc)
done
done
trap - INT
我已经在我自己的 mac 机器上执行了这段代码并且它有效(使用 gtime 而不是 /usr/bin/time )但现在我收到了这个错误,我不知道它是什么意思/
0inputs+0outputs (0major+66minor)pagefaults 0swaps
/home/me/optimathsat-1.5.1-macos-64-bit/bin/optimathsat: 1: /home/project/optimathsat-1.5.1-macos-64-bit/bin/optimathsat:
Syntax error: word unexpected (expecting ")")
当我尝试手动执行指令时,我得到了这个:
src$ python3 main.py 10 0.5 0.5 0.5>file.smt2
我检查了file.smt2,它应该是,然后发生这种情况
src$ /home/project/optimathsat-1.5.1-macos-64-bit/bin/optimathsat < file.smt2
-bash: /home/project/optimathsat-1.5.1-macos-64-bit/bin/optimathsat: cannot execute binary file: Exec format error